From b05a50b4b6d5646ff20b8884f983b40397eebbb9 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 9 Mar 2022 00:21:03 +0100 Subject: [PATCH 01/17] chore(deps): update dependency google-cloud-compute to v1.1.0 (#237) --- samples/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/requirements.txt b/samples/requirements.txt index 23ea27c39..c0be0f7c6 100644 --- a/samples/requirements.txt +++ b/samples/requirements.txt @@ -1,3 +1,3 @@ isort==5.10.1 black==22.1.0 -google-cloud-compute==1.0.0 \ No newline at end of file +google-cloud-compute==1.1.0 \ No newline at end of file From a034f7cecf5ceddfb24fbafe533a91c04149969a Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Sun, 13 Mar 2022 17:08:13 +0100 Subject: [PATCH 02/17] chore(deps): update dependency pytest to v7.1.0 (#238) --- samples/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/requirements-test.txt b/samples/requirements-test.txt index 45720ccd4..fd74ccfa7 100644 --- a/samples/requirements-test.txt +++ b/samples/requirements-test.txt @@ -1,4 +1,4 @@ -pytest==7.0.1 +pytest==7.1.0 pytest-parallel==0.1.1 flaky==3.7.0 google-cloud-storage==2.1.0; python_version == '3.6' From dca8554bb7399b91824309090071bf94238ba7da Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 14 Mar 2022 19:29:28 +0100 Subject: [PATCH 03/17] chore(deps): update dependency google-cloud-storage to v2.2.0 (#239) --- samples/requirements-test.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/requirements-test.txt b/samples/requirements-test.txt index fd74ccfa7..4ee0022ff 100644 --- a/samples/requirements-test.txt +++ b/samples/requirements-test.txt @@ -1,5 +1,5 @@ pytest==7.1.0 pytest-parallel==0.1.1 flaky==3.7.0 -google-cloud-storage==2.1.0; python_version == '3.6' -google-cloud-storage==2.1.0; python_version >= '3.7' \ No newline at end of file +google-cloud-storage==2.2.0; python_version == '3.6' +google-cloud-storage==2.2.0; python_version >= '3.7' \ No newline at end of file From e861117a6d2be2d433123e9630cd75e775155aa1 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 16 Mar 2022 12:34:29 +0100 Subject: [PATCH 04/17] chore(deps): update dependency google-cloud-storage to v2.2.1 (#240) * chore(deps): update dependency google-cloud-storage to v2.2.1 * chore: remove pin for python3.6 samples Co-authored-by: Anthonios Partheniou --- samples/requirements-test.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/samples/requirements-test.txt b/samples/requirements-test.txt index 4ee0022ff..0538df0bb 100644 --- a/samples/requirements-test.txt +++ b/samples/requirements-test.txt @@ -1,5 +1,4 @@ pytest==7.1.0 pytest-parallel==0.1.1 flaky==3.7.0 -google-cloud-storage==2.2.0; python_version == '3.6' -google-cloud-storage==2.2.0; python_version >= '3.7' \ No newline at end of file +google-cloud-storage==2.2.1 From 2298e8dd0e31a0075b71a0755bd81ea64671cca4 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Sat, 19 Mar 2022 11:36:29 +0100 Subject: [PATCH 05/17] chore(deps): update dependency pytest to v7.1.1 (#241) --- samples/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/requirements-test.txt b/samples/requirements-test.txt index 0538df0bb..0d1f5b210 100644 --- a/samples/requirements-test.txt +++ b/samples/requirements-test.txt @@ -1,4 +1,4 @@ -pytest==7.1.0 +pytest==7.1.1 pytest-parallel==0.1.1 flaky==3.7.0 google-cloud-storage==2.2.1 From 55f7361a3ad917a34527bd1fa54dcc28d1467b51 Mon Sep 17 00:00:00 2001 From: Maciej Strzelczyk Date: Wed, 23 Mar 2022 16:03:25 +0100 Subject: [PATCH 06/17] chore(samples): Making samples required for moving VM instance docs (#242) Co-authored-by: Owl Bot --- .../ingredients/disks/autodelete_change.py | 61 ++++++++++ .../ingredients/disks/create_from_image.py | 67 +++++++++++ .../ingredients/disks/create_from_snapshot.py | 65 +++++++++++ samples/ingredients/disks/delete.py | 48 ++++++++ samples/ingredients/disks/list.py | 43 +++++++ .../ingredients/instances/create_instance.py | 29 +++++ samples/ingredients/snapshots/create.py | 60 ++++++++++ samples/ingredients/snapshots/delete.py | 49 ++++++++ samples/ingredients/snapshots/list.py | 45 ++++++++ samples/noxfile_config.py | 2 +- samples/recipes/disks/__init__.py | 13 +++ samples/recipes/disks/autodelete_change.py | 21 ++++ samples/recipes/disks/create_from_image.py | 21 ++++ samples/recipes/disks/create_from_snapshot.py | 21 ++++ samples/recipes/disks/delete.py | 21 ++++ samples/recipes/disks/list.py | 22 ++++ samples/recipes/snapshots/__init__.py | 13 +++ samples/recipes/snapshots/create.py | 22 ++++ samples/recipes/snapshots/delete.py | 21 ++++ samples/recipes/snapshots/list.py | 21 ++++ samples/sgs.py | 2 + samples/snippets/disks/__init__.py | 13 +++ samples/snippets/disks/autodelete_change.py | 78 +++++++++++++ samples/snippets/disks/create_from_image.py | 81 +++++++++++++ .../snippets/disks/create_from_snapshot.py | 80 +++++++++++++ samples/snippets/disks/delete.py | 55 +++++++++ samples/snippets/disks/list.py | 49 ++++++++ samples/snippets/firewall/create.py | 5 +- samples/snippets/firewall/delete.py | 4 +- samples/snippets/firewall/list.py | 2 +- samples/snippets/firewall/main.py | 25 +++- samples/snippets/firewall/patch.py | 4 +- samples/snippets/images/get.py | 10 ++ samples/snippets/images/pagination.py | 2 +- samples/snippets/instances/create.py | 64 +++++++++-- .../create_from_custom_image.py | 64 +++++++++-- .../create_from_public_image.py | 64 +++++++++-- .../create_from_snapshot.py | 63 +++++++--- .../create_with_additional_disk.py | 78 ++++++++++--- .../create_with_snapshotted_data_disk.py | 77 ++++++++++--- .../snippets/instances/create_with_subnet.py | 64 +++++++++-- .../instances/custom_hostname/create.py | 64 +++++++++-- .../create_shared_with_helper.py | 84 +++++++++++--- .../create_with_helper.py | 84 +++++++++++--- .../create_without_helper.py | 108 +++++++++++------- .../extra_mem_no_helper.py | 68 ++++++++--- .../custom_machine_types/helper_class.py | 20 +++- .../custom_machine_types/update_memory.py | 11 ++ samples/snippets/instances/delete.py | 5 + .../instances/delete_protection/create.py | 64 +++++++++-- .../instances/delete_protection/get.py | 2 +- .../instances/delete_protection/set.py | 4 +- samples/snippets/instances/list_all.py | 4 +- .../preemptible/create_preemptible.py | 64 +++++++++-- samples/snippets/instances/reset.py | 7 +- samples/snippets/instances/start.py | 7 +- samples/snippets/instances/start_encrypted.py | 5 + samples/snippets/instances/stop.py | 9 +- samples/snippets/snapshots/__init__.py | 13 +++ samples/snippets/snapshots/create.py | 67 +++++++++++ samples/snippets/snapshots/delete.py | 54 +++++++++ samples/snippets/snapshots/list.py | 49 ++++++++ ..._sample_create_vm.py => test_create_vm.py} | 4 +- ...e_custom_types.py => test_custom_types.py} | 0 ...fault_values.py => test_default_values.py} | 0 samples/snippets/tests/test_disks.py | 59 ++++++++++ ...st_sample_firewall.py => test_firewall.py} | 0 .../{test_sample_images.py => test_images.py} | 0 ...late.py => test_instance_from_template.py} | 0 ...rt_stop.py => test_instance_start_stop.py} | 0 ...ample_pagination.py => test_pagination.py} | 0 samples/snippets/tests/test_snapshots.py | 58 ++++++++++ ..._sample_templates.py => test_templates.py} | 2 +- .../snippets/usage_report/usage_reports.py | 2 +- 74 files changed, 2227 insertions(+), 240 deletions(-) create mode 100644 samples/ingredients/disks/autodelete_change.py create mode 100644 samples/ingredients/disks/create_from_image.py create mode 100644 samples/ingredients/disks/create_from_snapshot.py create mode 100644 samples/ingredients/disks/delete.py create mode 100644 samples/ingredients/disks/list.py create mode 100644 samples/ingredients/snapshots/create.py create mode 100644 samples/ingredients/snapshots/delete.py create mode 100644 samples/ingredients/snapshots/list.py create mode 100644 samples/recipes/disks/__init__.py create mode 100644 samples/recipes/disks/autodelete_change.py create mode 100644 samples/recipes/disks/create_from_image.py create mode 100644 samples/recipes/disks/create_from_snapshot.py create mode 100644 samples/recipes/disks/delete.py create mode 100644 samples/recipes/disks/list.py create mode 100644 samples/recipes/snapshots/__init__.py create mode 100644 samples/recipes/snapshots/create.py create mode 100644 samples/recipes/snapshots/delete.py create mode 100644 samples/recipes/snapshots/list.py create mode 100644 samples/snippets/disks/__init__.py create mode 100644 samples/snippets/disks/autodelete_change.py create mode 100644 samples/snippets/disks/create_from_image.py create mode 100644 samples/snippets/disks/create_from_snapshot.py create mode 100644 samples/snippets/disks/delete.py create mode 100644 samples/snippets/disks/list.py create mode 100644 samples/snippets/snapshots/__init__.py create mode 100644 samples/snippets/snapshots/create.py create mode 100644 samples/snippets/snapshots/delete.py create mode 100644 samples/snippets/snapshots/list.py rename samples/snippets/tests/{test_sample_create_vm.py => test_create_vm.py} (98%) rename samples/snippets/tests/{test_sample_custom_types.py => test_custom_types.py} (100%) rename samples/snippets/tests/{test_sample_default_values.py => test_default_values.py} (100%) create mode 100644 samples/snippets/tests/test_disks.py rename samples/snippets/tests/{test_sample_firewall.py => test_firewall.py} (100%) rename samples/snippets/tests/{test_sample_images.py => test_images.py} (100%) rename samples/snippets/tests/{test_sample_instance_from_template.py => test_instance_from_template.py} (100%) rename samples/snippets/tests/{test_sample_start_stop.py => test_instance_start_stop.py} (100%) rename samples/snippets/tests/{test_sample_pagination.py => test_pagination.py} (100%) create mode 100644 samples/snippets/tests/test_snapshots.py rename samples/snippets/tests/{test_sample_templates.py => test_templates.py} (98%) diff --git a/samples/ingredients/disks/autodelete_change.py b/samples/ingredients/disks/autodelete_change.py new file mode 100644 index 000000000..589fe75bf --- /dev/null +++ b/samples/ingredients/disks/autodelete_change.py @@ -0,0 +1,61 @@ +# Copyright 2022 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 is an ingredient file. It is not meant to be run directly. Check the samples/snippets +# folder for complete code samples that are ready to be used. +# Disabling flake8 for the ingredients file, as it would fail F821 - undefined name check. +# flake8: noqa +import sys +from typing import NoReturn + + +from google.cloud import compute_v1 + + +# +def set_disk_autodelete(project_id: str, zone: str, instance_name: str, disk_name: str, autodelete: bool) -> NoReturn: + """ + Set the autodelete flag of a disk to given value. + + Args: + project_id: project ID or project number of the Cloud project you want to use. + zone: name of the zone in which is the disk you want to modify. + instance_name: name of the instance the disk is attached to. + disk_name: the name of the disk which flag you want to modify. + autodelete: the new value of the autodelete flag. + """ + instance_client = compute_v1.InstancesClient() + instance = instance_client.get(project=project_id, zone=zone, instance=instance_name) + + for disk in instance.disks: + if disk.device_name == disk_name: + break + else: + raise RuntimeError(f"Instance {instance_name} doesn't have a disk named {disk_name} attached.") + + disk.auto_delete = autodelete + + operation = instance_client.update_unary(project=project_id, zone=zone, instance=instance_name, instance_resource=instance) + operation_client = compute_v1.ZoneOperationsClient() + operation = operation_client.wait(project=project_id, zone=zone, operation=operation.name) + + if operation.error: + print("Error during instance update:", operation.error, file=sys.stderr) + raise RuntimeError(operation.error) + if operation.warnings: + print("Warnings during instance update:\n", file=sys.stderr) + for warning in operation.warnings: + print(f" - {warning.code}: {warning.message}", file=sys.stderr) + return +# diff --git a/samples/ingredients/disks/create_from_image.py b/samples/ingredients/disks/create_from_image.py new file mode 100644 index 000000000..c8e1bdce1 --- /dev/null +++ b/samples/ingredients/disks/create_from_image.py @@ -0,0 +1,67 @@ +# Copyright 2022 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 is an ingredient file. It is not meant to be run directly. Check the samples/snippets +# folder for complete code samples that are ready to be used. +# Disabling flake8 for the ingredients file, as it would fail F821 - undefined name check. +# flake8: noqa +import sys + +from google.cloud import compute_v1 + + +# +def create_disk_from_image( + project_id: str, zone: str, disk_name: str, disk_type: str, disk_size_gb: int, source_image: str +) -> compute_v1.Disk: + """ + Creates a new disk in a project in given zone using an image as base. + + Args: + project_id: project ID or project number of the Cloud project you want to use. + zone: name of the zone in which you want to create the disk. + disk_name: name of the disk you want to create. + disk_type: the type of disk you want to create. This value uses the following format: + "zones/{zone}/diskTypes/(pd-standard|pd-ssd|pd-balanced|pd-extreme)". + For example: "zones/us-west3-b/diskTypes/pd-ssd" + disk_size_gb: size of the new disk in gigabytes + source_image: source image to use when creating this disk. You must have read access to this disk. This + can be one of the publicly available images or an image from one of your projects. + This value uses the following format: "projects/{project_name}/global/images/{image_name}" + + Returns: + An unattached Disk instance. + """ + disk = compute_v1.Disk() + disk.size_gb = disk_size_gb + disk.name = disk_name + disk.zone = zone + disk.type_ = disk_type + disk.source_image = source_image + + disk_client = compute_v1.DisksClient() + operation = disk_client.insert_unary(project=project_id, zone=zone, disk_resource=disk) + operation_client = compute_v1.ZoneOperationsClient() + operation = operation_client.wait(project=project_id, zone=zone, operation=operation.name) + + if operation.error: + print("Error during disk creation:", operation.error, file=sys.stderr) + raise RuntimeError(operation.error) + if operation.warnings: + print("Warnings during disk creation:\n", file=sys.stderr) + for warning in operation.warnings: + print(f" - {warning.code}: {warning.message}", file=sys.stderr) + + return disk_client.get(project=project_id, zone=zone, disk=disk.name) +# diff --git a/samples/ingredients/disks/create_from_snapshot.py b/samples/ingredients/disks/create_from_snapshot.py new file mode 100644 index 000000000..059ab0180 --- /dev/null +++ b/samples/ingredients/disks/create_from_snapshot.py @@ -0,0 +1,65 @@ +# Copyright 2022 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 is an ingredient file. It is not meant to be run directly. Check the samples/snippets +# folder for complete code samples that are ready to be used. +# Disabling flake8 for the ingredients file, as it would fail F821 - undefined name check. +# flake8: noqa +import sys + + +from google.cloud import compute_v1 + + +# +def create_disk_from_snapshot(project_id: str, zone: str, disk_name: str, disk_type: str, disk_size_gb: int, snapshot_link: str) -> compute_v1.Disk: + """ + Creates a new disk in a project in given zone. + + Args: + project_id: project ID or project number of the Cloud project you want to use. + zone: name of the zone in which you want to create the disk. + disk_name: name of the disk you want to create. + disk_type: the type of disk you want to create. This value uses the following format: + "zones/{zone}/diskTypes/(pd-standard|pd-ssd|pd-balanced|pd-extreme)". + For example: "zones/us-west3-b/diskTypes/pd-ssd" + disk_size_gb: size of the new disk in gigabytes + snapshot_link: a link to the snapshot you want to use as a source for the new disk. + This value uses the following format: "projects/{project_name}/global/snapshots/{snapshot_name}" + + Returns: + An unattached Disk instance. + """ + disk_client = compute_v1.DisksClient() + disk = compute_v1.Disk() + disk.zone = zone + disk.size_gb = disk_size_gb + disk.source_snapshot = snapshot_link + disk.type_ = disk_type + disk.name = disk_name + operation = disk_client.insert_unary(project=project_id, zone=zone, disk_resource=disk) + operation_client = compute_v1.ZoneOperationsClient() + operation = operation_client.wait(project=project_id, zone=zone, operation=operation.name) + + if operation.error: + print("Error during disk creation:", operation.error, file=sys.stderr) + raise RuntimeError(operation.error) + + if operation.warnings: + print("Warnings during disk creation:\n", file=sys.stderr) + for warning in operation.warnings: + print(f" - {warning.code}: {warning.message}", file=sys.stderr) + + return disk_client.get(project=project_id, zone=zone, disk=disk_name) +# diff --git a/samples/ingredients/disks/delete.py b/samples/ingredients/disks/delete.py new file mode 100644 index 000000000..d66294ece --- /dev/null +++ b/samples/ingredients/disks/delete.py @@ -0,0 +1,48 @@ +# Copyright 2022 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 is an ingredient file. It is not meant to be run directly. Check the samples/snippets +# folder for complete code samples that are ready to be used. +# Disabling flake8 for the ingredients file, as it would fail F821 - undefined name check. +# flake8: noqa +import sys +from typing import NoReturn + +from google.cloud import compute_v1 + + +# +def delete_disk(project_id: str, zone: str, disk_name: str) -> NoReturn: + """ + Deletes a disk from a project. + + Args: + project_id: project ID or project number of the Cloud project you want to use. + zone: name of the zone in which is the disk you want to delete. + disk_name: name of the disk you want to delete. + """ + disk_client = compute_v1.DisksClient() + operation = disk_client.delete_unary(project=project_id, zone=zone, disk=disk_name) + operation_client = compute_v1.ZoneOperationsClient() + operation = operation_client.wait(project=project_id, zone=zone, operation=operation.name) + + if operation.error: + print("Error during disk delete operation:", operation.error, file=sys.stderr) + raise RuntimeError(operation.error) + if operation.warnings: + print("Warnings during disk delete operation:\n", file=sys.stderr) + for warning in operation.warnings: + print(f" - {warning.code}: {warning.message}", file=sys.stderr) + return +# diff --git a/samples/ingredients/disks/list.py b/samples/ingredients/disks/list.py new file mode 100644 index 000000000..ec3ecab83 --- /dev/null +++ b/samples/ingredients/disks/list.py @@ -0,0 +1,43 @@ +# Copyright 2022 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 is an ingredient file. It is not meant to be run directly. Check the samples/snippets +# folder for complete code samples that are ready to be used. +# Disabling flake8 for the ingredients file, as it would fail F821 - undefined name check. +# flake8: noqa +import sys +from typing import NoReturn, Iterable + +from google.cloud import compute_v1 + + +# +def list_disks(project_id: str, zone: str, filter_: str = "") -> Iterable[compute_v1.Disk]: + """ + Deletes a disk from a project. + + Args: + project_id: project ID or project number of the Cloud project you want to use. + zone: name of the zone in which is the disk you want to delete. + filter_: filter to be applied when listing disks. Learn more about filters here: + https://cloud.google.com/python/docs/reference/compute/latest/google.cloud.compute_v1.types.ListDisksRequest + """ + disk_client = compute_v1.DisksClient() + request = compute_v1.ListDisksRequest() + request.project = project_id + request.zone = zone + request.filter = filter_ + return disk_client.list(request) +# + diff --git a/samples/ingredients/instances/create_instance.py b/samples/ingredients/instances/create_instance.py index 85c2e4818..99fad23e4 100644 --- a/samples/ingredients/instances/create_instance.py +++ b/samples/ingredients/instances/create_instance.py @@ -33,6 +33,10 @@ def create_instance( machine_type: str = "n1-standard-1", network_link: str = "global/networks/default", subnetwork_link: str = None, + internal_ip: str = None, + external_access: bool = False, + external_ipv4: str = None, + accelerators: List[compute_v1.AcceleratorConfig] = None, preemptible: bool = False, custom_hostname: str = None, delete_protection: bool = False, @@ -55,6 +59,16 @@ def create_instance( subnetwork_link: name of the subnetwork you want the new instance to use. This value uses the following format: "regions/{region}/subnetworks/{subnetwork_name}" + internal_ip: internal IP address you want to assign to the new instance. + By default, a free address from the pool of available internal IP addresses of + used subnet will be used. + external_access: boolean flag indicating if the instance should have an external IPv4 + address assigned. + external_ipv4: external IPv4 address to be assigned to this instance. If you specify + an external IP address, it must live in the same region as the zone of the instance. + This setting requires `external_access` to be set to True to work. + accelerators: a list of AcceleratorConfig objects describing the accelerators that will + be attached to the new instance. preemptible: boolean value indicating if the new instance should be preemptible or not. custom_hostname: Custom hostname of the new VM instance. @@ -73,6 +87,18 @@ def create_instance( if subnetwork_link: network_interface.subnetwork = subnetwork_link + if internal_ip: + network_interface.network_i_p = internal_ip + + if external_access: + access = compute_v1.AccessConfig() + access.type_ = compute_v1.AccessConfig.Type.ONE_TO_ONE_NAT.name + access.name = "External NAT" + access.network_tier = access.NetworkTier.PREMIUM.name + if external_ipv4: + access.nat_i_p = external_ipv4 + network_interface.access_configs = [access] + # Collect information into the Instance object. instance = compute_v1.Instance() instance.name = instance_name @@ -82,6 +108,9 @@ def create_instance( else: instance.machine_type = f"zones/{zone}/machineTypes/{machine_type}" + if accelerators: + instance.guest_accelerators = accelerators + instance.network_interfaces = [network_interface] if preemptible: diff --git a/samples/ingredients/snapshots/create.py b/samples/ingredients/snapshots/create.py new file mode 100644 index 000000000..3e3b2a97c --- /dev/null +++ b/samples/ingredients/snapshots/create.py @@ -0,0 +1,60 @@ +# Copyright 2022 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 is an ingredient file. It is not meant to be run directly. Check the samples/snippets +# folder for complete code samples that are ready to be used. +# Disabling flake8 for the ingredients file, as it would fail F821 - undefined name check. +# flake8: noqa +import sys + + +from google.cloud import compute_v1 + + +# +def create_snapshot(project_id: str, zone: str, disk_name: str, snapshot_name: str) -> compute_v1.Snapshot: + """ + Create a snapshot of a disk. + + Args: + project_id: project ID or project number of the Cloud project you want to use. + zone: name of the zone in which is the disk you want to snapshot. + disk_name: name of the disk you want to snapshot. + snapshot_name: name of the snapshot to be created. + + Returns: + The new snapshot instance. + """ + disk_client = compute_v1.DisksClient() + disk = disk_client.get(project=project_id, zone=zone, disk=disk_name) + snapshot = compute_v1.Snapshot() + snapshot.source_disk = disk.self_link + snapshot.name = snapshot_name + + snapshot_client = compute_v1.SnapshotsClient() + operation = snapshot_client.insert_unary(project=project_id, snapshot_resource=snapshot) + op_client = compute_v1.GlobalOperationsClient() + operation = op_client.wait(project=project_id, operation=operation.name) + + if operation.error: + print("Error during snapshot creation:", operation.error, file=sys.stderr) + raise RuntimeError(operation.error) + if operation.warnings: + print("Warnings during snapshot creation:\n", file=sys.stderr) + for warning in operation.warnings: + print(f" - {warning.code}: {warning.message}", file=sys.stderr) + + return snapshot_client.get(project=project_id, snapshot=snapshot_name) + +# diff --git a/samples/ingredients/snapshots/delete.py b/samples/ingredients/snapshots/delete.py new file mode 100644 index 000000000..dd3f1f29c --- /dev/null +++ b/samples/ingredients/snapshots/delete.py @@ -0,0 +1,49 @@ +# Copyright 2022 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 is an ingredient file. It is not meant to be run directly. Check the samples/snippets +# folder for complete code samples that are ready to be used. +# Disabling flake8 for the ingredients file, as it would fail F821 - undefined name check. +# flake8: noqa +import sys +from typing import NoReturn + +from google.cloud import compute_v1 + + +# +def delete_snapshot(project_id: str, snapshot_name: str) -> NoReturn: + """ + Delete a snapshot of a disk. + + Args: + project_id: project ID or project number of the Cloud project you want to use. + snapshot_name: name of the snapshot to delete. + """ + + snapshot_client = compute_v1.SnapshotsClient() + operation = snapshot_client.delete_unary(project=project_id, snapshot=snapshot_name) + op_client = compute_v1.GlobalOperationsClient() + operation = op_client.wait(project=project_id, operation=operation.name) + + if operation.error: + print("Error during snapshot deletion:", operation.error, file=sys.stderr) + raise RuntimeError(operation.error) + if operation.warnings: + print("Warnings during snapshot deletion:\n", file=sys.stderr) + for warning in operation.warnings: + print(f" - {warning.code}: {warning.message}", file=sys.stderr) + + return +# diff --git a/samples/ingredients/snapshots/list.py b/samples/ingredients/snapshots/list.py new file mode 100644 index 000000000..87539f173 --- /dev/null +++ b/samples/ingredients/snapshots/list.py @@ -0,0 +1,45 @@ +# Copyright 2022 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 is an ingredient file. It is not meant to be run directly. Check the samples/snippets +# folder for complete code samples that are ready to be used. +# Disabling flake8 for the ingredients file, as it would fail F821 - undefined name check. +# flake8: noqa +from typing import Iterable + +from google.cloud import compute_v1 + + +# +def list_snapshots(project_id: str, filter_: str = "") -> Iterable[compute_v1.Snapshot]: + """ + List snapshots from a project. + + Args: + project_id: project ID or project number of the Cloud project you want to use. + filter_: filter to be applied when listing snapshots. Learn more about filters here: + https://cloud.google.com/python/docs/reference/compute/latest/google.cloud.compute_v1.types.ListSnapshotsRequest + + Returns: + An iterable containing all Snapshots that match the provided filter. + """ + + snapshot_client = compute_v1.SnapshotsClient() + request = compute_v1.ListSnapshotsRequest() + request.project = project_id + request.filter = filter_ + + return snapshot_client.list(request) +# + diff --git a/samples/noxfile_config.py b/samples/noxfile_config.py index 33170d346..13928a8af 100644 --- a/samples/noxfile_config.py +++ b/samples/noxfile_config.py @@ -13,6 +13,6 @@ # limitations under the License. TEST_CONFIG_OVERRIDE = { - # Tests in test_sample_default_values.py require separate projects to not interfere with each other. + # Tests in test_default_values.py require separate projects to not interfere with each other. "gcloud_project_env": "BUILD_SPECIFIC_GCLOUD_PROJECT", } diff --git a/samples/recipes/disks/__init__.py b/samples/recipes/disks/__init__.py new file mode 100644 index 000000000..4bbe0ffdb --- /dev/null +++ b/samples/recipes/disks/__init__.py @@ -0,0 +1,13 @@ +# Copyright 2022 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. diff --git a/samples/recipes/disks/autodelete_change.py b/samples/recipes/disks/autodelete_change.py new file mode 100644 index 000000000..33120f897 --- /dev/null +++ b/samples/recipes/disks/autodelete_change.py @@ -0,0 +1,21 @@ +# Copyright 2022 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. +# flake8: noqa + +# +# + +# + +# diff --git a/samples/recipes/disks/create_from_image.py b/samples/recipes/disks/create_from_image.py new file mode 100644 index 000000000..407b4aa0d --- /dev/null +++ b/samples/recipes/disks/create_from_image.py @@ -0,0 +1,21 @@ +# Copyright 2022 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. +# flake8: noqa + +# +# + +# + +# diff --git a/samples/recipes/disks/create_from_snapshot.py b/samples/recipes/disks/create_from_snapshot.py new file mode 100644 index 000000000..c33060ca2 --- /dev/null +++ b/samples/recipes/disks/create_from_snapshot.py @@ -0,0 +1,21 @@ +# Copyright 2022 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. +# flake8: noqa + +# +# + +# + +# diff --git a/samples/recipes/disks/delete.py b/samples/recipes/disks/delete.py new file mode 100644 index 000000000..e319a075c --- /dev/null +++ b/samples/recipes/disks/delete.py @@ -0,0 +1,21 @@ +# Copyright 2022 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. +# flake8: noqa + +# +# + +# + +# diff --git a/samples/recipes/disks/list.py b/samples/recipes/disks/list.py new file mode 100644 index 000000000..3b0e685fa --- /dev/null +++ b/samples/recipes/disks/list.py @@ -0,0 +1,22 @@ +# Copyright 2022 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. +# flake8: noqa + +# +# + +# + +# + diff --git a/samples/recipes/snapshots/__init__.py b/samples/recipes/snapshots/__init__.py new file mode 100644 index 000000000..4bbe0ffdb --- /dev/null +++ b/samples/recipes/snapshots/__init__.py @@ -0,0 +1,13 @@ +# Copyright 2022 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. diff --git a/samples/recipes/snapshots/create.py b/samples/recipes/snapshots/create.py new file mode 100644 index 000000000..b77eb7a98 --- /dev/null +++ b/samples/recipes/snapshots/create.py @@ -0,0 +1,22 @@ +# Copyright 2022 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. +# flake8: noqa + +# +# + +# + +# + diff --git a/samples/recipes/snapshots/delete.py b/samples/recipes/snapshots/delete.py new file mode 100644 index 000000000..ff8e89c8e --- /dev/null +++ b/samples/recipes/snapshots/delete.py @@ -0,0 +1,21 @@ +# Copyright 2022 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. +# flake8: noqa + +# +# + +# + +# diff --git a/samples/recipes/snapshots/list.py b/samples/recipes/snapshots/list.py new file mode 100644 index 000000000..34b5701da --- /dev/null +++ b/samples/recipes/snapshots/list.py @@ -0,0 +1,21 @@ +# Copyright 2022 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. +# flake8: noqa + +# +# + +# + +# diff --git a/samples/sgs.py b/samples/sgs.py index f8278f7b5..d8b2dbeb8 100644 --- a/samples/sgs.py +++ b/samples/sgs.py @@ -151,6 +151,8 @@ def load_ingredients(path: Path) -> dict: if ipath.is_dir(): ingredients.update(load_ingredients(ipath)) elif ipath.is_file(): + if "__pycache__" in str(ipath.absolute()): + continue ingredient = load_ingredient(ipath) ingredients[ingredient.name] = ingredient return ingredients diff --git a/samples/snippets/disks/__init__.py b/samples/snippets/disks/__init__.py new file mode 100644 index 000000000..4bbe0ffdb --- /dev/null +++ b/samples/snippets/disks/__init__.py @@ -0,0 +1,13 @@ +# Copyright 2022 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. diff --git a/samples/snippets/disks/autodelete_change.py b/samples/snippets/disks/autodelete_change.py new file mode 100644 index 000000000..943564cd1 --- /dev/null +++ b/samples/snippets/disks/autodelete_change.py @@ -0,0 +1,78 @@ +# Copyright 2022 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. +# flake8: noqa + + +# This file is automatically generated. Please do not modify it directly. +# Find the relevant recipe file in the samples/recipes or samples/ingredients +# directory and apply your changes there. + + +# [START compute_disk_autodelete_change] +import sys +from typing import NoReturn + +from google.cloud import compute_v1 + + +def set_disk_autodelete( + project_id: str, zone: str, instance_name: str, disk_name: str, autodelete: bool +) -> NoReturn: + """ + Set the autodelete flag of a disk to given value. + + Args: + project_id: project ID or project number of the Cloud project you want to use. + zone: name of the zone in which is the disk you want to modify. + instance_name: name of the instance the disk is attached to. + disk_name: the name of the disk which flag you want to modify. + autodelete: the new value of the autodelete flag. + """ + instance_client = compute_v1.InstancesClient() + instance = instance_client.get( + project=project_id, zone=zone, instance=instance_name + ) + + for disk in instance.disks: + if disk.device_name == disk_name: + break + else: + raise RuntimeError( + f"Instance {instance_name} doesn't have a disk named {disk_name} attached." + ) + + disk.auto_delete = autodelete + + operation = instance_client.update_unary( + project=project_id, + zone=zone, + instance=instance_name, + instance_resource=instance, + ) + operation_client = compute_v1.ZoneOperationsClient() + operation = operation_client.wait( + project=project_id, zone=zone, operation=operation.name + ) + + if operation.error: + print("Error during instance update:", operation.error, file=sys.stderr) + raise RuntimeError(operation.error) + if operation.warnings: + print("Warnings during instance update:\n", file=sys.stderr) + for warning in operation.warnings: + print(f" - {warning.code}: {warning.message}", file=sys.stderr) + return + + +# [END compute_disk_autodelete_change] diff --git a/samples/snippets/disks/create_from_image.py b/samples/snippets/disks/create_from_image.py new file mode 100644 index 000000000..74e998ada --- /dev/null +++ b/samples/snippets/disks/create_from_image.py @@ -0,0 +1,81 @@ +# Copyright 2022 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. +# flake8: noqa + + +# This file is automatically generated. Please do not modify it directly. +# Find the relevant recipe file in the samples/recipes or samples/ingredients +# directory and apply your changes there. + + +# [START compute_disk_create_from_image] +import sys + +from google.cloud import compute_v1 + + +def create_disk_from_image( + project_id: str, + zone: str, + disk_name: str, + disk_type: str, + disk_size_gb: int, + source_image: str, +) -> compute_v1.Disk: + """ + Creates a new disk in a project in given zone using an image as base. + + Args: + project_id: project ID or project number of the Cloud project you want to use. + zone: name of the zone in which you want to create the disk. + disk_name: name of the disk you want to create. + disk_type: the type of disk you want to create. This value uses the following format: + "zones/{zone}/diskTypes/(pd-standard|pd-ssd|pd-balanced|pd-extreme)". + For example: "zones/us-west3-b/diskTypes/pd-ssd" + disk_size_gb: size of the new disk in gigabytes + source_image: source image to use when creating this disk. You must have read access to this disk. This + can be one of the publicly available images or an image from one of your projects. + This value uses the following format: "projects/{project_name}/global/images/{image_name}" + + Returns: + An unattached Disk instance. + """ + disk = compute_v1.Disk() + disk.size_gb = disk_size_gb + disk.name = disk_name + disk.zone = zone + disk.type_ = disk_type + disk.source_image = source_image + + disk_client = compute_v1.DisksClient() + operation = disk_client.insert_unary( + project=project_id, zone=zone, disk_resource=disk + ) + operation_client = compute_v1.ZoneOperationsClient() + operation = operation_client.wait( + project=project_id, zone=zone, operation=operation.name + ) + + if operation.error: + print("Error during disk creation:", operation.error, file=sys.stderr) + raise RuntimeError(operation.error) + if operation.warnings: + print("Warnings during disk creation:\n", file=sys.stderr) + for warning in operation.warnings: + print(f" - {warning.code}: {warning.message}", file=sys.stderr) + + return disk_client.get(project=project_id, zone=zone, disk=disk.name) + + +# [END compute_disk_create_from_image] diff --git a/samples/snippets/disks/create_from_snapshot.py b/samples/snippets/disks/create_from_snapshot.py new file mode 100644 index 000000000..2421adb0f --- /dev/null +++ b/samples/snippets/disks/create_from_snapshot.py @@ -0,0 +1,80 @@ +# Copyright 2022 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. +# flake8: noqa + + +# This file is automatically generated. Please do not modify it directly. +# Find the relevant recipe file in the samples/recipes or samples/ingredients +# directory and apply your changes there. + + +# [START compute_disk_create_from_snapshot] +import sys + +from google.cloud import compute_v1 + + +def create_disk_from_snapshot( + project_id: str, + zone: str, + disk_name: str, + disk_type: str, + disk_size_gb: int, + snapshot_link: str, +) -> compute_v1.Disk: + """ + Creates a new disk in a project in given zone. + + Args: + project_id: project ID or project number of the Cloud project you want to use. + zone: name of the zone in which you want to create the disk. + disk_name: name of the disk you want to create. + disk_type: the type of disk you want to create. This value uses the following format: + "zones/{zone}/diskTypes/(pd-standard|pd-ssd|pd-balanced|pd-extreme)". + For example: "zones/us-west3-b/diskTypes/pd-ssd" + disk_size_gb: size of the new disk in gigabytes + snapshot_link: a link to the snapshot you want to use as a source for the new disk. + This value uses the following format: "projects/{project_name}/global/snapshots/{snapshot_name}" + + Returns: + An unattached Disk instance. + """ + disk_client = compute_v1.DisksClient() + disk = compute_v1.Disk() + disk.zone = zone + disk.size_gb = disk_size_gb + disk.source_snapshot = snapshot_link + disk.type_ = disk_type + disk.name = disk_name + operation = disk_client.insert_unary( + project=project_id, zone=zone, disk_resource=disk + ) + operation_client = compute_v1.ZoneOperationsClient() + operation = operation_client.wait( + project=project_id, zone=zone, operation=operation.name + ) + + if operation.error: + print("Error during disk creation:", operation.error, file=sys.stderr) + raise RuntimeError(operation.error) + + if operation.warnings: + print("Warnings during disk creation:\n", file=sys.stderr) + for warning in operation.warnings: + print(f" - {warning.code}: {warning.message}", file=sys.stderr) + + return disk_client.get(project=project_id, zone=zone, disk=disk_name) + + +# [END compute_disk_create_from_snapshot] diff --git a/samples/snippets/disks/delete.py b/samples/snippets/disks/delete.py new file mode 100644 index 000000000..0b5ea3cb3 --- /dev/null +++ b/samples/snippets/disks/delete.py @@ -0,0 +1,55 @@ +# Copyright 2022 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. +# flake8: noqa + + +# This file is automatically generated. Please do not modify it directly. +# Find the relevant recipe file in the samples/recipes or samples/ingredients +# directory and apply your changes there. + + +# [START compute_disk_delete] +import sys +from typing import NoReturn + +from google.cloud import compute_v1 + + +def delete_disk(project_id: str, zone: str, disk_name: str) -> NoReturn: + """ + Deletes a disk from a project. + + Args: + project_id: project ID or project number of the Cloud project you want to use. + zone: name of the zone in which is the disk you want to delete. + disk_name: name of the disk you want to delete. + """ + disk_client = compute_v1.DisksClient() + operation = disk_client.delete_unary(project=project_id, zone=zone, disk=disk_name) + operation_client = compute_v1.ZoneOperationsClient() + operation = operation_client.wait( + project=project_id, zone=zone, operation=operation.name + ) + + if operation.error: + print("Error during disk delete operation:", operation.error, file=sys.stderr) + raise RuntimeError(operation.error) + if operation.warnings: + print("Warnings during disk delete operation:\n", file=sys.stderr) + for warning in operation.warnings: + print(f" - {warning.code}: {warning.message}", file=sys.stderr) + return + + +# [END compute_disk_delete] diff --git a/samples/snippets/disks/list.py b/samples/snippets/disks/list.py new file mode 100644 index 000000000..2b522e2b9 --- /dev/null +++ b/samples/snippets/disks/list.py @@ -0,0 +1,49 @@ +# Copyright 2022 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. +# flake8: noqa + + +# This file is automatically generated. Please do not modify it directly. +# Find the relevant recipe file in the samples/recipes or samples/ingredients +# directory and apply your changes there. + + +# [START compute_disk_list] +import sys +from typing import Iterable, NoReturn + +from google.cloud import compute_v1 + + +def list_disks( + project_id: str, zone: str, filter_: str = "" +) -> Iterable[compute_v1.Disk]: + """ + Deletes a disk from a project. + + Args: + project_id: project ID or project number of the Cloud project you want to use. + zone: name of the zone in which is the disk you want to delete. + filter_: filter to be applied when listing disks. Learn more about filters here: + https://cloud.google.com/python/docs/reference/compute/latest/google.cloud.compute_v1.types.ListDisksRequest + """ + disk_client = compute_v1.DisksClient() + request = compute_v1.ListDisksRequest() + request.project = project_id + request.zone = zone + request.filter = filter_ + return disk_client.list(request) + + +# [END compute_disk_list] diff --git a/samples/snippets/firewall/create.py b/samples/snippets/firewall/create.py index 5bcf1c5fc..1eb230dea 100644 --- a/samples/snippets/firewall/create.py +++ b/samples/snippets/firewall/create.py @@ -36,6 +36,9 @@ def create_firewall_rule( * https://www.googleapis.com/compute/v1/projects/{project_id}/global/networks/{network} * projects/{project_id}/global/networks/{network} * global/networks/{network} + + Returns: + A Firewall object. """ firewall_rule = compute_v1.Firewall() firewall_rule.name = firewall_rule_name @@ -57,7 +60,7 @@ def create_firewall_rule( # will be equal to 0, however it is not treated as "set" by the library and thus # the default will be applied to the new rule. If you want to create a rule that # has priority == 0, you need to explicitly set it so: - + # TODO: Uncomment to set the priority to 0 # firewall_rule.priority = 0 firewall_client = compute_v1.FirewallsClient() diff --git a/samples/snippets/firewall/delete.py b/samples/snippets/firewall/delete.py index 8dbea8709..d606912a5 100644 --- a/samples/snippets/firewall/delete.py +++ b/samples/snippets/firewall/delete.py @@ -23,9 +23,9 @@ from google.cloud import compute_v1 -def delete_firewall_rule(project_id: str, firewall_rule_name: str): +def delete_firewall_rule(project_id: str, firewall_rule_name: str) -> None: """ - Deleted a firewall rule from the project. + Deletes a firewall rule from the project. Args: project_id: project ID or project number of the Cloud project you want to use. diff --git a/samples/snippets/firewall/list.py b/samples/snippets/firewall/list.py index d4553ac12..7a0636ae8 100644 --- a/samples/snippets/firewall/list.py +++ b/samples/snippets/firewall/list.py @@ -34,7 +34,7 @@ def list_firewall_rules(project_id: str) -> Iterable[compute_v1.Firewall]: project_id: project ID or project number of the Cloud project you want to use. Returns: - A flat list of all firewall rules defined for given project. + A flat list of all firewall rules defined for given project. """ firewall_client = compute_v1.FirewallsClient() firewalls_list = firewall_client.list(project=project_id) diff --git a/samples/snippets/firewall/main.py b/samples/snippets/firewall/main.py index d8b47a338..b53e677e0 100644 --- a/samples/snippets/firewall/main.py +++ b/samples/snippets/firewall/main.py @@ -37,6 +37,9 @@ def create_firewall_rule( * https://www.googleapis.com/compute/v1/projects/{project_id}/global/networks/{network} * projects/{project_id}/global/networks/{network} * global/networks/{network} + + Returns: + A Firewall object. """ firewall_rule = compute_v1.Firewall() firewall_rule.name = firewall_rule_name @@ -58,7 +61,7 @@ def create_firewall_rule( # will be equal to 0, however it is not treated as "set" by the library and thus # the default will be applied to the new rule. If you want to create a rule that # has priority == 0, you need to explicitly set it so: - + # TODO: Uncomment to set the priority to 0 # firewall_rule.priority = 0 firewall_client = compute_v1.FirewallsClient() @@ -72,9 +75,9 @@ def create_firewall_rule( return firewall_client.get(project=project_id, firewall=firewall_rule_name) -def delete_firewall_rule(project_id: str, firewall_rule_name: str): +def delete_firewall_rule(project_id: str, firewall_rule_name: str) -> None: """ - Deleted a firewall rule from the project. + Deletes a firewall rule from the project. Args: project_id: project ID or project number of the Cloud project you want to use. @@ -91,6 +94,16 @@ def delete_firewall_rule(project_id: str, firewall_rule_name: str): def get_firewall_rule(project_id: str, firewall_rule_name: str) -> compute_v1.Firewall: + """ + Retrieve a Firewall from a project. + + Args: + project_id: project ID or project number of the Cloud project you want to use. + firewall_rule_name: name of the firewall rule you want to retrieve. + + Returns: + A Firewall object. + """ firewall_client = compute_v1.FirewallsClient() return firewall_client.get(project=project_id, firewall=firewall_rule_name) @@ -104,7 +117,7 @@ def list_firewall_rules(project_id: str) -> Iterable[compute_v1.Firewall]: project_id: project ID or project number of the Cloud project you want to use. Returns: - A flat list of all firewall rules defined for given project. + A flat list of all firewall rules defined for given project. """ firewall_client = compute_v1.FirewallsClient() firewalls_list = firewall_client.list(project=project_id) @@ -115,7 +128,9 @@ def list_firewall_rules(project_id: str) -> Iterable[compute_v1.Firewall]: return firewalls_list -def patch_firewall_priority(project_id: str, firewall_rule_name: str, priority: int): +def patch_firewall_priority( + project_id: str, firewall_rule_name: str, priority: int +) -> None: """ Modifies the priority of a given firewall rule. diff --git a/samples/snippets/firewall/patch.py b/samples/snippets/firewall/patch.py index e5f2a96d6..9dbb823da 100644 --- a/samples/snippets/firewall/patch.py +++ b/samples/snippets/firewall/patch.py @@ -23,7 +23,9 @@ from google.cloud import compute_v1 -def patch_firewall_priority(project_id: str, firewall_rule_name: str, priority: int): +def patch_firewall_priority( + project_id: str, firewall_rule_name: str, priority: int +) -> None: """ Modifies the priority of a given firewall rule. diff --git a/samples/snippets/images/get.py b/samples/snippets/images/get.py index 94c8f3af4..dbf8b3a26 100644 --- a/samples/snippets/images/get.py +++ b/samples/snippets/images/get.py @@ -27,6 +27,16 @@ def get_image_from_family(project: str, family: str) -> compute_v1.Image: + """ + Retrieve the newest image that is part of a given family in a project. + + Args: + project: project ID or project number of the Cloud project you want to get image from. + family: name of the image family you want to get image from. + + Returns: + An Image object. + """ image_client = compute_v1.ImagesClient() # List of public operating system (OS) images: https://cloud.google.com/compute/docs/images/os-details newest_image = image_client.get_from_family(project=project, family=family) diff --git a/samples/snippets/images/pagination.py b/samples/snippets/images/pagination.py index 7ac6d0b6e..603480b15 100644 --- a/samples/snippets/images/pagination.py +++ b/samples/snippets/images/pagination.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright 2021 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/snippets/instances/create.py b/samples/snippets/instances/create.py index 73d2d806c..a4df25156 100644 --- a/samples/snippets/instances/create.py +++ b/samples/snippets/instances/create.py @@ -22,12 +22,23 @@ # [START compute_instances_create] import re import sys +import time from typing import List from google.cloud import compute_v1 def get_image_from_family(project: str, family: str) -> compute_v1.Image: + """ + Retrieve the newest image that is part of a given family in a project. + + Args: + project: project ID or project number of the Cloud project you want to get image from. + family: name of the image family you want to get image from. + + Returns: + An Image object. + """ image_client = compute_v1.ImagesClient() # List of public operating system (OS) images: https://cloud.google.com/compute/docs/images/os-details newest_image = image_client.get_from_family(project=project, family=family) @@ -35,7 +46,11 @@ def get_image_from_family(project: str, family: str) -> compute_v1.Image: def disk_from_image( - disk_type: str, disk_size_gb: int, boot: bool, source_image: str + disk_type: str, + disk_size_gb: int, + boot: bool, + source_image: str, + auto_delete: bool = False, ) -> compute_v1.AttachedDisk: """ Create an AttachedDisk object to be used in VM instance creation. Uses an image as the @@ -50,6 +65,7 @@ def disk_from_image( source_image: source image to use when creating this disk. You must have read access to this disk. This can be one of the publicly available images or an image from one of your projects. This value uses the following format: "projects/{project_name}/global/images/{image_name}" + auto_delete: boolean flag indicating whether this disk should be deleted with the VM that uses it Returns: AttachedDisk object configured to be created using the specified image. @@ -62,7 +78,7 @@ def disk_from_image( boot_disk.initialize_params = initialize_params # Remember to set auto_delete to True if you want the disk to be deleted when you delete # your VM instance. - boot_disk.auto_delete = True + boot_disk.auto_delete = auto_delete boot_disk.boot = boot return boot_disk @@ -75,6 +91,10 @@ def create_instance( machine_type: str = "n1-standard-1", network_link: str = "global/networks/default", subnetwork_link: str = None, + internal_ip: str = None, + external_access: bool = False, + external_ipv4: str = None, + accelerators: List[compute_v1.AcceleratorConfig] = None, preemptible: bool = False, custom_hostname: str = None, delete_protection: bool = False, @@ -86,17 +106,27 @@ def create_instance( project_id: project ID or project number of the Cloud project you want to use. zone: name of the zone to create the instance in. For example: "us-west3-b" instance_name: name of the new virtual machine (VM) instance. + disks: a list of compute_v1.AttachedDisk objects describing the disks + you want to attach to your new instance. machine_type: machine type of the VM being created. This value uses the following format: "zones/{zone}/machineTypes/{type_name}". For example: "zones/europe-west3-c/machineTypes/f1-micro" - disks: a list of compute_v1.AttachedDisk objects describing the disks - you want to attach to your new instance. network_link: name of the network you want the new instance to use. For example: "global/networks/default" represents the network named "default", which is created automatically for each project. subnetwork_link: name of the subnetwork you want the new instance to use. This value uses the following format: "regions/{region}/subnetworks/{subnetwork_name}" + internal_ip: internal IP address you want to assign to the new instance. + By default, a free address from the pool of available internal IP addresses of + used subnet will be used. + external_access: boolean flag indicating if the instance should have an external IPv4 + address assigned. + external_ipv4: external IPv4 address to be assigned to this instance. If you specify + an external IP address, it must live in the same region as the zone of the instance. + This setting requires `external_access` to be set to True to work. + accelerators: a list of AcceleratorConfig objects describing the accelerators that will + be attached to the new instance. preemptible: boolean value indicating if the new instance should be preemptible or not. custom_hostname: Custom hostname of the new VM instance. @@ -115,6 +145,18 @@ def create_instance( if subnetwork_link: network_interface.subnetwork = subnetwork_link + if internal_ip: + network_interface.network_i_p = internal_ip + + if external_access: + access = compute_v1.AccessConfig() + access.type_ = compute_v1.AccessConfig.Type.ONE_TO_ONE_NAT.name + access.name = "External NAT" + access.network_tier = access.NetworkTier.PREMIUM.name + if external_ipv4: + access.nat_i_p = external_ipv4 + network_interface.access_configs = [access] + # Collect information into the Instance object. instance = compute_v1.Instance() instance.name = instance_name @@ -124,6 +166,9 @@ def create_instance( else: instance.machine_type = f"zones/{zone}/machineTypes/{machine_type}" + if accelerators: + instance.guest_accelerators = accelerators + instance.network_interfaces = [network_interface] if preemptible: @@ -139,13 +184,6 @@ def create_instance( # Set the delete protection bit instance.deletion_protection = True - # Shielded Instance settings - # Values presented here are the defaults. - # instance.shielded_instance_config = compute_v1.ShieldedInstanceConfig() - # instance.shielded_instance_config.enable_secure_boot = False - # instance.shielded_instance_config.enable_vtpm = True - # instance.shielded_instance_config.enable_integrity_monitoring = True - # Prepare the request to insert an instance. request = compute_v1.InsertInstanceRequest() request.zone = zone @@ -156,12 +194,16 @@ def create_instance( print(f"Creating the {instance_name} instance in {zone}...") operation = instance_client.insert_unary(request=request) + start = time.time() while operation.status != compute_v1.Operation.Status.DONE: operation = operation_client.wait( operation=operation.name, zone=zone, project=project_id ) + if time.time() - start >= 300: # 5 minutes + raise TimeoutError() if operation.error: print("Error during creation:", operation.error, file=sys.stderr) + raise RuntimeError(operation.error) if operation.warnings: print("Warning during creation:", operation.warnings, file=sys.stderr) print(f"Instance {instance_name} created.") diff --git a/samples/snippets/instances/create_start_instance/create_from_custom_image.py b/samples/snippets/instances/create_start_instance/create_from_custom_image.py index 0cea57407..203633f02 100644 --- a/samples/snippets/instances/create_start_instance/create_from_custom_image.py +++ b/samples/snippets/instances/create_start_instance/create_from_custom_image.py @@ -22,12 +22,23 @@ # [START compute_instances_create_from_custom_image] import re import sys +import time from typing import List from google.cloud import compute_v1 def get_image_from_family(project: str, family: str) -> compute_v1.Image: + """ + Retrieve the newest image that is part of a given family in a project. + + Args: + project: project ID or project number of the Cloud project you want to get image from. + family: name of the image family you want to get image from. + + Returns: + An Image object. + """ image_client = compute_v1.ImagesClient() # List of public operating system (OS) images: https://cloud.google.com/compute/docs/images/os-details newest_image = image_client.get_from_family(project=project, family=family) @@ -35,7 +46,11 @@ def get_image_from_family(project: str, family: str) -> compute_v1.Image: def disk_from_image( - disk_type: str, disk_size_gb: int, boot: bool, source_image: str + disk_type: str, + disk_size_gb: int, + boot: bool, + source_image: str, + auto_delete: bool = False, ) -> compute_v1.AttachedDisk: """ Create an AttachedDisk object to be used in VM instance creation. Uses an image as the @@ -50,6 +65,7 @@ def disk_from_image( source_image: source image to use when creating this disk. You must have read access to this disk. This can be one of the publicly available images or an image from one of your projects. This value uses the following format: "projects/{project_name}/global/images/{image_name}" + auto_delete: boolean flag indicating whether this disk should be deleted with the VM that uses it Returns: AttachedDisk object configured to be created using the specified image. @@ -62,7 +78,7 @@ def disk_from_image( boot_disk.initialize_params = initialize_params # Remember to set auto_delete to True if you want the disk to be deleted when you delete # your VM instance. - boot_disk.auto_delete = True + boot_disk.auto_delete = auto_delete boot_disk.boot = boot return boot_disk @@ -75,6 +91,10 @@ def create_instance( machine_type: str = "n1-standard-1", network_link: str = "global/networks/default", subnetwork_link: str = None, + internal_ip: str = None, + external_access: bool = False, + external_ipv4: str = None, + accelerators: List[compute_v1.AcceleratorConfig] = None, preemptible: bool = False, custom_hostname: str = None, delete_protection: bool = False, @@ -86,17 +106,27 @@ def create_instance( project_id: project ID or project number of the Cloud project you want to use. zone: name of the zone to create the instance in. For example: "us-west3-b" instance_name: name of the new virtual machine (VM) instance. + disks: a list of compute_v1.AttachedDisk objects describing the disks + you want to attach to your new instance. machine_type: machine type of the VM being created. This value uses the following format: "zones/{zone}/machineTypes/{type_name}". For example: "zones/europe-west3-c/machineTypes/f1-micro" - disks: a list of compute_v1.AttachedDisk objects describing the disks - you want to attach to your new instance. network_link: name of the network you want the new instance to use. For example: "global/networks/default" represents the network named "default", which is created automatically for each project. subnetwork_link: name of the subnetwork you want the new instance to use. This value uses the following format: "regions/{region}/subnetworks/{subnetwork_name}" + internal_ip: internal IP address you want to assign to the new instance. + By default, a free address from the pool of available internal IP addresses of + used subnet will be used. + external_access: boolean flag indicating if the instance should have an external IPv4 + address assigned. + external_ipv4: external IPv4 address to be assigned to this instance. If you specify + an external IP address, it must live in the same region as the zone of the instance. + This setting requires `external_access` to be set to True to work. + accelerators: a list of AcceleratorConfig objects describing the accelerators that will + be attached to the new instance. preemptible: boolean value indicating if the new instance should be preemptible or not. custom_hostname: Custom hostname of the new VM instance. @@ -115,6 +145,18 @@ def create_instance( if subnetwork_link: network_interface.subnetwork = subnetwork_link + if internal_ip: + network_interface.network_i_p = internal_ip + + if external_access: + access = compute_v1.AccessConfig() + access.type_ = compute_v1.AccessConfig.Type.ONE_TO_ONE_NAT.name + access.name = "External NAT" + access.network_tier = access.NetworkTier.PREMIUM.name + if external_ipv4: + access.nat_i_p = external_ipv4 + network_interface.access_configs = [access] + # Collect information into the Instance object. instance = compute_v1.Instance() instance.name = instance_name @@ -124,6 +166,9 @@ def create_instance( else: instance.machine_type = f"zones/{zone}/machineTypes/{machine_type}" + if accelerators: + instance.guest_accelerators = accelerators + instance.network_interfaces = [network_interface] if preemptible: @@ -139,13 +184,6 @@ def create_instance( # Set the delete protection bit instance.deletion_protection = True - # Shielded Instance settings - # Values presented here are the defaults. - # instance.shielded_instance_config = compute_v1.ShieldedInstanceConfig() - # instance.shielded_instance_config.enable_secure_boot = False - # instance.shielded_instance_config.enable_vtpm = True - # instance.shielded_instance_config.enable_integrity_monitoring = True - # Prepare the request to insert an instance. request = compute_v1.InsertInstanceRequest() request.zone = zone @@ -156,12 +194,16 @@ def create_instance( print(f"Creating the {instance_name} instance in {zone}...") operation = instance_client.insert_unary(request=request) + start = time.time() while operation.status != compute_v1.Operation.Status.DONE: operation = operation_client.wait( operation=operation.name, zone=zone, project=project_id ) + if time.time() - start >= 300: # 5 minutes + raise TimeoutError() if operation.error: print("Error during creation:", operation.error, file=sys.stderr) + raise RuntimeError(operation.error) if operation.warnings: print("Warning during creation:", operation.warnings, file=sys.stderr) print(f"Instance {instance_name} created.") diff --git a/samples/snippets/instances/create_start_instance/create_from_public_image.py b/samples/snippets/instances/create_start_instance/create_from_public_image.py index 0d309604a..28d762a86 100644 --- a/samples/snippets/instances/create_start_instance/create_from_public_image.py +++ b/samples/snippets/instances/create_start_instance/create_from_public_image.py @@ -22,12 +22,23 @@ # [START compute_instances_create_from_image] import re import sys +import time from typing import List from google.cloud import compute_v1 def get_image_from_family(project: str, family: str) -> compute_v1.Image: + """ + Retrieve the newest image that is part of a given family in a project. + + Args: + project: project ID or project number of the Cloud project you want to get image from. + family: name of the image family you want to get image from. + + Returns: + An Image object. + """ image_client = compute_v1.ImagesClient() # List of public operating system (OS) images: https://cloud.google.com/compute/docs/images/os-details newest_image = image_client.get_from_family(project=project, family=family) @@ -35,7 +46,11 @@ def get_image_from_family(project: str, family: str) -> compute_v1.Image: def disk_from_image( - disk_type: str, disk_size_gb: int, boot: bool, source_image: str + disk_type: str, + disk_size_gb: int, + boot: bool, + source_image: str, + auto_delete: bool = False, ) -> compute_v1.AttachedDisk: """ Create an AttachedDisk object to be used in VM instance creation. Uses an image as the @@ -50,6 +65,7 @@ def disk_from_image( source_image: source image to use when creating this disk. You must have read access to this disk. This can be one of the publicly available images or an image from one of your projects. This value uses the following format: "projects/{project_name}/global/images/{image_name}" + auto_delete: boolean flag indicating whether this disk should be deleted with the VM that uses it Returns: AttachedDisk object configured to be created using the specified image. @@ -62,7 +78,7 @@ def disk_from_image( boot_disk.initialize_params = initialize_params # Remember to set auto_delete to True if you want the disk to be deleted when you delete # your VM instance. - boot_disk.auto_delete = True + boot_disk.auto_delete = auto_delete boot_disk.boot = boot return boot_disk @@ -75,6 +91,10 @@ def create_instance( machine_type: str = "n1-standard-1", network_link: str = "global/networks/default", subnetwork_link: str = None, + internal_ip: str = None, + external_access: bool = False, + external_ipv4: str = None, + accelerators: List[compute_v1.AcceleratorConfig] = None, preemptible: bool = False, custom_hostname: str = None, delete_protection: bool = False, @@ -86,17 +106,27 @@ def create_instance( project_id: project ID or project number of the Cloud project you want to use. zone: name of the zone to create the instance in. For example: "us-west3-b" instance_name: name of the new virtual machine (VM) instance. + disks: a list of compute_v1.AttachedDisk objects describing the disks + you want to attach to your new instance. machine_type: machine type of the VM being created. This value uses the following format: "zones/{zone}/machineTypes/{type_name}". For example: "zones/europe-west3-c/machineTypes/f1-micro" - disks: a list of compute_v1.AttachedDisk objects describing the disks - you want to attach to your new instance. network_link: name of the network you want the new instance to use. For example: "global/networks/default" represents the network named "default", which is created automatically for each project. subnetwork_link: name of the subnetwork you want the new instance to use. This value uses the following format: "regions/{region}/subnetworks/{subnetwork_name}" + internal_ip: internal IP address you want to assign to the new instance. + By default, a free address from the pool of available internal IP addresses of + used subnet will be used. + external_access: boolean flag indicating if the instance should have an external IPv4 + address assigned. + external_ipv4: external IPv4 address to be assigned to this instance. If you specify + an external IP address, it must live in the same region as the zone of the instance. + This setting requires `external_access` to be set to True to work. + accelerators: a list of AcceleratorConfig objects describing the accelerators that will + be attached to the new instance. preemptible: boolean value indicating if the new instance should be preemptible or not. custom_hostname: Custom hostname of the new VM instance. @@ -115,6 +145,18 @@ def create_instance( if subnetwork_link: network_interface.subnetwork = subnetwork_link + if internal_ip: + network_interface.network_i_p = internal_ip + + if external_access: + access = compute_v1.AccessConfig() + access.type_ = compute_v1.AccessConfig.Type.ONE_TO_ONE_NAT.name + access.name = "External NAT" + access.network_tier = access.NetworkTier.PREMIUM.name + if external_ipv4: + access.nat_i_p = external_ipv4 + network_interface.access_configs = [access] + # Collect information into the Instance object. instance = compute_v1.Instance() instance.name = instance_name @@ -124,6 +166,9 @@ def create_instance( else: instance.machine_type = f"zones/{zone}/machineTypes/{machine_type}" + if accelerators: + instance.guest_accelerators = accelerators + instance.network_interfaces = [network_interface] if preemptible: @@ -139,13 +184,6 @@ def create_instance( # Set the delete protection bit instance.deletion_protection = True - # Shielded Instance settings - # Values presented here are the defaults. - # instance.shielded_instance_config = compute_v1.ShieldedInstanceConfig() - # instance.shielded_instance_config.enable_secure_boot = False - # instance.shielded_instance_config.enable_vtpm = True - # instance.shielded_instance_config.enable_integrity_monitoring = True - # Prepare the request to insert an instance. request = compute_v1.InsertInstanceRequest() request.zone = zone @@ -156,12 +194,16 @@ def create_instance( print(f"Creating the {instance_name} instance in {zone}...") operation = instance_client.insert_unary(request=request) + start = time.time() while operation.status != compute_v1.Operation.Status.DONE: operation = operation_client.wait( operation=operation.name, zone=zone, project=project_id ) + if time.time() - start >= 300: # 5 minutes + raise TimeoutError() if operation.error: print("Error during creation:", operation.error, file=sys.stderr) + raise RuntimeError(operation.error) if operation.warnings: print("Warning during creation:", operation.warnings, file=sys.stderr) print(f"Instance {instance_name} created.") diff --git a/samples/snippets/instances/create_start_instance/create_from_snapshot.py b/samples/snippets/instances/create_start_instance/create_from_snapshot.py index bc7b01c26..92880c972 100644 --- a/samples/snippets/instances/create_start_instance/create_from_snapshot.py +++ b/samples/snippets/instances/create_start_instance/create_from_snapshot.py @@ -22,13 +22,18 @@ # [START compute_instances_create_from_snapshot] import re import sys +import time from typing import List from google.cloud import compute_v1 def disk_from_snapshot( - disk_type: str, disk_size_gb: int, boot: bool, disk_snapshot: str + disk_type: str, + disk_size_gb: int, + boot: bool, + source_snapshot: str, + auto_delete: bool = False, ) -> compute_v1.AttachedDisk(): """ Create an AttachedDisk object to be used in VM instance creation. Uses a disk snapshot as the @@ -40,21 +45,22 @@ def disk_from_snapshot( For example: "zones/us-west3-b/diskTypes/pd-ssd" disk_size_gb: size of the new disk in gigabytes boot: boolean flag indicating whether this disk should be used as a boot disk of an instance - disk_snapshot: disk snapshot to use when creating this disk. You must have read access to this disk. + source_snapshot: disk snapshot to use when creating this disk. You must have read access to this disk. This value uses the following format: "projects/{project_name}/global/snapshots/{snapshot_name}" + auto_delete: boolean flag indicating whether this disk should be deleted with the VM that uses it Returns: AttachedDisk object configured to be created using the specified snapshot. """ disk = compute_v1.AttachedDisk() initialize_params = compute_v1.AttachedDiskInitializeParams() - initialize_params.source_snapshot = disk_snapshot + initialize_params.source_snapshot = source_snapshot initialize_params.disk_type = disk_type initialize_params.disk_size_gb = disk_size_gb disk.initialize_params = initialize_params # Remember to set auto_delete to True if you want the disk to be deleted when you delete # your VM instance. - disk.auto_delete = True + disk.auto_delete = auto_delete disk.boot = boot return disk @@ -67,6 +73,10 @@ def create_instance( machine_type: str = "n1-standard-1", network_link: str = "global/networks/default", subnetwork_link: str = None, + internal_ip: str = None, + external_access: bool = False, + external_ipv4: str = None, + accelerators: List[compute_v1.AcceleratorConfig] = None, preemptible: bool = False, custom_hostname: str = None, delete_protection: bool = False, @@ -78,17 +88,27 @@ def create_instance( project_id: project ID or project number of the Cloud project you want to use. zone: name of the zone to create the instance in. For example: "us-west3-b" instance_name: name of the new virtual machine (VM) instance. + disks: a list of compute_v1.AttachedDisk objects describing the disks + you want to attach to your new instance. machine_type: machine type of the VM being created. This value uses the following format: "zones/{zone}/machineTypes/{type_name}". For example: "zones/europe-west3-c/machineTypes/f1-micro" - disks: a list of compute_v1.AttachedDisk objects describing the disks - you want to attach to your new instance. network_link: name of the network you want the new instance to use. For example: "global/networks/default" represents the network named "default", which is created automatically for each project. subnetwork_link: name of the subnetwork you want the new instance to use. This value uses the following format: "regions/{region}/subnetworks/{subnetwork_name}" + internal_ip: internal IP address you want to assign to the new instance. + By default, a free address from the pool of available internal IP addresses of + used subnet will be used. + external_access: boolean flag indicating if the instance should have an external IPv4 + address assigned. + external_ipv4: external IPv4 address to be assigned to this instance. If you specify + an external IP address, it must live in the same region as the zone of the instance. + This setting requires `external_access` to be set to True to work. + accelerators: a list of AcceleratorConfig objects describing the accelerators that will + be attached to the new instance. preemptible: boolean value indicating if the new instance should be preemptible or not. custom_hostname: Custom hostname of the new VM instance. @@ -107,6 +127,18 @@ def create_instance( if subnetwork_link: network_interface.subnetwork = subnetwork_link + if internal_ip: + network_interface.network_i_p = internal_ip + + if external_access: + access = compute_v1.AccessConfig() + access.type_ = compute_v1.AccessConfig.Type.ONE_TO_ONE_NAT.name + access.name = "External NAT" + access.network_tier = access.NetworkTier.PREMIUM.name + if external_ipv4: + access.nat_i_p = external_ipv4 + network_interface.access_configs = [access] + # Collect information into the Instance object. instance = compute_v1.Instance() instance.name = instance_name @@ -116,6 +148,9 @@ def create_instance( else: instance.machine_type = f"zones/{zone}/machineTypes/{machine_type}" + if accelerators: + instance.guest_accelerators = accelerators + instance.network_interfaces = [network_interface] if preemptible: @@ -131,13 +166,6 @@ def create_instance( # Set the delete protection bit instance.deletion_protection = True - # Shielded Instance settings - # Values presented here are the defaults. - # instance.shielded_instance_config = compute_v1.ShieldedInstanceConfig() - # instance.shielded_instance_config.enable_secure_boot = False - # instance.shielded_instance_config.enable_vtpm = True - # instance.shielded_instance_config.enable_integrity_monitoring = True - # Prepare the request to insert an instance. request = compute_v1.InsertInstanceRequest() request.zone = zone @@ -148,12 +176,16 @@ def create_instance( print(f"Creating the {instance_name} instance in {zone}...") operation = instance_client.insert_unary(request=request) + start = time.time() while operation.status != compute_v1.Operation.Status.DONE: operation = operation_client.wait( operation=operation.name, zone=zone, project=project_id ) + if time.time() - start >= 300: # 5 minutes + raise TimeoutError() if operation.error: print("Error during creation:", operation.error, file=sys.stderr) + raise RuntimeError(operation.error) if operation.warnings: print("Warning during creation:", operation.warnings, file=sys.stderr) print(f"Instance {instance_name} created.") @@ -164,7 +196,8 @@ def create_from_snapshot( project_id: str, zone: str, instance_name: str, snapshot_link: str ): """ - Create a new VM instance with boot disk created from a snapshot. + Create a new VM instance with boot disk created from a snapshot. The + new boot disk will have 20 gigabytes. Args: project_id: project ID or project number of the Cloud project you want to use. @@ -177,7 +210,7 @@ def create_from_snapshot( Instance object. """ disk_type = f"zones/{zone}/diskTypes/pd-standard" - disks = [disk_from_snapshot(disk_type, 11, True, snapshot_link)] + disks = [disk_from_snapshot(disk_type, 20, True, snapshot_link)] instance = create_instance(project_id, zone, instance_name, disks) return instance diff --git a/samples/snippets/instances/create_start_instance/create_with_additional_disk.py b/samples/snippets/instances/create_start_instance/create_with_additional_disk.py index 7945638de..bffe08010 100644 --- a/samples/snippets/instances/create_start_instance/create_with_additional_disk.py +++ b/samples/snippets/instances/create_start_instance/create_with_additional_disk.py @@ -22,12 +22,23 @@ # [START compute_instances_create_from_image_plus_empty_disk] import re import sys +import time from typing import List from google.cloud import compute_v1 def get_image_from_family(project: str, family: str) -> compute_v1.Image: + """ + Retrieve the newest image that is part of a given family in a project. + + Args: + project: project ID or project number of the Cloud project you want to get image from. + family: name of the image family you want to get image from. + + Returns: + An Image object. + """ image_client = compute_v1.ImagesClient() # List of public operating system (OS) images: https://cloud.google.com/compute/docs/images/os-details newest_image = image_client.get_from_family(project=project, family=family) @@ -35,7 +46,11 @@ def get_image_from_family(project: str, family: str) -> compute_v1.Image: def disk_from_image( - disk_type: str, disk_size_gb: int, boot: bool, source_image: str + disk_type: str, + disk_size_gb: int, + boot: bool, + source_image: str, + auto_delete: bool = False, ) -> compute_v1.AttachedDisk: """ Create an AttachedDisk object to be used in VM instance creation. Uses an image as the @@ -50,6 +65,7 @@ def disk_from_image( source_image: source image to use when creating this disk. You must have read access to this disk. This can be one of the publicly available images or an image from one of your projects. This value uses the following format: "projects/{project_name}/global/images/{image_name}" + auto_delete: boolean flag indicating whether this disk should be deleted with the VM that uses it Returns: AttachedDisk object configured to be created using the specified image. @@ -62,12 +78,14 @@ def disk_from_image( boot_disk.initialize_params = initialize_params # Remember to set auto_delete to True if you want the disk to be deleted when you delete # your VM instance. - boot_disk.auto_delete = True + boot_disk.auto_delete = auto_delete boot_disk.boot = boot return boot_disk -def empty_disk(disk_type: str, disk_size_gb: int) -> compute_v1.AttachedDisk(): +def empty_disk( + disk_type: str, disk_size_gb: int, boot: bool = False, auto_delete: bool = False +) -> compute_v1.AttachedDisk(): """ Create an AttachedDisk object to be used in VM instance creation. The created disk contains no data and requires formatting before it can be used. @@ -77,6 +95,8 @@ def empty_disk(disk_type: str, disk_size_gb: int) -> compute_v1.AttachedDisk(): "zones/{zone}/diskTypes/(pd-standard|pd-ssd|pd-balanced|pd-extreme)". For example: "zones/us-west3-b/diskTypes/pd-ssd" disk_size_gb: size of the new disk in gigabytes + boot: boolean flag indicating whether this disk should be used as a boot disk of an instance + auto_delete: boolean flag indicating whether this disk should be deleted with the VM that uses it Returns: AttachedDisk object configured to be created as an empty disk. @@ -101,6 +121,10 @@ def create_instance( machine_type: str = "n1-standard-1", network_link: str = "global/networks/default", subnetwork_link: str = None, + internal_ip: str = None, + external_access: bool = False, + external_ipv4: str = None, + accelerators: List[compute_v1.AcceleratorConfig] = None, preemptible: bool = False, custom_hostname: str = None, delete_protection: bool = False, @@ -112,17 +136,27 @@ def create_instance( project_id: project ID or project number of the Cloud project you want to use. zone: name of the zone to create the instance in. For example: "us-west3-b" instance_name: name of the new virtual machine (VM) instance. + disks: a list of compute_v1.AttachedDisk objects describing the disks + you want to attach to your new instance. machine_type: machine type of the VM being created. This value uses the following format: "zones/{zone}/machineTypes/{type_name}". For example: "zones/europe-west3-c/machineTypes/f1-micro" - disks: a list of compute_v1.AttachedDisk objects describing the disks - you want to attach to your new instance. network_link: name of the network you want the new instance to use. For example: "global/networks/default" represents the network named "default", which is created automatically for each project. subnetwork_link: name of the subnetwork you want the new instance to use. This value uses the following format: "regions/{region}/subnetworks/{subnetwork_name}" + internal_ip: internal IP address you want to assign to the new instance. + By default, a free address from the pool of available internal IP addresses of + used subnet will be used. + external_access: boolean flag indicating if the instance should have an external IPv4 + address assigned. + external_ipv4: external IPv4 address to be assigned to this instance. If you specify + an external IP address, it must live in the same region as the zone of the instance. + This setting requires `external_access` to be set to True to work. + accelerators: a list of AcceleratorConfig objects describing the accelerators that will + be attached to the new instance. preemptible: boolean value indicating if the new instance should be preemptible or not. custom_hostname: Custom hostname of the new VM instance. @@ -141,6 +175,18 @@ def create_instance( if subnetwork_link: network_interface.subnetwork = subnetwork_link + if internal_ip: + network_interface.network_i_p = internal_ip + + if external_access: + access = compute_v1.AccessConfig() + access.type_ = compute_v1.AccessConfig.Type.ONE_TO_ONE_NAT.name + access.name = "External NAT" + access.network_tier = access.NetworkTier.PREMIUM.name + if external_ipv4: + access.nat_i_p = external_ipv4 + network_interface.access_configs = [access] + # Collect information into the Instance object. instance = compute_v1.Instance() instance.name = instance_name @@ -150,6 +196,9 @@ def create_instance( else: instance.machine_type = f"zones/{zone}/machineTypes/{machine_type}" + if accelerators: + instance.guest_accelerators = accelerators + instance.network_interfaces = [network_interface] if preemptible: @@ -165,13 +214,6 @@ def create_instance( # Set the delete protection bit instance.deletion_protection = True - # Shielded Instance settings - # Values presented here are the defaults. - # instance.shielded_instance_config = compute_v1.ShieldedInstanceConfig() - # instance.shielded_instance_config.enable_secure_boot = False - # instance.shielded_instance_config.enable_vtpm = True - # instance.shielded_instance_config.enable_integrity_monitoring = True - # Prepare the request to insert an instance. request = compute_v1.InsertInstanceRequest() request.zone = zone @@ -182,12 +224,16 @@ def create_instance( print(f"Creating the {instance_name} instance in {zone}...") operation = instance_client.insert_unary(request=request) + start = time.time() while operation.status != compute_v1.Operation.Status.DONE: operation = operation_client.wait( operation=operation.name, zone=zone, project=project_id ) + if time.time() - start >= 300: # 5 minutes + raise TimeoutError() if operation.error: print("Error during creation:", operation.error, file=sys.stderr) + raise RuntimeError(operation.error) if operation.warnings: print("Warning during creation:", operation.warnings, file=sys.stderr) print(f"Instance {instance_name} created.") @@ -198,8 +244,8 @@ def create_with_additional_disk( project_id: str, zone: str, instance_name: str ) -> compute_v1.Instance: """ - Create a new VM instance with Debian 10 operating system and a 11 GB additional - empty disk. + Create a new VM instance with Debian 10 operating system on a 20 GB disk + and a 25 GB additional empty disk. Args: project_id: project ID or project number of the Cloud project you want to use. @@ -212,8 +258,8 @@ def create_with_additional_disk( newest_debian = get_image_from_family(project="debian-cloud", family="debian-10") disk_type = f"zones/{zone}/diskTypes/pd-standard" disks = [ - disk_from_image(disk_type, 10, True, newest_debian.self_link), - empty_disk(disk_type, 11), + disk_from_image(disk_type, 20, True, newest_debian.self_link), + empty_disk(disk_type, 25), ] instance = create_instance(project_id, zone, instance_name, disks) return instance diff --git a/samples/snippets/instances/create_start_instance/create_with_snapshotted_data_disk.py b/samples/snippets/instances/create_start_instance/create_with_snapshotted_data_disk.py index 134f41c01..f1c904d09 100644 --- a/samples/snippets/instances/create_start_instance/create_with_snapshotted_data_disk.py +++ b/samples/snippets/instances/create_start_instance/create_with_snapshotted_data_disk.py @@ -22,12 +22,23 @@ # [START compute_instances_create_from_image_plus_snapshot_disk] import re import sys +import time from typing import List from google.cloud import compute_v1 def get_image_from_family(project: str, family: str) -> compute_v1.Image: + """ + Retrieve the newest image that is part of a given family in a project. + + Args: + project: project ID or project number of the Cloud project you want to get image from. + family: name of the image family you want to get image from. + + Returns: + An Image object. + """ image_client = compute_v1.ImagesClient() # List of public operating system (OS) images: https://cloud.google.com/compute/docs/images/os-details newest_image = image_client.get_from_family(project=project, family=family) @@ -35,7 +46,11 @@ def get_image_from_family(project: str, family: str) -> compute_v1.Image: def disk_from_image( - disk_type: str, disk_size_gb: int, boot: bool, source_image: str + disk_type: str, + disk_size_gb: int, + boot: bool, + source_image: str, + auto_delete: bool = False, ) -> compute_v1.AttachedDisk: """ Create an AttachedDisk object to be used in VM instance creation. Uses an image as the @@ -50,6 +65,7 @@ def disk_from_image( source_image: source image to use when creating this disk. You must have read access to this disk. This can be one of the publicly available images or an image from one of your projects. This value uses the following format: "projects/{project_name}/global/images/{image_name}" + auto_delete: boolean flag indicating whether this disk should be deleted with the VM that uses it Returns: AttachedDisk object configured to be created using the specified image. @@ -62,13 +78,17 @@ def disk_from_image( boot_disk.initialize_params = initialize_params # Remember to set auto_delete to True if you want the disk to be deleted when you delete # your VM instance. - boot_disk.auto_delete = True + boot_disk.auto_delete = auto_delete boot_disk.boot = boot return boot_disk def disk_from_snapshot( - disk_type: str, disk_size_gb: int, boot: bool, disk_snapshot: str + disk_type: str, + disk_size_gb: int, + boot: bool, + source_snapshot: str, + auto_delete: bool = False, ) -> compute_v1.AttachedDisk(): """ Create an AttachedDisk object to be used in VM instance creation. Uses a disk snapshot as the @@ -80,21 +100,22 @@ def disk_from_snapshot( For example: "zones/us-west3-b/diskTypes/pd-ssd" disk_size_gb: size of the new disk in gigabytes boot: boolean flag indicating whether this disk should be used as a boot disk of an instance - disk_snapshot: disk snapshot to use when creating this disk. You must have read access to this disk. + source_snapshot: disk snapshot to use when creating this disk. You must have read access to this disk. This value uses the following format: "projects/{project_name}/global/snapshots/{snapshot_name}" + auto_delete: boolean flag indicating whether this disk should be deleted with the VM that uses it Returns: AttachedDisk object configured to be created using the specified snapshot. """ disk = compute_v1.AttachedDisk() initialize_params = compute_v1.AttachedDiskInitializeParams() - initialize_params.source_snapshot = disk_snapshot + initialize_params.source_snapshot = source_snapshot initialize_params.disk_type = disk_type initialize_params.disk_size_gb = disk_size_gb disk.initialize_params = initialize_params # Remember to set auto_delete to True if you want the disk to be deleted when you delete # your VM instance. - disk.auto_delete = True + disk.auto_delete = auto_delete disk.boot = boot return disk @@ -107,6 +128,10 @@ def create_instance( machine_type: str = "n1-standard-1", network_link: str = "global/networks/default", subnetwork_link: str = None, + internal_ip: str = None, + external_access: bool = False, + external_ipv4: str = None, + accelerators: List[compute_v1.AcceleratorConfig] = None, preemptible: bool = False, custom_hostname: str = None, delete_protection: bool = False, @@ -118,17 +143,27 @@ def create_instance( project_id: project ID or project number of the Cloud project you want to use. zone: name of the zone to create the instance in. For example: "us-west3-b" instance_name: name of the new virtual machine (VM) instance. + disks: a list of compute_v1.AttachedDisk objects describing the disks + you want to attach to your new instance. machine_type: machine type of the VM being created. This value uses the following format: "zones/{zone}/machineTypes/{type_name}". For example: "zones/europe-west3-c/machineTypes/f1-micro" - disks: a list of compute_v1.AttachedDisk objects describing the disks - you want to attach to your new instance. network_link: name of the network you want the new instance to use. For example: "global/networks/default" represents the network named "default", which is created automatically for each project. subnetwork_link: name of the subnetwork you want the new instance to use. This value uses the following format: "regions/{region}/subnetworks/{subnetwork_name}" + internal_ip: internal IP address you want to assign to the new instance. + By default, a free address from the pool of available internal IP addresses of + used subnet will be used. + external_access: boolean flag indicating if the instance should have an external IPv4 + address assigned. + external_ipv4: external IPv4 address to be assigned to this instance. If you specify + an external IP address, it must live in the same region as the zone of the instance. + This setting requires `external_access` to be set to True to work. + accelerators: a list of AcceleratorConfig objects describing the accelerators that will + be attached to the new instance. preemptible: boolean value indicating if the new instance should be preemptible or not. custom_hostname: Custom hostname of the new VM instance. @@ -147,6 +182,18 @@ def create_instance( if subnetwork_link: network_interface.subnetwork = subnetwork_link + if internal_ip: + network_interface.network_i_p = internal_ip + + if external_access: + access = compute_v1.AccessConfig() + access.type_ = compute_v1.AccessConfig.Type.ONE_TO_ONE_NAT.name + access.name = "External NAT" + access.network_tier = access.NetworkTier.PREMIUM.name + if external_ipv4: + access.nat_i_p = external_ipv4 + network_interface.access_configs = [access] + # Collect information into the Instance object. instance = compute_v1.Instance() instance.name = instance_name @@ -156,6 +203,9 @@ def create_instance( else: instance.machine_type = f"zones/{zone}/machineTypes/{machine_type}" + if accelerators: + instance.guest_accelerators = accelerators + instance.network_interfaces = [network_interface] if preemptible: @@ -171,13 +221,6 @@ def create_instance( # Set the delete protection bit instance.deletion_protection = True - # Shielded Instance settings - # Values presented here are the defaults. - # instance.shielded_instance_config = compute_v1.ShieldedInstanceConfig() - # instance.shielded_instance_config.enable_secure_boot = False - # instance.shielded_instance_config.enable_vtpm = True - # instance.shielded_instance_config.enable_integrity_monitoring = True - # Prepare the request to insert an instance. request = compute_v1.InsertInstanceRequest() request.zone = zone @@ -188,12 +231,16 @@ def create_instance( print(f"Creating the {instance_name} instance in {zone}...") operation = instance_client.insert_unary(request=request) + start = time.time() while operation.status != compute_v1.Operation.Status.DONE: operation = operation_client.wait( operation=operation.name, zone=zone, project=project_id ) + if time.time() - start >= 300: # 5 minutes + raise TimeoutError() if operation.error: print("Error during creation:", operation.error, file=sys.stderr) + raise RuntimeError(operation.error) if operation.warnings: print("Warning during creation:", operation.warnings, file=sys.stderr) print(f"Instance {instance_name} created.") diff --git a/samples/snippets/instances/create_with_subnet.py b/samples/snippets/instances/create_with_subnet.py index 63e46d0cc..6c4be0122 100644 --- a/samples/snippets/instances/create_with_subnet.py +++ b/samples/snippets/instances/create_with_subnet.py @@ -22,12 +22,23 @@ # [START compute_instances_create_with_subnet] import re import sys +import time from typing import List from google.cloud import compute_v1 def get_image_from_family(project: str, family: str) -> compute_v1.Image: + """ + Retrieve the newest image that is part of a given family in a project. + + Args: + project: project ID or project number of the Cloud project you want to get image from. + family: name of the image family you want to get image from. + + Returns: + An Image object. + """ image_client = compute_v1.ImagesClient() # List of public operating system (OS) images: https://cloud.google.com/compute/docs/images/os-details newest_image = image_client.get_from_family(project=project, family=family) @@ -35,7 +46,11 @@ def get_image_from_family(project: str, family: str) -> compute_v1.Image: def disk_from_image( - disk_type: str, disk_size_gb: int, boot: bool, source_image: str + disk_type: str, + disk_size_gb: int, + boot: bool, + source_image: str, + auto_delete: bool = False, ) -> compute_v1.AttachedDisk: """ Create an AttachedDisk object to be used in VM instance creation. Uses an image as the @@ -50,6 +65,7 @@ def disk_from_image( source_image: source image to use when creating this disk. You must have read access to this disk. This can be one of the publicly available images or an image from one of your projects. This value uses the following format: "projects/{project_name}/global/images/{image_name}" + auto_delete: boolean flag indicating whether this disk should be deleted with the VM that uses it Returns: AttachedDisk object configured to be created using the specified image. @@ -62,7 +78,7 @@ def disk_from_image( boot_disk.initialize_params = initialize_params # Remember to set auto_delete to True if you want the disk to be deleted when you delete # your VM instance. - boot_disk.auto_delete = True + boot_disk.auto_delete = auto_delete boot_disk.boot = boot return boot_disk @@ -75,6 +91,10 @@ def create_instance( machine_type: str = "n1-standard-1", network_link: str = "global/networks/default", subnetwork_link: str = None, + internal_ip: str = None, + external_access: bool = False, + external_ipv4: str = None, + accelerators: List[compute_v1.AcceleratorConfig] = None, preemptible: bool = False, custom_hostname: str = None, delete_protection: bool = False, @@ -86,17 +106,27 @@ def create_instance( project_id: project ID or project number of the Cloud project you want to use. zone: name of the zone to create the instance in. For example: "us-west3-b" instance_name: name of the new virtual machine (VM) instance. + disks: a list of compute_v1.AttachedDisk objects describing the disks + you want to attach to your new instance. machine_type: machine type of the VM being created. This value uses the following format: "zones/{zone}/machineTypes/{type_name}". For example: "zones/europe-west3-c/machineTypes/f1-micro" - disks: a list of compute_v1.AttachedDisk objects describing the disks - you want to attach to your new instance. network_link: name of the network you want the new instance to use. For example: "global/networks/default" represents the network named "default", which is created automatically for each project. subnetwork_link: name of the subnetwork you want the new instance to use. This value uses the following format: "regions/{region}/subnetworks/{subnetwork_name}" + internal_ip: internal IP address you want to assign to the new instance. + By default, a free address from the pool of available internal IP addresses of + used subnet will be used. + external_access: boolean flag indicating if the instance should have an external IPv4 + address assigned. + external_ipv4: external IPv4 address to be assigned to this instance. If you specify + an external IP address, it must live in the same region as the zone of the instance. + This setting requires `external_access` to be set to True to work. + accelerators: a list of AcceleratorConfig objects describing the accelerators that will + be attached to the new instance. preemptible: boolean value indicating if the new instance should be preemptible or not. custom_hostname: Custom hostname of the new VM instance. @@ -115,6 +145,18 @@ def create_instance( if subnetwork_link: network_interface.subnetwork = subnetwork_link + if internal_ip: + network_interface.network_i_p = internal_ip + + if external_access: + access = compute_v1.AccessConfig() + access.type_ = compute_v1.AccessConfig.Type.ONE_TO_ONE_NAT.name + access.name = "External NAT" + access.network_tier = access.NetworkTier.PREMIUM.name + if external_ipv4: + access.nat_i_p = external_ipv4 + network_interface.access_configs = [access] + # Collect information into the Instance object. instance = compute_v1.Instance() instance.name = instance_name @@ -124,6 +166,9 @@ def create_instance( else: instance.machine_type = f"zones/{zone}/machineTypes/{machine_type}" + if accelerators: + instance.guest_accelerators = accelerators + instance.network_interfaces = [network_interface] if preemptible: @@ -139,13 +184,6 @@ def create_instance( # Set the delete protection bit instance.deletion_protection = True - # Shielded Instance settings - # Values presented here are the defaults. - # instance.shielded_instance_config = compute_v1.ShieldedInstanceConfig() - # instance.shielded_instance_config.enable_secure_boot = False - # instance.shielded_instance_config.enable_vtpm = True - # instance.shielded_instance_config.enable_integrity_monitoring = True - # Prepare the request to insert an instance. request = compute_v1.InsertInstanceRequest() request.zone = zone @@ -156,12 +194,16 @@ def create_instance( print(f"Creating the {instance_name} instance in {zone}...") operation = instance_client.insert_unary(request=request) + start = time.time() while operation.status != compute_v1.Operation.Status.DONE: operation = operation_client.wait( operation=operation.name, zone=zone, project=project_id ) + if time.time() - start >= 300: # 5 minutes + raise TimeoutError() if operation.error: print("Error during creation:", operation.error, file=sys.stderr) + raise RuntimeError(operation.error) if operation.warnings: print("Warning during creation:", operation.warnings, file=sys.stderr) print(f"Instance {instance_name} created.") diff --git a/samples/snippets/instances/custom_hostname/create.py b/samples/snippets/instances/custom_hostname/create.py index c600f6c17..9ede42b7b 100644 --- a/samples/snippets/instances/custom_hostname/create.py +++ b/samples/snippets/instances/custom_hostname/create.py @@ -22,12 +22,23 @@ # [START compute_instances_create_custom_hostname] import re import sys +import time from typing import List from google.cloud import compute_v1 def get_image_from_family(project: str, family: str) -> compute_v1.Image: + """ + Retrieve the newest image that is part of a given family in a project. + + Args: + project: project ID or project number of the Cloud project you want to get image from. + family: name of the image family you want to get image from. + + Returns: + An Image object. + """ image_client = compute_v1.ImagesClient() # List of public operating system (OS) images: https://cloud.google.com/compute/docs/images/os-details newest_image = image_client.get_from_family(project=project, family=family) @@ -35,7 +46,11 @@ def get_image_from_family(project: str, family: str) -> compute_v1.Image: def disk_from_image( - disk_type: str, disk_size_gb: int, boot: bool, source_image: str + disk_type: str, + disk_size_gb: int, + boot: bool, + source_image: str, + auto_delete: bool = False, ) -> compute_v1.AttachedDisk: """ Create an AttachedDisk object to be used in VM instance creation. Uses an image as the @@ -50,6 +65,7 @@ def disk_from_image( source_image: source image to use when creating this disk. You must have read access to this disk. This can be one of the publicly available images or an image from one of your projects. This value uses the following format: "projects/{project_name}/global/images/{image_name}" + auto_delete: boolean flag indicating whether this disk should be deleted with the VM that uses it Returns: AttachedDisk object configured to be created using the specified image. @@ -62,7 +78,7 @@ def disk_from_image( boot_disk.initialize_params = initialize_params # Remember to set auto_delete to True if you want the disk to be deleted when you delete # your VM instance. - boot_disk.auto_delete = True + boot_disk.auto_delete = auto_delete boot_disk.boot = boot return boot_disk @@ -75,6 +91,10 @@ def create_instance( machine_type: str = "n1-standard-1", network_link: str = "global/networks/default", subnetwork_link: str = None, + internal_ip: str = None, + external_access: bool = False, + external_ipv4: str = None, + accelerators: List[compute_v1.AcceleratorConfig] = None, preemptible: bool = False, custom_hostname: str = None, delete_protection: bool = False, @@ -86,17 +106,27 @@ def create_instance( project_id: project ID or project number of the Cloud project you want to use. zone: name of the zone to create the instance in. For example: "us-west3-b" instance_name: name of the new virtual machine (VM) instance. + disks: a list of compute_v1.AttachedDisk objects describing the disks + you want to attach to your new instance. machine_type: machine type of the VM being created. This value uses the following format: "zones/{zone}/machineTypes/{type_name}". For example: "zones/europe-west3-c/machineTypes/f1-micro" - disks: a list of compute_v1.AttachedDisk objects describing the disks - you want to attach to your new instance. network_link: name of the network you want the new instance to use. For example: "global/networks/default" represents the network named "default", which is created automatically for each project. subnetwork_link: name of the subnetwork you want the new instance to use. This value uses the following format: "regions/{region}/subnetworks/{subnetwork_name}" + internal_ip: internal IP address you want to assign to the new instance. + By default, a free address from the pool of available internal IP addresses of + used subnet will be used. + external_access: boolean flag indicating if the instance should have an external IPv4 + address assigned. + external_ipv4: external IPv4 address to be assigned to this instance. If you specify + an external IP address, it must live in the same region as the zone of the instance. + This setting requires `external_access` to be set to True to work. + accelerators: a list of AcceleratorConfig objects describing the accelerators that will + be attached to the new instance. preemptible: boolean value indicating if the new instance should be preemptible or not. custom_hostname: Custom hostname of the new VM instance. @@ -115,6 +145,18 @@ def create_instance( if subnetwork_link: network_interface.subnetwork = subnetwork_link + if internal_ip: + network_interface.network_i_p = internal_ip + + if external_access: + access = compute_v1.AccessConfig() + access.type_ = compute_v1.AccessConfig.Type.ONE_TO_ONE_NAT.name + access.name = "External NAT" + access.network_tier = access.NetworkTier.PREMIUM.name + if external_ipv4: + access.nat_i_p = external_ipv4 + network_interface.access_configs = [access] + # Collect information into the Instance object. instance = compute_v1.Instance() instance.name = instance_name @@ -124,6 +166,9 @@ def create_instance( else: instance.machine_type = f"zones/{zone}/machineTypes/{machine_type}" + if accelerators: + instance.guest_accelerators = accelerators + instance.network_interfaces = [network_interface] if preemptible: @@ -139,13 +184,6 @@ def create_instance( # Set the delete protection bit instance.deletion_protection = True - # Shielded Instance settings - # Values presented here are the defaults. - # instance.shielded_instance_config = compute_v1.ShieldedInstanceConfig() - # instance.shielded_instance_config.enable_secure_boot = False - # instance.shielded_instance_config.enable_vtpm = True - # instance.shielded_instance_config.enable_integrity_monitoring = True - # Prepare the request to insert an instance. request = compute_v1.InsertInstanceRequest() request.zone = zone @@ -156,12 +194,16 @@ def create_instance( print(f"Creating the {instance_name} instance in {zone}...") operation = instance_client.insert_unary(request=request) + start = time.time() while operation.status != compute_v1.Operation.Status.DONE: operation = operation_client.wait( operation=operation.name, zone=zone, project=project_id ) + if time.time() - start >= 300: # 5 minutes + raise TimeoutError() if operation.error: print("Error during creation:", operation.error, file=sys.stderr) + raise RuntimeError(operation.error) if operation.warnings: print("Warning during creation:", operation.warnings, file=sys.stderr) print(f"Instance {instance_name} created.") diff --git a/samples/snippets/instances/custom_machine_types/create_shared_with_helper.py b/samples/snippets/instances/custom_machine_types/create_shared_with_helper.py index 16d107883..f699228b9 100644 --- a/samples/snippets/instances/custom_machine_types/create_shared_with_helper.py +++ b/samples/snippets/instances/custom_machine_types/create_shared_with_helper.py @@ -25,6 +25,7 @@ from enum import unique import re import sys +import time from typing import List from google.cloud import compute_v1 @@ -60,6 +61,8 @@ class CPUSeries(Enum): ], ) + # The limits for various CPU types are described on: + # https://cloud.google.com/compute/docs/general-purpose-machines LIMITS = { CPUSeries.E2: TypeLimits(frozenset(range(2, 33, 2)), 512, 8192, False, 0), CPUSeries.E2_MICRO: TypeLimits(frozenset(), 1024, 2048, False, 0), @@ -86,10 +89,12 @@ def __init__( self.zone = zone self.cpu_series = cpu_series self.limits = self.LIMITS[self.cpu_series] + # Shared machine types (e2-small, e2-medium and e2-micro) always have + # 2 vCPUs: https://cloud.google.com/compute/docs/general-purpose-machines#e2_limitations self.core_count = 2 if self.is_shared() else core_count self.memory_mb = memory_mb - - self._check() + self._checked = False + self._check_parameters() self.extra_memory_used = self._check_extra_memory() def is_shared(self): @@ -100,10 +105,14 @@ def is_shared(self): ) def _check_extra_memory(self) -> bool: - # Assuming this runs after _check() and the total memory requested is correct - return self.memory_mb > self.core_count * self.limits.max_mem_per_core + if self._checked: + return self.memory_mb > self.core_count * self.limits.max_mem_per_core + else: + raise RuntimeError( + "You need to call _check_parameters() before calling _check_extra_memory()" + ) - def _check(self): + def _check_parameters(self): """ Check whether the requested parameters are allowed. Find more information about limitations of custom machine types at: https://cloud.google.com/compute/docs/general-purpose-machines#custom_machine_types @@ -139,6 +148,8 @@ def _check(self): f"Requested memory is too large.. Maximum memory allowed for {self.cpu_series.name} is {self.limits.max_mem_per_core} MB per core." ) + self._checked = True + def __str__(self) -> str: """ Return the custom machine type in form of a string acceptable by Compute Engine API. @@ -212,6 +223,16 @@ def from_str(cls, machine_type: str): def get_image_from_family(project: str, family: str) -> compute_v1.Image: + """ + Retrieve the newest image that is part of a given family in a project. + + Args: + project: project ID or project number of the Cloud project you want to get image from. + family: name of the image family you want to get image from. + + Returns: + An Image object. + """ image_client = compute_v1.ImagesClient() # List of public operating system (OS) images: https://cloud.google.com/compute/docs/images/os-details newest_image = image_client.get_from_family(project=project, family=family) @@ -219,7 +240,11 @@ def get_image_from_family(project: str, family: str) -> compute_v1.Image: def disk_from_image( - disk_type: str, disk_size_gb: int, boot: bool, source_image: str + disk_type: str, + disk_size_gb: int, + boot: bool, + source_image: str, + auto_delete: bool = False, ) -> compute_v1.AttachedDisk: """ Create an AttachedDisk object to be used in VM instance creation. Uses an image as the @@ -234,6 +259,7 @@ def disk_from_image( source_image: source image to use when creating this disk. You must have read access to this disk. This can be one of the publicly available images or an image from one of your projects. This value uses the following format: "projects/{project_name}/global/images/{image_name}" + auto_delete: boolean flag indicating whether this disk should be deleted with the VM that uses it Returns: AttachedDisk object configured to be created using the specified image. @@ -246,7 +272,7 @@ def disk_from_image( boot_disk.initialize_params = initialize_params # Remember to set auto_delete to True if you want the disk to be deleted when you delete # your VM instance. - boot_disk.auto_delete = True + boot_disk.auto_delete = auto_delete boot_disk.boot = boot return boot_disk @@ -259,6 +285,10 @@ def create_instance( machine_type: str = "n1-standard-1", network_link: str = "global/networks/default", subnetwork_link: str = None, + internal_ip: str = None, + external_access: bool = False, + external_ipv4: str = None, + accelerators: List[compute_v1.AcceleratorConfig] = None, preemptible: bool = False, custom_hostname: str = None, delete_protection: bool = False, @@ -270,17 +300,27 @@ def create_instance( project_id: project ID or project number of the Cloud project you want to use. zone: name of the zone to create the instance in. For example: "us-west3-b" instance_name: name of the new virtual machine (VM) instance. + disks: a list of compute_v1.AttachedDisk objects describing the disks + you want to attach to your new instance. machine_type: machine type of the VM being created. This value uses the following format: "zones/{zone}/machineTypes/{type_name}". For example: "zones/europe-west3-c/machineTypes/f1-micro" - disks: a list of compute_v1.AttachedDisk objects describing the disks - you want to attach to your new instance. network_link: name of the network you want the new instance to use. For example: "global/networks/default" represents the network named "default", which is created automatically for each project. subnetwork_link: name of the subnetwork you want the new instance to use. This value uses the following format: "regions/{region}/subnetworks/{subnetwork_name}" + internal_ip: internal IP address you want to assign to the new instance. + By default, a free address from the pool of available internal IP addresses of + used subnet will be used. + external_access: boolean flag indicating if the instance should have an external IPv4 + address assigned. + external_ipv4: external IPv4 address to be assigned to this instance. If you specify + an external IP address, it must live in the same region as the zone of the instance. + This setting requires `external_access` to be set to True to work. + accelerators: a list of AcceleratorConfig objects describing the accelerators that will + be attached to the new instance. preemptible: boolean value indicating if the new instance should be preemptible or not. custom_hostname: Custom hostname of the new VM instance. @@ -299,6 +339,18 @@ def create_instance( if subnetwork_link: network_interface.subnetwork = subnetwork_link + if internal_ip: + network_interface.network_i_p = internal_ip + + if external_access: + access = compute_v1.AccessConfig() + access.type_ = compute_v1.AccessConfig.Type.ONE_TO_ONE_NAT.name + access.name = "External NAT" + access.network_tier = access.NetworkTier.PREMIUM.name + if external_ipv4: + access.nat_i_p = external_ipv4 + network_interface.access_configs = [access] + # Collect information into the Instance object. instance = compute_v1.Instance() instance.name = instance_name @@ -308,6 +360,9 @@ def create_instance( else: instance.machine_type = f"zones/{zone}/machineTypes/{machine_type}" + if accelerators: + instance.guest_accelerators = accelerators + instance.network_interfaces = [network_interface] if preemptible: @@ -323,13 +378,6 @@ def create_instance( # Set the delete protection bit instance.deletion_protection = True - # Shielded Instance settings - # Values presented here are the defaults. - # instance.shielded_instance_config = compute_v1.ShieldedInstanceConfig() - # instance.shielded_instance_config.enable_secure_boot = False - # instance.shielded_instance_config.enable_vtpm = True - # instance.shielded_instance_config.enable_integrity_monitoring = True - # Prepare the request to insert an instance. request = compute_v1.InsertInstanceRequest() request.zone = zone @@ -340,12 +388,16 @@ def create_instance( print(f"Creating the {instance_name} instance in {zone}...") operation = instance_client.insert_unary(request=request) + start = time.time() while operation.status != compute_v1.Operation.Status.DONE: operation = operation_client.wait( operation=operation.name, zone=zone, project=project_id ) + if time.time() - start >= 300: # 5 minutes + raise TimeoutError() if operation.error: print("Error during creation:", operation.error, file=sys.stderr) + raise RuntimeError(operation.error) if operation.warnings: print("Warning during creation:", operation.warnings, file=sys.stderr) print(f"Instance {instance_name} created.") diff --git a/samples/snippets/instances/custom_machine_types/create_with_helper.py b/samples/snippets/instances/custom_machine_types/create_with_helper.py index 79e7d1a2a..700ccdcea 100644 --- a/samples/snippets/instances/custom_machine_types/create_with_helper.py +++ b/samples/snippets/instances/custom_machine_types/create_with_helper.py @@ -25,6 +25,7 @@ from enum import unique import re import sys +import time from typing import List from google.cloud import compute_v1 @@ -60,6 +61,8 @@ class CPUSeries(Enum): ], ) + # The limits for various CPU types are described on: + # https://cloud.google.com/compute/docs/general-purpose-machines LIMITS = { CPUSeries.E2: TypeLimits(frozenset(range(2, 33, 2)), 512, 8192, False, 0), CPUSeries.E2_MICRO: TypeLimits(frozenset(), 1024, 2048, False, 0), @@ -86,10 +89,12 @@ def __init__( self.zone = zone self.cpu_series = cpu_series self.limits = self.LIMITS[self.cpu_series] + # Shared machine types (e2-small, e2-medium and e2-micro) always have + # 2 vCPUs: https://cloud.google.com/compute/docs/general-purpose-machines#e2_limitations self.core_count = 2 if self.is_shared() else core_count self.memory_mb = memory_mb - - self._check() + self._checked = False + self._check_parameters() self.extra_memory_used = self._check_extra_memory() def is_shared(self): @@ -100,10 +105,14 @@ def is_shared(self): ) def _check_extra_memory(self) -> bool: - # Assuming this runs after _check() and the total memory requested is correct - return self.memory_mb > self.core_count * self.limits.max_mem_per_core + if self._checked: + return self.memory_mb > self.core_count * self.limits.max_mem_per_core + else: + raise RuntimeError( + "You need to call _check_parameters() before calling _check_extra_memory()" + ) - def _check(self): + def _check_parameters(self): """ Check whether the requested parameters are allowed. Find more information about limitations of custom machine types at: https://cloud.google.com/compute/docs/general-purpose-machines#custom_machine_types @@ -139,6 +148,8 @@ def _check(self): f"Requested memory is too large.. Maximum memory allowed for {self.cpu_series.name} is {self.limits.max_mem_per_core} MB per core." ) + self._checked = True + def __str__(self) -> str: """ Return the custom machine type in form of a string acceptable by Compute Engine API. @@ -212,6 +223,16 @@ def from_str(cls, machine_type: str): def get_image_from_family(project: str, family: str) -> compute_v1.Image: + """ + Retrieve the newest image that is part of a given family in a project. + + Args: + project: project ID or project number of the Cloud project you want to get image from. + family: name of the image family you want to get image from. + + Returns: + An Image object. + """ image_client = compute_v1.ImagesClient() # List of public operating system (OS) images: https://cloud.google.com/compute/docs/images/os-details newest_image = image_client.get_from_family(project=project, family=family) @@ -219,7 +240,11 @@ def get_image_from_family(project: str, family: str) -> compute_v1.Image: def disk_from_image( - disk_type: str, disk_size_gb: int, boot: bool, source_image: str + disk_type: str, + disk_size_gb: int, + boot: bool, + source_image: str, + auto_delete: bool = False, ) -> compute_v1.AttachedDisk: """ Create an AttachedDisk object to be used in VM instance creation. Uses an image as the @@ -234,6 +259,7 @@ def disk_from_image( source_image: source image to use when creating this disk. You must have read access to this disk. This can be one of the publicly available images or an image from one of your projects. This value uses the following format: "projects/{project_name}/global/images/{image_name}" + auto_delete: boolean flag indicating whether this disk should be deleted with the VM that uses it Returns: AttachedDisk object configured to be created using the specified image. @@ -246,7 +272,7 @@ def disk_from_image( boot_disk.initialize_params = initialize_params # Remember to set auto_delete to True if you want the disk to be deleted when you delete # your VM instance. - boot_disk.auto_delete = True + boot_disk.auto_delete = auto_delete boot_disk.boot = boot return boot_disk @@ -259,6 +285,10 @@ def create_instance( machine_type: str = "n1-standard-1", network_link: str = "global/networks/default", subnetwork_link: str = None, + internal_ip: str = None, + external_access: bool = False, + external_ipv4: str = None, + accelerators: List[compute_v1.AcceleratorConfig] = None, preemptible: bool = False, custom_hostname: str = None, delete_protection: bool = False, @@ -270,17 +300,27 @@ def create_instance( project_id: project ID or project number of the Cloud project you want to use. zone: name of the zone to create the instance in. For example: "us-west3-b" instance_name: name of the new virtual machine (VM) instance. + disks: a list of compute_v1.AttachedDisk objects describing the disks + you want to attach to your new instance. machine_type: machine type of the VM being created. This value uses the following format: "zones/{zone}/machineTypes/{type_name}". For example: "zones/europe-west3-c/machineTypes/f1-micro" - disks: a list of compute_v1.AttachedDisk objects describing the disks - you want to attach to your new instance. network_link: name of the network you want the new instance to use. For example: "global/networks/default" represents the network named "default", which is created automatically for each project. subnetwork_link: name of the subnetwork you want the new instance to use. This value uses the following format: "regions/{region}/subnetworks/{subnetwork_name}" + internal_ip: internal IP address you want to assign to the new instance. + By default, a free address from the pool of available internal IP addresses of + used subnet will be used. + external_access: boolean flag indicating if the instance should have an external IPv4 + address assigned. + external_ipv4: external IPv4 address to be assigned to this instance. If you specify + an external IP address, it must live in the same region as the zone of the instance. + This setting requires `external_access` to be set to True to work. + accelerators: a list of AcceleratorConfig objects describing the accelerators that will + be attached to the new instance. preemptible: boolean value indicating if the new instance should be preemptible or not. custom_hostname: Custom hostname of the new VM instance. @@ -299,6 +339,18 @@ def create_instance( if subnetwork_link: network_interface.subnetwork = subnetwork_link + if internal_ip: + network_interface.network_i_p = internal_ip + + if external_access: + access = compute_v1.AccessConfig() + access.type_ = compute_v1.AccessConfig.Type.ONE_TO_ONE_NAT.name + access.name = "External NAT" + access.network_tier = access.NetworkTier.PREMIUM.name + if external_ipv4: + access.nat_i_p = external_ipv4 + network_interface.access_configs = [access] + # Collect information into the Instance object. instance = compute_v1.Instance() instance.name = instance_name @@ -308,6 +360,9 @@ def create_instance( else: instance.machine_type = f"zones/{zone}/machineTypes/{machine_type}" + if accelerators: + instance.guest_accelerators = accelerators + instance.network_interfaces = [network_interface] if preemptible: @@ -323,13 +378,6 @@ def create_instance( # Set the delete protection bit instance.deletion_protection = True - # Shielded Instance settings - # Values presented here are the defaults. - # instance.shielded_instance_config = compute_v1.ShieldedInstanceConfig() - # instance.shielded_instance_config.enable_secure_boot = False - # instance.shielded_instance_config.enable_vtpm = True - # instance.shielded_instance_config.enable_integrity_monitoring = True - # Prepare the request to insert an instance. request = compute_v1.InsertInstanceRequest() request.zone = zone @@ -340,12 +388,16 @@ def create_instance( print(f"Creating the {instance_name} instance in {zone}...") operation = instance_client.insert_unary(request=request) + start = time.time() while operation.status != compute_v1.Operation.Status.DONE: operation = operation_client.wait( operation=operation.name, zone=zone, project=project_id ) + if time.time() - start >= 300: # 5 minutes + raise TimeoutError() if operation.error: print("Error during creation:", operation.error, file=sys.stderr) + raise RuntimeError(operation.error) if operation.warnings: print("Warning during creation:", operation.warnings, file=sys.stderr) print(f"Instance {instance_name} created.") diff --git a/samples/snippets/instances/custom_machine_types/create_without_helper.py b/samples/snippets/instances/custom_machine_types/create_without_helper.py index 5f04cc79f..ae79f9fb7 100644 --- a/samples/snippets/instances/custom_machine_types/create_without_helper.py +++ b/samples/snippets/instances/custom_machine_types/create_without_helper.py @@ -22,12 +22,23 @@ # [START compute_custom_machine_type_create_without_helper] import re import sys +import time from typing import List from google.cloud import compute_v1 def get_image_from_family(project: str, family: str) -> compute_v1.Image: + """ + Retrieve the newest image that is part of a given family in a project. + + Args: + project: project ID or project number of the Cloud project you want to get image from. + family: name of the image family you want to get image from. + + Returns: + An Image object. + """ image_client = compute_v1.ImagesClient() # List of public operating system (OS) images: https://cloud.google.com/compute/docs/images/os-details newest_image = image_client.get_from_family(project=project, family=family) @@ -35,7 +46,11 @@ def get_image_from_family(project: str, family: str) -> compute_v1.Image: def disk_from_image( - disk_type: str, disk_size_gb: int, boot: bool, source_image: str + disk_type: str, + disk_size_gb: int, + boot: bool, + source_image: str, + auto_delete: bool = False, ) -> compute_v1.AttachedDisk: """ Create an AttachedDisk object to be used in VM instance creation. Uses an image as the @@ -50,6 +65,7 @@ def disk_from_image( source_image: source image to use when creating this disk. You must have read access to this disk. This can be one of the publicly available images or an image from one of your projects. This value uses the following format: "projects/{project_name}/global/images/{image_name}" + auto_delete: boolean flag indicating whether this disk should be deleted with the VM that uses it Returns: AttachedDisk object configured to be created using the specified image. @@ -62,7 +78,7 @@ def disk_from_image( boot_disk.initialize_params = initialize_params # Remember to set auto_delete to True if you want the disk to be deleted when you delete # your VM instance. - boot_disk.auto_delete = True + boot_disk.auto_delete = auto_delete boot_disk.boot = boot return boot_disk @@ -75,6 +91,10 @@ def create_instance( machine_type: str = "n1-standard-1", network_link: str = "global/networks/default", subnetwork_link: str = None, + internal_ip: str = None, + external_access: bool = False, + external_ipv4: str = None, + accelerators: List[compute_v1.AcceleratorConfig] = None, preemptible: bool = False, custom_hostname: str = None, delete_protection: bool = False, @@ -86,17 +106,27 @@ def create_instance( project_id: project ID or project number of the Cloud project you want to use. zone: name of the zone to create the instance in. For example: "us-west3-b" instance_name: name of the new virtual machine (VM) instance. + disks: a list of compute_v1.AttachedDisk objects describing the disks + you want to attach to your new instance. machine_type: machine type of the VM being created. This value uses the following format: "zones/{zone}/machineTypes/{type_name}". For example: "zones/europe-west3-c/machineTypes/f1-micro" - disks: a list of compute_v1.AttachedDisk objects describing the disks - you want to attach to your new instance. network_link: name of the network you want the new instance to use. For example: "global/networks/default" represents the network named "default", which is created automatically for each project. subnetwork_link: name of the subnetwork you want the new instance to use. This value uses the following format: "regions/{region}/subnetworks/{subnetwork_name}" + internal_ip: internal IP address you want to assign to the new instance. + By default, a free address from the pool of available internal IP addresses of + used subnet will be used. + external_access: boolean flag indicating if the instance should have an external IPv4 + address assigned. + external_ipv4: external IPv4 address to be assigned to this instance. If you specify + an external IP address, it must live in the same region as the zone of the instance. + This setting requires `external_access` to be set to True to work. + accelerators: a list of AcceleratorConfig objects describing the accelerators that will + be attached to the new instance. preemptible: boolean value indicating if the new instance should be preemptible or not. custom_hostname: Custom hostname of the new VM instance. @@ -115,6 +145,18 @@ def create_instance( if subnetwork_link: network_interface.subnetwork = subnetwork_link + if internal_ip: + network_interface.network_i_p = internal_ip + + if external_access: + access = compute_v1.AccessConfig() + access.type_ = compute_v1.AccessConfig.Type.ONE_TO_ONE_NAT.name + access.name = "External NAT" + access.network_tier = access.NetworkTier.PREMIUM.name + if external_ipv4: + access.nat_i_p = external_ipv4 + network_interface.access_configs = [access] + # Collect information into the Instance object. instance = compute_v1.Instance() instance.name = instance_name @@ -124,6 +166,9 @@ def create_instance( else: instance.machine_type = f"zones/{zone}/machineTypes/{machine_type}" + if accelerators: + instance.guest_accelerators = accelerators + instance.network_interfaces = [network_interface] if preemptible: @@ -139,13 +184,6 @@ def create_instance( # Set the delete protection bit instance.deletion_protection = True - # Shielded Instance settings - # Values presented here are the defaults. - # instance.shielded_instance_config = compute_v1.ShieldedInstanceConfig() - # instance.shielded_instance_config.enable_secure_boot = False - # instance.shielded_instance_config.enable_vtpm = True - # instance.shielded_instance_config.enable_integrity_monitoring = True - # Prepare the request to insert an instance. request = compute_v1.InsertInstanceRequest() request.zone = zone @@ -156,12 +194,16 @@ def create_instance( print(f"Creating the {instance_name} instance in {zone}...") operation = instance_client.insert_unary(request=request) + start = time.time() while operation.status != compute_v1.Operation.Status.DONE: operation = operation_client.wait( operation=operation.name, zone=zone, project=project_id ) + if time.time() - start >= 300: # 5 minutes + raise TimeoutError() if operation.error: print("Error during creation:", operation.error, file=sys.stderr) + raise RuntimeError(operation.error) if operation.warnings: print("Warning during creation:", operation.warnings, file=sys.stderr) print(f"Instance {instance_name} created.") @@ -172,7 +214,7 @@ def create_custom_instances_no_helper( project_id: str, zone: str, instance_name: str, core_count: int, memory: int ) -> List[compute_v1.Instance]: """ - Create new VM instances without using a CustomMachineType helper function. + Create 7 new VM instances without using a CustomMachineType helper function. Args: project_id: project ID or project number of the Cloud project you want to use. @@ -187,58 +229,40 @@ def create_custom_instances_no_helper( newest_debian = get_image_from_family(project="debian-cloud", family="debian-10") disk_type = f"zones/{zone}/diskTypes/pd-standard" disks = [disk_from_image(disk_type, 10, True, newest_debian.self_link)] - # The core_count and memory values are not validated anywhere and can be rejected by the API. - instances = [ - create_instance( - project_id, - zone, + params = [ + ( f"{instance_name}_n1", - disks, f"zones/{zone}/machineTypes/custom-{core_count}-{memory}", ), - create_instance( - project_id, - zone, + ( f"{instance_name}_n2", - disks, f"zones/{zone}/machineTypes/n2-custom-{core_count}-{memory}", ), - create_instance( - project_id, - zone, + ( f"{instance_name}_n2d", - disks, f"zones/{zone}/machineTypes/n2d-custom-{core_count}-{memory}", ), - create_instance( - project_id, - zone, + ( f"{instance_name}_e2", - disks, f"zones/{zone}/machineTypes/e2-custom-{core_count}-{memory}", ), - create_instance( - project_id, - zone, + ( f"{instance_name}_e2_micro", - disks, f"zones/{zone}/machineTypes/e2-custom-micro-{memory}", ), - create_instance( - project_id, - zone, + ( f"{instance_name}_e2_small", - disks, f"zones/{zone}/machineTypes/e2-custom-small-{memory}", ), - create_instance( - project_id, - zone, + ( f"{instance_name}_e2_medium", - disks, f"zones/{zone}/machineTypes/e2-custom-medium-{memory}", ), ] + # The core_count and memory values are not validated anywhere and can be rejected by the API. + instances = [ + create_instance(project_id, zone, name, disks, type) for name, type in params + ] return instances diff --git a/samples/snippets/instances/custom_machine_types/extra_mem_no_helper.py b/samples/snippets/instances/custom_machine_types/extra_mem_no_helper.py index a2667437e..e4b1abd11 100644 --- a/samples/snippets/instances/custom_machine_types/extra_mem_no_helper.py +++ b/samples/snippets/instances/custom_machine_types/extra_mem_no_helper.py @@ -22,12 +22,23 @@ # [START compute_custom_machine_type_extra_mem_no_helper] import re import sys +import time from typing import List from google.cloud import compute_v1 def get_image_from_family(project: str, family: str) -> compute_v1.Image: + """ + Retrieve the newest image that is part of a given family in a project. + + Args: + project: project ID or project number of the Cloud project you want to get image from. + family: name of the image family you want to get image from. + + Returns: + An Image object. + """ image_client = compute_v1.ImagesClient() # List of public operating system (OS) images: https://cloud.google.com/compute/docs/images/os-details newest_image = image_client.get_from_family(project=project, family=family) @@ -35,7 +46,11 @@ def get_image_from_family(project: str, family: str) -> compute_v1.Image: def disk_from_image( - disk_type: str, disk_size_gb: int, boot: bool, source_image: str + disk_type: str, + disk_size_gb: int, + boot: bool, + source_image: str, + auto_delete: bool = False, ) -> compute_v1.AttachedDisk: """ Create an AttachedDisk object to be used in VM instance creation. Uses an image as the @@ -50,6 +65,7 @@ def disk_from_image( source_image: source image to use when creating this disk. You must have read access to this disk. This can be one of the publicly available images or an image from one of your projects. This value uses the following format: "projects/{project_name}/global/images/{image_name}" + auto_delete: boolean flag indicating whether this disk should be deleted with the VM that uses it Returns: AttachedDisk object configured to be created using the specified image. @@ -62,7 +78,7 @@ def disk_from_image( boot_disk.initialize_params = initialize_params # Remember to set auto_delete to True if you want the disk to be deleted when you delete # your VM instance. - boot_disk.auto_delete = True + boot_disk.auto_delete = auto_delete boot_disk.boot = boot return boot_disk @@ -75,6 +91,10 @@ def create_instance( machine_type: str = "n1-standard-1", network_link: str = "global/networks/default", subnetwork_link: str = None, + internal_ip: str = None, + external_access: bool = False, + external_ipv4: str = None, + accelerators: List[compute_v1.AcceleratorConfig] = None, preemptible: bool = False, custom_hostname: str = None, delete_protection: bool = False, @@ -86,17 +106,27 @@ def create_instance( project_id: project ID or project number of the Cloud project you want to use. zone: name of the zone to create the instance in. For example: "us-west3-b" instance_name: name of the new virtual machine (VM) instance. + disks: a list of compute_v1.AttachedDisk objects describing the disks + you want to attach to your new instance. machine_type: machine type of the VM being created. This value uses the following format: "zones/{zone}/machineTypes/{type_name}". For example: "zones/europe-west3-c/machineTypes/f1-micro" - disks: a list of compute_v1.AttachedDisk objects describing the disks - you want to attach to your new instance. network_link: name of the network you want the new instance to use. For example: "global/networks/default" represents the network named "default", which is created automatically for each project. subnetwork_link: name of the subnetwork you want the new instance to use. This value uses the following format: "regions/{region}/subnetworks/{subnetwork_name}" + internal_ip: internal IP address you want to assign to the new instance. + By default, a free address from the pool of available internal IP addresses of + used subnet will be used. + external_access: boolean flag indicating if the instance should have an external IPv4 + address assigned. + external_ipv4: external IPv4 address to be assigned to this instance. If you specify + an external IP address, it must live in the same region as the zone of the instance. + This setting requires `external_access` to be set to True to work. + accelerators: a list of AcceleratorConfig objects describing the accelerators that will + be attached to the new instance. preemptible: boolean value indicating if the new instance should be preemptible or not. custom_hostname: Custom hostname of the new VM instance. @@ -115,6 +145,18 @@ def create_instance( if subnetwork_link: network_interface.subnetwork = subnetwork_link + if internal_ip: + network_interface.network_i_p = internal_ip + + if external_access: + access = compute_v1.AccessConfig() + access.type_ = compute_v1.AccessConfig.Type.ONE_TO_ONE_NAT.name + access.name = "External NAT" + access.network_tier = access.NetworkTier.PREMIUM.name + if external_ipv4: + access.nat_i_p = external_ipv4 + network_interface.access_configs = [access] + # Collect information into the Instance object. instance = compute_v1.Instance() instance.name = instance_name @@ -124,6 +166,9 @@ def create_instance( else: instance.machine_type = f"zones/{zone}/machineTypes/{machine_type}" + if accelerators: + instance.guest_accelerators = accelerators + instance.network_interfaces = [network_interface] if preemptible: @@ -139,13 +184,6 @@ def create_instance( # Set the delete protection bit instance.deletion_protection = True - # Shielded Instance settings - # Values presented here are the defaults. - # instance.shielded_instance_config = compute_v1.ShieldedInstanceConfig() - # instance.shielded_instance_config.enable_secure_boot = False - # instance.shielded_instance_config.enable_vtpm = True - # instance.shielded_instance_config.enable_integrity_monitoring = True - # Prepare the request to insert an instance. request = compute_v1.InsertInstanceRequest() request.zone = zone @@ -156,23 +194,27 @@ def create_instance( print(f"Creating the {instance_name} instance in {zone}...") operation = instance_client.insert_unary(request=request) + start = time.time() while operation.status != compute_v1.Operation.Status.DONE: operation = operation_client.wait( operation=operation.name, zone=zone, project=project_id ) + if time.time() - start >= 300: # 5 minutes + raise TimeoutError() if operation.error: print("Error during creation:", operation.error, file=sys.stderr) + raise RuntimeError(operation.error) if operation.warnings: print("Warning during creation:", operation.warnings, file=sys.stderr) print(f"Instance {instance_name} created.") return instance -def create_custom_instances_extra_mem_no_helper( +def create_custom_instances_extra_mem( project_id: str, zone: str, instance_name: str, core_count: int, memory: int ) -> List[compute_v1.Instance]: """ - Create new VM instances with extra memory without using a CustomMachineType helper class. + Create 3 new VM instances with extra memory without using a CustomMachineType helper class. Args: project_id: project ID or project number of the Cloud project you want to use. diff --git a/samples/snippets/instances/custom_machine_types/helper_class.py b/samples/snippets/instances/custom_machine_types/helper_class.py index acd867c0f..568710aee 100644 --- a/samples/snippets/instances/custom_machine_types/helper_class.py +++ b/samples/snippets/instances/custom_machine_types/helper_class.py @@ -55,6 +55,8 @@ class CPUSeries(Enum): ], ) + # The limits for various CPU types are described on: + # https://cloud.google.com/compute/docs/general-purpose-machines LIMITS = { CPUSeries.E2: TypeLimits(frozenset(range(2, 33, 2)), 512, 8192, False, 0), CPUSeries.E2_MICRO: TypeLimits(frozenset(), 1024, 2048, False, 0), @@ -81,10 +83,12 @@ def __init__( self.zone = zone self.cpu_series = cpu_series self.limits = self.LIMITS[self.cpu_series] + # Shared machine types (e2-small, e2-medium and e2-micro) always have + # 2 vCPUs: https://cloud.google.com/compute/docs/general-purpose-machines#e2_limitations self.core_count = 2 if self.is_shared() else core_count self.memory_mb = memory_mb - - self._check() + self._checked = False + self._check_parameters() self.extra_memory_used = self._check_extra_memory() def is_shared(self): @@ -95,10 +99,14 @@ def is_shared(self): ) def _check_extra_memory(self) -> bool: - # Assuming this runs after _check() and the total memory requested is correct - return self.memory_mb > self.core_count * self.limits.max_mem_per_core + if self._checked: + return self.memory_mb > self.core_count * self.limits.max_mem_per_core + else: + raise RuntimeError( + "You need to call _check_parameters() before calling _check_extra_memory()" + ) - def _check(self): + def _check_parameters(self): """ Check whether the requested parameters are allowed. Find more information about limitations of custom machine types at: https://cloud.google.com/compute/docs/general-purpose-machines#custom_machine_types @@ -134,6 +142,8 @@ def _check(self): f"Requested memory is too large.. Maximum memory allowed for {self.cpu_series.name} is {self.limits.max_mem_per_core} MB per core." ) + self._checked = True + def __str__(self) -> str: """ Return the custom machine type in form of a string acceptable by Compute Engine API. diff --git a/samples/snippets/instances/custom_machine_types/update_memory.py b/samples/snippets/instances/custom_machine_types/update_memory.py index 5a168e784..b65c94344 100644 --- a/samples/snippets/instances/custom_machine_types/update_memory.py +++ b/samples/snippets/instances/custom_machine_types/update_memory.py @@ -46,6 +46,13 @@ def add_extended_memory_to_instance( project=project_id, zone=zone, instance=instance_name ) + if not ( + "n1-" in instance.machine_type + or "n2-" in instance.machine_type + or "n2d-" in instance.machine_type + ): + raise RuntimeError("Extra memory is available only for N1, N2 and N2D CPUs.") + # Make sure that the machine is turned off if instance.status not in ( instance.Status.TERMINATED.name, @@ -55,6 +62,7 @@ def add_extended_memory_to_instance( project=project_id, zone=zone, instance=instance_name ) operation_client.wait(project=project_id, zone=zone, operation=op.name) + start = time.time() while instance.status not in ( instance.Status.TERMINATED.name, instance.Status.STOPPED.name, @@ -64,10 +72,13 @@ def add_extended_memory_to_instance( project=project_id, zone=zone, instance=instance_name ) time.sleep(2) + if time.time() - start >= 300: # 5 minutes + raise TimeoutError() # Modify the machine definition, remember that extended memory is available only for N1, N2 and N2D CPUs start, end = instance.machine_type.rsplit("-", maxsplit=1) instance.machine_type = start + f"-{new_memory}-ext" + # TODO: If you prefer to use the CustomMachineType helper class, uncomment this code and comment the 2 lines above # Using CustomMachineType helper # cmt = CustomMachineType.from_str(instance.machine_type) # cmt.memory_mb = new_memory diff --git a/samples/snippets/instances/delete.py b/samples/snippets/instances/delete.py index be8c714fe..55cdfe9c7 100644 --- a/samples/snippets/instances/delete.py +++ b/samples/snippets/instances/delete.py @@ -21,6 +21,7 @@ # [START compute_instances_delete] import sys +import time from google.cloud import compute_v1 @@ -41,12 +42,16 @@ def delete_instance(project_id: str, zone: str, machine_name: str) -> None: operation = instance_client.delete_unary( project=project_id, zone=zone, instance=machine_name ) + start = time.time() while operation.status != compute_v1.Operation.Status.DONE: operation = operation_client.wait( operation=operation.name, zone=zone, project=project_id ) + if time.time() - start >= 300: # 5 minutes + raise TimeoutError() if operation.error: print("Error during deletion:", operation.error, file=sys.stderr) + return if operation.warnings: print("Warning during deletion:", operation.warnings, file=sys.stderr) print(f"Instance {machine_name} deleted.") diff --git a/samples/snippets/instances/delete_protection/create.py b/samples/snippets/instances/delete_protection/create.py index b4b21b7fc..32148a25f 100644 --- a/samples/snippets/instances/delete_protection/create.py +++ b/samples/snippets/instances/delete_protection/create.py @@ -22,12 +22,23 @@ # [START compute_delete_protection_create] import re import sys +import time from typing import List from google.cloud import compute_v1 def get_image_from_family(project: str, family: str) -> compute_v1.Image: + """ + Retrieve the newest image that is part of a given family in a project. + + Args: + project: project ID or project number of the Cloud project you want to get image from. + family: name of the image family you want to get image from. + + Returns: + An Image object. + """ image_client = compute_v1.ImagesClient() # List of public operating system (OS) images: https://cloud.google.com/compute/docs/images/os-details newest_image = image_client.get_from_family(project=project, family=family) @@ -35,7 +46,11 @@ def get_image_from_family(project: str, family: str) -> compute_v1.Image: def disk_from_image( - disk_type: str, disk_size_gb: int, boot: bool, source_image: str + disk_type: str, + disk_size_gb: int, + boot: bool, + source_image: str, + auto_delete: bool = False, ) -> compute_v1.AttachedDisk: """ Create an AttachedDisk object to be used in VM instance creation. Uses an image as the @@ -50,6 +65,7 @@ def disk_from_image( source_image: source image to use when creating this disk. You must have read access to this disk. This can be one of the publicly available images or an image from one of your projects. This value uses the following format: "projects/{project_name}/global/images/{image_name}" + auto_delete: boolean flag indicating whether this disk should be deleted with the VM that uses it Returns: AttachedDisk object configured to be created using the specified image. @@ -62,7 +78,7 @@ def disk_from_image( boot_disk.initialize_params = initialize_params # Remember to set auto_delete to True if you want the disk to be deleted when you delete # your VM instance. - boot_disk.auto_delete = True + boot_disk.auto_delete = auto_delete boot_disk.boot = boot return boot_disk @@ -75,6 +91,10 @@ def create_instance( machine_type: str = "n1-standard-1", network_link: str = "global/networks/default", subnetwork_link: str = None, + internal_ip: str = None, + external_access: bool = False, + external_ipv4: str = None, + accelerators: List[compute_v1.AcceleratorConfig] = None, preemptible: bool = False, custom_hostname: str = None, delete_protection: bool = False, @@ -86,17 +106,27 @@ def create_instance( project_id: project ID or project number of the Cloud project you want to use. zone: name of the zone to create the instance in. For example: "us-west3-b" instance_name: name of the new virtual machine (VM) instance. + disks: a list of compute_v1.AttachedDisk objects describing the disks + you want to attach to your new instance. machine_type: machine type of the VM being created. This value uses the following format: "zones/{zone}/machineTypes/{type_name}". For example: "zones/europe-west3-c/machineTypes/f1-micro" - disks: a list of compute_v1.AttachedDisk objects describing the disks - you want to attach to your new instance. network_link: name of the network you want the new instance to use. For example: "global/networks/default" represents the network named "default", which is created automatically for each project. subnetwork_link: name of the subnetwork you want the new instance to use. This value uses the following format: "regions/{region}/subnetworks/{subnetwork_name}" + internal_ip: internal IP address you want to assign to the new instance. + By default, a free address from the pool of available internal IP addresses of + used subnet will be used. + external_access: boolean flag indicating if the instance should have an external IPv4 + address assigned. + external_ipv4: external IPv4 address to be assigned to this instance. If you specify + an external IP address, it must live in the same region as the zone of the instance. + This setting requires `external_access` to be set to True to work. + accelerators: a list of AcceleratorConfig objects describing the accelerators that will + be attached to the new instance. preemptible: boolean value indicating if the new instance should be preemptible or not. custom_hostname: Custom hostname of the new VM instance. @@ -115,6 +145,18 @@ def create_instance( if subnetwork_link: network_interface.subnetwork = subnetwork_link + if internal_ip: + network_interface.network_i_p = internal_ip + + if external_access: + access = compute_v1.AccessConfig() + access.type_ = compute_v1.AccessConfig.Type.ONE_TO_ONE_NAT.name + access.name = "External NAT" + access.network_tier = access.NetworkTier.PREMIUM.name + if external_ipv4: + access.nat_i_p = external_ipv4 + network_interface.access_configs = [access] + # Collect information into the Instance object. instance = compute_v1.Instance() instance.name = instance_name @@ -124,6 +166,9 @@ def create_instance( else: instance.machine_type = f"zones/{zone}/machineTypes/{machine_type}" + if accelerators: + instance.guest_accelerators = accelerators + instance.network_interfaces = [network_interface] if preemptible: @@ -139,13 +184,6 @@ def create_instance( # Set the delete protection bit instance.deletion_protection = True - # Shielded Instance settings - # Values presented here are the defaults. - # instance.shielded_instance_config = compute_v1.ShieldedInstanceConfig() - # instance.shielded_instance_config.enable_secure_boot = False - # instance.shielded_instance_config.enable_vtpm = True - # instance.shielded_instance_config.enable_integrity_monitoring = True - # Prepare the request to insert an instance. request = compute_v1.InsertInstanceRequest() request.zone = zone @@ -156,12 +194,16 @@ def create_instance( print(f"Creating the {instance_name} instance in {zone}...") operation = instance_client.insert_unary(request=request) + start = time.time() while operation.status != compute_v1.Operation.Status.DONE: operation = operation_client.wait( operation=operation.name, zone=zone, project=project_id ) + if time.time() - start >= 300: # 5 minutes + raise TimeoutError() if operation.error: print("Error during creation:", operation.error, file=sys.stderr) + raise RuntimeError(operation.error) if operation.warnings: print("Warning during creation:", operation.warnings, file=sys.stderr) print(f"Instance {instance_name} created.") diff --git a/samples/snippets/instances/delete_protection/get.py b/samples/snippets/instances/delete_protection/get.py index d6ecfa398..35bf1dc1f 100644 --- a/samples/snippets/instances/delete_protection/get.py +++ b/samples/snippets/instances/delete_protection/get.py @@ -31,7 +31,7 @@ def get_delete_protection(project_id: str, zone: str, instance_name: str) -> boo zone: name of the zone you want to use. For example: “us-west3-b” instance_name: name of the virtual machine to check. Returns: - The state of the delete protection setting. + The boolean value of the delete protection setting. """ instance_client = compute_v1.InstancesClient() instance = instance_client.get( diff --git a/samples/snippets/instances/delete_protection/set.py b/samples/snippets/instances/delete_protection/set.py index e25269317..47c3b35ba 100644 --- a/samples/snippets/instances/delete_protection/set.py +++ b/samples/snippets/instances/delete_protection/set.py @@ -25,13 +25,13 @@ def set_delete_protection( project_id: str, zone: str, instance_name: str, delete_protection: bool -): +) -> None: """ Updates the delete protection setting of given instance. Args: project_id: project ID or project number of the Cloud project you want to use. zone: name of the zone you want to use. For example: “us-west3-b” - instance_name: name of the virtual machine to update. + instance_name: name of the instance to update. delete_protection: boolean value indicating if the virtual machine should be protected against deletion or not. """ diff --git a/samples/snippets/instances/list_all.py b/samples/snippets/instances/list_all.py index 9549de0f4..3bfda0b9a 100644 --- a/samples/snippets/instances/list_all.py +++ b/samples/snippets/instances/list_all.py @@ -29,7 +29,7 @@ def list_all_instances( project_id: str, ) -> Dict[str, Iterable[compute_v1.Instance]]: """ - Return a dictionary of all instances present in a project, grouped by their zone. + Returns a dictionary of all instances present in a project, grouped by their zone. Args: project_id: project ID or project number of the Cloud project you want to use. @@ -38,9 +38,9 @@ def list_all_instances( iterable collections of Instance objects as values. """ instance_client = compute_v1.InstancesClient() - # Use the `max_results` parameter to limit the number of results that the API returns per response page. request = compute_v1.AggregatedListInstancesRequest() request.project = project_id + # Use the `max_results` parameter to limit the number of results that the API returns per response page. request.max_results = 50 agg_list = instance_client.aggregated_list(request=request) diff --git a/samples/snippets/instances/preemptible/create_preemptible.py b/samples/snippets/instances/preemptible/create_preemptible.py index 2f4569bc8..3fd4de32d 100644 --- a/samples/snippets/instances/preemptible/create_preemptible.py +++ b/samples/snippets/instances/preemptible/create_preemptible.py @@ -22,12 +22,23 @@ # [START compute_preemptible_create] import re import sys +import time from typing import List from google.cloud import compute_v1 def get_image_from_family(project: str, family: str) -> compute_v1.Image: + """ + Retrieve the newest image that is part of a given family in a project. + + Args: + project: project ID or project number of the Cloud project you want to get image from. + family: name of the image family you want to get image from. + + Returns: + An Image object. + """ image_client = compute_v1.ImagesClient() # List of public operating system (OS) images: https://cloud.google.com/compute/docs/images/os-details newest_image = image_client.get_from_family(project=project, family=family) @@ -35,7 +46,11 @@ def get_image_from_family(project: str, family: str) -> compute_v1.Image: def disk_from_image( - disk_type: str, disk_size_gb: int, boot: bool, source_image: str + disk_type: str, + disk_size_gb: int, + boot: bool, + source_image: str, + auto_delete: bool = False, ) -> compute_v1.AttachedDisk: """ Create an AttachedDisk object to be used in VM instance creation. Uses an image as the @@ -50,6 +65,7 @@ def disk_from_image( source_image: source image to use when creating this disk. You must have read access to this disk. This can be one of the publicly available images or an image from one of your projects. This value uses the following format: "projects/{project_name}/global/images/{image_name}" + auto_delete: boolean flag indicating whether this disk should be deleted with the VM that uses it Returns: AttachedDisk object configured to be created using the specified image. @@ -62,7 +78,7 @@ def disk_from_image( boot_disk.initialize_params = initialize_params # Remember to set auto_delete to True if you want the disk to be deleted when you delete # your VM instance. - boot_disk.auto_delete = True + boot_disk.auto_delete = auto_delete boot_disk.boot = boot return boot_disk @@ -75,6 +91,10 @@ def create_instance( machine_type: str = "n1-standard-1", network_link: str = "global/networks/default", subnetwork_link: str = None, + internal_ip: str = None, + external_access: bool = False, + external_ipv4: str = None, + accelerators: List[compute_v1.AcceleratorConfig] = None, preemptible: bool = False, custom_hostname: str = None, delete_protection: bool = False, @@ -86,17 +106,27 @@ def create_instance( project_id: project ID or project number of the Cloud project you want to use. zone: name of the zone to create the instance in. For example: "us-west3-b" instance_name: name of the new virtual machine (VM) instance. + disks: a list of compute_v1.AttachedDisk objects describing the disks + you want to attach to your new instance. machine_type: machine type of the VM being created. This value uses the following format: "zones/{zone}/machineTypes/{type_name}". For example: "zones/europe-west3-c/machineTypes/f1-micro" - disks: a list of compute_v1.AttachedDisk objects describing the disks - you want to attach to your new instance. network_link: name of the network you want the new instance to use. For example: "global/networks/default" represents the network named "default", which is created automatically for each project. subnetwork_link: name of the subnetwork you want the new instance to use. This value uses the following format: "regions/{region}/subnetworks/{subnetwork_name}" + internal_ip: internal IP address you want to assign to the new instance. + By default, a free address from the pool of available internal IP addresses of + used subnet will be used. + external_access: boolean flag indicating if the instance should have an external IPv4 + address assigned. + external_ipv4: external IPv4 address to be assigned to this instance. If you specify + an external IP address, it must live in the same region as the zone of the instance. + This setting requires `external_access` to be set to True to work. + accelerators: a list of AcceleratorConfig objects describing the accelerators that will + be attached to the new instance. preemptible: boolean value indicating if the new instance should be preemptible or not. custom_hostname: Custom hostname of the new VM instance. @@ -115,6 +145,18 @@ def create_instance( if subnetwork_link: network_interface.subnetwork = subnetwork_link + if internal_ip: + network_interface.network_i_p = internal_ip + + if external_access: + access = compute_v1.AccessConfig() + access.type_ = compute_v1.AccessConfig.Type.ONE_TO_ONE_NAT.name + access.name = "External NAT" + access.network_tier = access.NetworkTier.PREMIUM.name + if external_ipv4: + access.nat_i_p = external_ipv4 + network_interface.access_configs = [access] + # Collect information into the Instance object. instance = compute_v1.Instance() instance.name = instance_name @@ -124,6 +166,9 @@ def create_instance( else: instance.machine_type = f"zones/{zone}/machineTypes/{machine_type}" + if accelerators: + instance.guest_accelerators = accelerators + instance.network_interfaces = [network_interface] if preemptible: @@ -139,13 +184,6 @@ def create_instance( # Set the delete protection bit instance.deletion_protection = True - # Shielded Instance settings - # Values presented here are the defaults. - # instance.shielded_instance_config = compute_v1.ShieldedInstanceConfig() - # instance.shielded_instance_config.enable_secure_boot = False - # instance.shielded_instance_config.enable_vtpm = True - # instance.shielded_instance_config.enable_integrity_monitoring = True - # Prepare the request to insert an instance. request = compute_v1.InsertInstanceRequest() request.zone = zone @@ -156,12 +194,16 @@ def create_instance( print(f"Creating the {instance_name} instance in {zone}...") operation = instance_client.insert_unary(request=request) + start = time.time() while operation.status != compute_v1.Operation.Status.DONE: operation = operation_client.wait( operation=operation.name, zone=zone, project=project_id ) + if time.time() - start >= 300: # 5 minutes + raise TimeoutError() if operation.error: print("Error during creation:", operation.error, file=sys.stderr) + raise RuntimeError(operation.error) if operation.warnings: print("Warning during creation:", operation.warnings, file=sys.stderr) print(f"Instance {instance_name} created.") diff --git a/samples/snippets/instances/reset.py b/samples/snippets/instances/reset.py index 74bb94c2f..a04003f17 100644 --- a/samples/snippets/instances/reset.py +++ b/samples/snippets/instances/reset.py @@ -20,10 +20,12 @@ # [START compute_reset_instance] +import time + from google.cloud import compute_v1 -def reset_instance(project_id: str, zone: str, instance_name: str): +def reset_instance(project_id: str, zone: str, instance_name: str) -> None: """ Resets a stopped Google Compute Engine instance (with unencrypted disks). Args: @@ -38,8 +40,11 @@ def reset_instance(project_id: str, zone: str, instance_name: str): project=project_id, zone=zone, instance=instance_name ) + start = time.time() while op.status != compute_v1.Operation.Status.DONE: op = op_client.wait(operation=op.name, zone=zone, project=project_id) + if time.time() - start >= 300: # 5 minutes + raise TimeoutError() return diff --git a/samples/snippets/instances/start.py b/samples/snippets/instances/start.py index 9de984bef..4548a8cd9 100644 --- a/samples/snippets/instances/start.py +++ b/samples/snippets/instances/start.py @@ -20,10 +20,12 @@ # [START compute_start_instance] +import time + from google.cloud import compute_v1 -def start_instance(project_id: str, zone: str, instance_name: str): +def start_instance(project_id: str, zone: str, instance_name: str) -> None: """ Starts a stopped Google Compute Engine instance (with unencrypted disks). Args: @@ -38,8 +40,11 @@ def start_instance(project_id: str, zone: str, instance_name: str): project=project_id, zone=zone, instance=instance_name ) + start = time.time() while op.status != compute_v1.Operation.Status.DONE: op = op_client.wait(operation=op.name, zone=zone, project=project_id) + if time.time() - start >= 300: # 5 minutes + raise TimeoutError() return diff --git a/samples/snippets/instances/start_encrypted.py b/samples/snippets/instances/start_encrypted.py index c0d5c14e8..401b2b0cc 100644 --- a/samples/snippets/instances/start_encrypted.py +++ b/samples/snippets/instances/start_encrypted.py @@ -20,6 +20,8 @@ # [START compute_start_enc_instance] +import time + from google.cloud import compute_v1 @@ -60,8 +62,11 @@ def start_instance_with_encryption_key( instances_start_with_encryption_key_request_resource=enc_data, ) + start = time.time() while op.status != compute_v1.Operation.Status.DONE: op = op_client.wait(operation=op.name, zone=zone, project=project_id) + if time.time() - start >= 300: # 5 minutes + raise TimeoutError() return diff --git a/samples/snippets/instances/stop.py b/samples/snippets/instances/stop.py index cf155c74c..b8b2f8b4e 100644 --- a/samples/snippets/instances/stop.py +++ b/samples/snippets/instances/stop.py @@ -20,12 +20,14 @@ # [START compute_stop_instance] +import time + from google.cloud import compute_v1 -def stop_instance(project_id: str, zone: str, instance_name: str): +def stop_instance(project_id: str, zone: str, instance_name: str) -> None: """ - Stops a stopped Google Compute Engine instance. + Stops a running Google Compute Engine instance. Args: project_id: project ID or project number of the Cloud project your instance belongs to. zone: name of the zone your instance belongs to. @@ -38,8 +40,11 @@ def stop_instance(project_id: str, zone: str, instance_name: str): project=project_id, zone=zone, instance=instance_name ) + start = time.time() while op.status != compute_v1.Operation.Status.DONE: op = op_client.wait(operation=op.name, zone=zone, project=project_id) + if time.time() - start >= 300: # 5 minutes + raise TimeoutError() return diff --git a/samples/snippets/snapshots/__init__.py b/samples/snippets/snapshots/__init__.py new file mode 100644 index 000000000..4bbe0ffdb --- /dev/null +++ b/samples/snippets/snapshots/__init__.py @@ -0,0 +1,13 @@ +# Copyright 2022 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. diff --git a/samples/snippets/snapshots/create.py b/samples/snippets/snapshots/create.py new file mode 100644 index 000000000..adfdf8e28 --- /dev/null +++ b/samples/snippets/snapshots/create.py @@ -0,0 +1,67 @@ +# Copyright 2022 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. +# flake8: noqa + + +# This file is automatically generated. Please do not modify it directly. +# Find the relevant recipe file in the samples/recipes or samples/ingredients +# directory and apply your changes there. + + +# [START compute_snapshot_create] +import sys + +from google.cloud import compute_v1 + + +def create_snapshot( + project_id: str, zone: str, disk_name: str, snapshot_name: str +) -> compute_v1.Snapshot: + """ + Create a snapshot of a disk. + + Args: + project_id: project ID or project number of the Cloud project you want to use. + zone: name of the zone in which is the disk you want to snapshot. + disk_name: name of the disk you want to snapshot. + snapshot_name: name of the snapshot to be created. + + Returns: + The new snapshot instance. + """ + disk_client = compute_v1.DisksClient() + disk = disk_client.get(project=project_id, zone=zone, disk=disk_name) + snapshot = compute_v1.Snapshot() + snapshot.source_disk = disk.self_link + snapshot.name = snapshot_name + + snapshot_client = compute_v1.SnapshotsClient() + operation = snapshot_client.insert_unary( + project=project_id, snapshot_resource=snapshot + ) + op_client = compute_v1.GlobalOperationsClient() + operation = op_client.wait(project=project_id, operation=operation.name) + + if operation.error: + print("Error during snapshot creation:", operation.error, file=sys.stderr) + raise RuntimeError(operation.error) + if operation.warnings: + print("Warnings during snapshot creation:\n", file=sys.stderr) + for warning in operation.warnings: + print(f" - {warning.code}: {warning.message}", file=sys.stderr) + + return snapshot_client.get(project=project_id, snapshot=snapshot_name) + + +# [END compute_snapshot_create] diff --git a/samples/snippets/snapshots/delete.py b/samples/snippets/snapshots/delete.py new file mode 100644 index 000000000..ffa0abab5 --- /dev/null +++ b/samples/snippets/snapshots/delete.py @@ -0,0 +1,54 @@ +# Copyright 2022 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. +# flake8: noqa + + +# This file is automatically generated. Please do not modify it directly. +# Find the relevant recipe file in the samples/recipes or samples/ingredients +# directory and apply your changes there. + + +# [START compute_snapshot_delete] +import sys +from typing import NoReturn + +from google.cloud import compute_v1 + + +def delete_snapshot(project_id: str, snapshot_name: str) -> NoReturn: + """ + Delete a snapshot of a disk. + + Args: + project_id: project ID or project number of the Cloud project you want to use. + snapshot_name: name of the snapshot to delete. + """ + + snapshot_client = compute_v1.SnapshotsClient() + operation = snapshot_client.delete_unary(project=project_id, snapshot=snapshot_name) + op_client = compute_v1.GlobalOperationsClient() + operation = op_client.wait(project=project_id, operation=operation.name) + + if operation.error: + print("Error during snapshot deletion:", operation.error, file=sys.stderr) + raise RuntimeError(operation.error) + if operation.warnings: + print("Warnings during snapshot deletion:\n", file=sys.stderr) + for warning in operation.warnings: + print(f" - {warning.code}: {warning.message}", file=sys.stderr) + + return + + +# [END compute_snapshot_delete] diff --git a/samples/snippets/snapshots/list.py b/samples/snippets/snapshots/list.py new file mode 100644 index 000000000..f7db91dbb --- /dev/null +++ b/samples/snippets/snapshots/list.py @@ -0,0 +1,49 @@ +# Copyright 2022 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. +# flake8: noqa + + +# This file is automatically generated. Please do not modify it directly. +# Find the relevant recipe file in the samples/recipes or samples/ingredients +# directory and apply your changes there. + + +# [START compute_snapshot_list] +from typing import Iterable + +from google.cloud import compute_v1 + + +def list_snapshots(project_id: str, filter_: str = "") -> Iterable[compute_v1.Snapshot]: + """ + List snapshots from a project. + + Args: + project_id: project ID or project number of the Cloud project you want to use. + filter_: filter to be applied when listing snapshots. Learn more about filters here: + https://cloud.google.com/python/docs/reference/compute/latest/google.cloud.compute_v1.types.ListSnapshotsRequest + + Returns: + An iterable containing all Snapshots that match the provided filter. + """ + + snapshot_client = compute_v1.SnapshotsClient() + request = compute_v1.ListSnapshotsRequest() + request.project = project_id + request.filter = filter_ + + return snapshot_client.list(request) + + +# [END compute_snapshot_list] diff --git a/samples/snippets/tests/test_sample_create_vm.py b/samples/snippets/tests/test_create_vm.py similarity index 98% rename from samples/snippets/tests/test_sample_create_vm.py rename to samples/snippets/tests/test_create_vm.py index b08617f6e..5497f233b 100644 --- a/samples/snippets/tests/test_sample_create_vm.py +++ b/samples/snippets/tests/test_create_vm.py @@ -152,10 +152,10 @@ def test_create_with_additional_disk(self): instance = create_with_additional_disk(PROJECT, INSTANCE_ZONE, instance_name) try: assert any( - disk.initialize_params.disk_size_gb == 11 for disk in instance.disks + disk.initialize_params.disk_size_gb == 20 for disk in instance.disks ) assert any( - disk.initialize_params.disk_size_gb == 10 for disk in instance.disks + disk.initialize_params.disk_size_gb == 25 for disk in instance.disks ) assert len(instance.disks) == 2 finally: diff --git a/samples/snippets/tests/test_sample_custom_types.py b/samples/snippets/tests/test_custom_types.py similarity index 100% rename from samples/snippets/tests/test_sample_custom_types.py rename to samples/snippets/tests/test_custom_types.py diff --git a/samples/snippets/tests/test_sample_default_values.py b/samples/snippets/tests/test_default_values.py similarity index 100% rename from samples/snippets/tests/test_sample_default_values.py rename to samples/snippets/tests/test_default_values.py diff --git a/samples/snippets/tests/test_disks.py b/samples/snippets/tests/test_disks.py new file mode 100644 index 000000000..e0d367554 --- /dev/null +++ b/samples/snippets/tests/test_disks.py @@ -0,0 +1,59 @@ +# Copyright 2022 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. +import uuid + +from google.api_core.exceptions import NotFound +import google.auth +import pytest + +from ..disks.create_from_image import create_disk_from_image +from ..disks.delete import delete_disk +from ..disks.list import list_disks +from ..images.get import get_image_from_family + +PROJECT = google.auth.default()[1] +ZONE = 'europe-north1-c' + + +@pytest.fixture() +def autodelete_disk_name(): + disk_name = "test-disk-" + uuid.uuid4().hex[:10] + yield disk_name + try: + delete_disk(PROJECT, ZONE, disk_name) + except NotFound: + # The disk was already deleted + pass + + +def test_disk_create_delete(autodelete_disk_name): + disk_type = f"zones/{ZONE}/diskTypes/pd-standard" + debian_image = get_image_from_family('debian-cloud', 'debian-11') + + disk = create_disk_from_image(PROJECT, ZONE, autodelete_disk_name, disk_type, 17, debian_image.self_link) + assert(disk.name == autodelete_disk_name) + assert(disk.type_.endswith(disk_type)) + assert(disk.size_gb == 17) + + for i_disk in list_disks(PROJECT, ZONE): + if i_disk.name == autodelete_disk_name: + break + else: + pytest.fail("Couldn't find newly created disk on the disk list.") + + delete_disk(PROJECT, ZONE, autodelete_disk_name) + + for i_disk in list_disks(PROJECT, ZONE): + if i_disk.name == autodelete_disk_name: + pytest.fail("Found a disk that should be deleted on the disk list.") diff --git a/samples/snippets/tests/test_sample_firewall.py b/samples/snippets/tests/test_firewall.py similarity index 100% rename from samples/snippets/tests/test_sample_firewall.py rename to samples/snippets/tests/test_firewall.py diff --git a/samples/snippets/tests/test_sample_images.py b/samples/snippets/tests/test_images.py similarity index 100% rename from samples/snippets/tests/test_sample_images.py rename to samples/snippets/tests/test_images.py diff --git a/samples/snippets/tests/test_sample_instance_from_template.py b/samples/snippets/tests/test_instance_from_template.py similarity index 100% rename from samples/snippets/tests/test_sample_instance_from_template.py rename to samples/snippets/tests/test_instance_from_template.py diff --git a/samples/snippets/tests/test_sample_start_stop.py b/samples/snippets/tests/test_instance_start_stop.py similarity index 100% rename from samples/snippets/tests/test_sample_start_stop.py rename to samples/snippets/tests/test_instance_start_stop.py diff --git a/samples/snippets/tests/test_sample_pagination.py b/samples/snippets/tests/test_pagination.py similarity index 100% rename from samples/snippets/tests/test_sample_pagination.py rename to samples/snippets/tests/test_pagination.py diff --git a/samples/snippets/tests/test_snapshots.py b/samples/snippets/tests/test_snapshots.py new file mode 100644 index 000000000..47c2f5f1d --- /dev/null +++ b/samples/snippets/tests/test_snapshots.py @@ -0,0 +1,58 @@ +# Copyright 2022 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. +import uuid + +import google.auth +import pytest + +from ..disks.create_from_image import create_disk_from_image +from ..disks.delete import delete_disk +from ..images.get import get_image_from_family +from ..snapshots.create import create_snapshot +from ..snapshots.delete import delete_snapshot +from ..snapshots.list import list_snapshots + +PROJECT = google.auth.default()[1] +ZONE = 'europe-north1-c' + + +@pytest.fixture +def test_disk(): + debian_image = get_image_from_family('debian-cloud', 'debian-11') + test_disk_name = "test-disk-" + uuid.uuid4().hex[:10] + + disk_type = f"zones/{ZONE}/diskTypes/pd-standard" + + disk = create_disk_from_image(PROJECT, ZONE, test_disk_name, disk_type, 20, debian_image.self_link) + + yield disk + + delete_disk(PROJECT, ZONE, test_disk_name) + + +def test_snapshot_create_delete(test_disk): + snapshot_name = "test-snapshot-" + uuid.uuid4().hex[:10] + snapshot = create_snapshot(PROJECT, ZONE, test_disk.name, snapshot_name) + assert(snapshot.name == snapshot_name) + assert(snapshot.source_disk == test_disk.self_link) + for i_snapshot in list_snapshots(PROJECT): + if i_snapshot.name == snapshot_name: + break + else: + pytest.fail("Couldn't find the created snapshot on snapshot list.") + + delete_snapshot(PROJECT, snapshot_name) + for i_snapshot in list_snapshots(PROJECT): + if i_snapshot.name == snapshot_name: + pytest.fail("Test snapshot found on snapshot list, while it should already be gone.") diff --git a/samples/snippets/tests/test_sample_templates.py b/samples/snippets/tests/test_templates.py similarity index 98% rename from samples/snippets/tests/test_sample_templates.py rename to samples/snippets/tests/test_templates.py index 624a6f017..bf04fa12b 100644 --- a/samples/snippets/tests/test_sample_templates.py +++ b/samples/snippets/tests/test_templates.py @@ -19,7 +19,7 @@ # Turning off F401 check because flake8 doesn't recognize using # PyTest fixture as parameter as usage. -from .test_sample_start_stop import compute_instance # noqa: F401 +from .test_instance_start_stop import compute_instance # noqa: F401 from ..instance_templates.create import create_template from ..instance_templates.create_from_instance import \ diff --git a/samples/snippets/usage_report/usage_reports.py b/samples/snippets/usage_report/usage_reports.py index 54af6034b..85e5ea9cd 100644 --- a/samples/snippets/usage_report/usage_reports.py +++ b/samples/snippets/usage_report/usage_reports.py @@ -14,7 +14,7 @@ # flake8: noqa """ A sample script showing how to handle default values when communicating -with the Compute Engine API. +with the Compute Engine API and how to configure usage reports using the API. """ # This file is automatically generated. Please do not modify it directly. From 05ddcf7414765f3a13c8e19b5e69b5d3b361032b Mon Sep 17 00:00:00 2001 From: Maciej Strzelczyk Date: Fri, 25 Mar 2022 18:07:09 +0100 Subject: [PATCH 07/17] chore(readme): Updating readme with PyCharm code completion info (#246) --- README.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.rst b/README.rst index 919ed5678..62edb195a 100644 --- a/README.rst +++ b/README.rst @@ -68,6 +68,15 @@ Windows \Scripts\activate \Scripts\pip.exe install google-cloud-compute + +PyCharm/JetBrains IDEs +~~~~~~~~~~~~~~~~~~~~~~ +Since the library has grown in size, the files it consists of have outgrown the [default size limit of ~2.5Mb](https://www.jetbrains.com/help/pycharm/file-idea-properties.html). +As a result, the code completion in JetBrains products can fail to work with the classes from our library. To +fix this, you need to update the `idea.max.intellisense.filesize` setting in custom properties +(Help -> Edit custom properties...). Just add a line like `idea.max.intellisense.filesize = 10000` to change this +limit to ~10Mb. + Next Steps ~~~~~~~~~~ From 9d22f0d7fa14eea52d17c1df4d55358e747f0831 Mon Sep 17 00:00:00 2001 From: Maciej Strzelczyk Date: Sat, 26 Mar 2022 12:26:17 +0100 Subject: [PATCH 08/17] docs(samples): Add samples for moving VM to different regions/zones (#244) Co-authored-by: Anthonios Partheniou --- .../ingredients/disks/create_empty_disk.py | 63 ++++++ .../ingredients/disks/disk_from_snapshot.py | 2 +- samples/ingredients/disks/empty_disk.py | 6 +- samples/ingredients/disks/from_image.py | 2 +- samples/ingredients/disks/get.py | 37 +++ .../ingredients/instances/create_instance.py | 2 +- .../create_from_custom_image.py | 21 +- .../create_from_public_image.py | 2 +- .../create_with_existing_disks.py | 50 +++++ samples/ingredients/instances/get.py | 39 ++++ samples/recipes/disks/create_empty_disk.py | 21 ++ .../create_with_existing_disks.py | 27 +++ samples/recipes/instances/get.py | 20 ++ samples/snippets/disks/create_empty_disk.py | 72 ++++++ samples/snippets/instances/create.py | 4 +- .../create_from_custom_image.py | 6 +- .../create_from_public_image.py | 6 +- .../create_from_snapshot.py | 4 +- .../create_with_additional_disk.py | 10 +- .../create_with_existing_disks.py | 200 +++++++++++++++++ .../create_with_snapshotted_data_disk.py | 6 +- .../snippets/instances/create_with_subnet.py | 4 +- .../instances/custom_hostname/create.py | 4 +- .../create_shared_with_helper.py | 4 +- .../create_with_helper.py | 4 +- .../create_without_helper.py | 4 +- .../extra_mem_no_helper.py | 4 +- .../instances/delete_protection/create.py | 4 +- samples/snippets/instances/get.py | 45 ++++ .../preemptible/create_preemptible.py | 4 +- samples/snippets/tests/test_create_vm.py | 210 +++++++++++------- 31 files changed, 745 insertions(+), 142 deletions(-) create mode 100644 samples/ingredients/disks/create_empty_disk.py create mode 100644 samples/ingredients/disks/get.py create mode 100644 samples/ingredients/instances/create_start_instance/create_with_existing_disks.py create mode 100644 samples/ingredients/instances/get.py create mode 100644 samples/recipes/disks/create_empty_disk.py create mode 100644 samples/recipes/instances/create_start_instance/create_with_existing_disks.py create mode 100644 samples/recipes/instances/get.py create mode 100644 samples/snippets/disks/create_empty_disk.py create mode 100644 samples/snippets/instances/create_start_instance/create_with_existing_disks.py create mode 100644 samples/snippets/instances/get.py diff --git a/samples/ingredients/disks/create_empty_disk.py b/samples/ingredients/disks/create_empty_disk.py new file mode 100644 index 000000000..7422caf45 --- /dev/null +++ b/samples/ingredients/disks/create_empty_disk.py @@ -0,0 +1,63 @@ +# Copyright 2022 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 is an ingredient file. It is not meant to be run directly. Check the samples/snippets +# folder for complete code samples that are ready to be used. +# Disabling flake8 for the ingredients file, as it would fail F821 - undefined name check. +# flake8: noqa +import sys + +from google.cloud import compute_v1 + + +# +def create_empty_disk( + project_id: str, zone: str, disk_name: str, disk_type: str, disk_size_gb: int +) -> compute_v1.Disk: + """ + Creates a new empty disk in a project in given zone. + + Args: + project_id: project ID or project number of the Cloud project you want to use. + zone: name of the zone in which you want to create the disk. + disk_name: name of the disk you want to create. + disk_type: the type of disk you want to create. This value uses the following format: + "zones/{zone}/diskTypes/(pd-standard|pd-ssd|pd-balanced|pd-extreme)". + For example: "zones/us-west3-b/diskTypes/pd-ssd" + disk_size_gb: size of the new disk in gigabytes + + Returns: + An unattached Disk instance. + """ + disk = compute_v1.Disk() + disk.size_gb = disk_size_gb + disk.name = disk_name + disk.zone = zone + disk.type_ = disk_type + + disk_client = compute_v1.DisksClient() + operation = disk_client.insert_unary(project=project_id, zone=zone, disk_resource=disk) + operation_client = compute_v1.ZoneOperationsClient() + operation = operation_client.wait(project=project_id, zone=zone, operation=operation.name) + + if operation.error: + print("Error during disk creation:", operation.error, file=sys.stderr) + raise RuntimeError(operation.error) + if operation.warnings: + print("Warnings during disk creation:\n", file=sys.stderr) + for warning in operation.warnings: + print(f" - {warning.code}: {warning.message}", file=sys.stderr) + + return disk_client.get(project=project_id, zone=zone, disk=disk.name) +# diff --git a/samples/ingredients/disks/disk_from_snapshot.py b/samples/ingredients/disks/disk_from_snapshot.py index e0271c47b..f7abd0c5a 100644 --- a/samples/ingredients/disks/disk_from_snapshot.py +++ b/samples/ingredients/disks/disk_from_snapshot.py @@ -21,7 +21,7 @@ # def disk_from_snapshot( - disk_type: str, disk_size_gb: int, boot: bool, source_snapshot: str, auto_delete: bool = False + disk_type: str, disk_size_gb: int, boot: bool, source_snapshot: str, auto_delete: bool = True ) -> compute_v1.AttachedDisk(): """ Create an AttachedDisk object to be used in VM instance creation. Uses a disk snapshot as the diff --git a/samples/ingredients/disks/empty_disk.py b/samples/ingredients/disks/empty_disk.py index 570292fde..70c677b7d 100644 --- a/samples/ingredients/disks/empty_disk.py +++ b/samples/ingredients/disks/empty_disk.py @@ -20,7 +20,7 @@ # -def empty_disk(disk_type: str, disk_size_gb: int, boot: bool = False, auto_delete: bool = False) -> compute_v1.AttachedDisk(): +def empty_disk(disk_type: str, disk_size_gb: int, boot: bool = False, auto_delete: bool = True) -> compute_v1.AttachedDisk(): """ Create an AttachedDisk object to be used in VM instance creation. The created disk contains no data and requires formatting before it can be used. @@ -43,7 +43,7 @@ def empty_disk(disk_type: str, disk_size_gb: int, boot: bool = False, auto_delet disk.initialize_params = initialize_params # Remember to set auto_delete to True if you want the disk to be deleted when you delete # your VM instance. - disk.auto_delete = True - disk.boot = False + disk.auto_delete = auto_delete + disk.boot = boot return disk # diff --git a/samples/ingredients/disks/from_image.py b/samples/ingredients/disks/from_image.py index 5f22f4e61..945b018b9 100644 --- a/samples/ingredients/disks/from_image.py +++ b/samples/ingredients/disks/from_image.py @@ -21,7 +21,7 @@ # def disk_from_image( - disk_type: str, disk_size_gb: int, boot: bool, source_image: str, auto_delete: bool = False + disk_type: str, disk_size_gb: int, boot: bool, source_image: str, auto_delete: bool = True ) -> compute_v1.AttachedDisk: """ Create an AttachedDisk object to be used in VM instance creation. Uses an image as the diff --git a/samples/ingredients/disks/get.py b/samples/ingredients/disks/get.py new file mode 100644 index 000000000..54b68d9d4 --- /dev/null +++ b/samples/ingredients/disks/get.py @@ -0,0 +1,37 @@ +# Copyright 2022 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 is an ingredient file. It is not meant to be run directly. Check the samples/snippets +# folder for complete code samples that are ready to be used. +# Disabling flake8 for the ingredients file, as it would fail F821 - undefined name check. +# flake8: noqa +import sys +from typing import NoReturn, Iterable + +from google.cloud import compute_v1 + + +# +def get_disk(project_id: str, zone: str, disk_name: str) -> compute_v1.Disk: + """ + Gets a disk from a project. + + Args: + project_id: project ID or project number of the Cloud project you want to use. + zone: name of the zone where the disk exists. + disk_name: name of the disk you want to retrieve. + """ + disk_client = compute_v1.DisksClient() + return disk_client.get(project=project_id, zone=zone, disk=disk_name) +# diff --git a/samples/ingredients/instances/create_instance.py b/samples/ingredients/instances/create_instance.py index 99fad23e4..17ab8319b 100644 --- a/samples/ingredients/instances/create_instance.py +++ b/samples/ingredients/instances/create_instance.py @@ -149,5 +149,5 @@ def create_instance( if operation.warnings: print("Warning during creation:", operation.warnings, file=sys.stderr) print(f"Instance {instance_name} created.") - return instance + return instance_client.get(project=project_id, zone=zone, instance=instance_name) # diff --git a/samples/ingredients/instances/create_start_instance/create_from_custom_image.py b/samples/ingredients/instances/create_start_instance/create_from_custom_image.py index 2d297cbca..1195b7587 100644 --- a/samples/ingredients/instances/create_start_instance/create_from_custom_image.py +++ b/samples/ingredients/instances/create_start_instance/create_from_custom_image.py @@ -1,22 +1,3 @@ -# Copyright 2022 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 is an ingredient file. It is not meant to be run directly. Check the samples/snippets -# folder for complete code samples that are ready to be used. -# Disabling flake8 for the ingredients file, as it would fail F821 - undefined name check. -# flake8: noqa -# # 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 @@ -55,7 +36,7 @@ def create_from_custom_image( Instance object. """ disk_type = f"zones/{zone}/diskTypes/pd-standard" - disks = [disk_from_image(disk_type, 10, True, custom_image_link)] + disks = [disk_from_image(disk_type, 10, True, custom_image_link, True)] instance = create_instance(project_id, zone, instance_name, disks) return instance # diff --git a/samples/ingredients/instances/create_start_instance/create_from_public_image.py b/samples/ingredients/instances/create_start_instance/create_from_public_image.py index 2eb8e3c2e..fdf2e35f7 100644 --- a/samples/ingredients/instances/create_start_instance/create_from_public_image.py +++ b/samples/ingredients/instances/create_start_instance/create_from_public_image.py @@ -36,7 +36,7 @@ def create_from_public_image(project_id: str, zone: str, instance_name: str) -> project="debian-cloud", family="debian-10" ) disk_type = f"zones/{zone}/diskTypes/pd-standard" - disks = [disk_from_image(disk_type, 10, True, newest_debian.self_link)] + disks = [disk_from_image(disk_type, 10, True, newest_debian.self_link, True)] instance = create_instance(project_id, zone, instance_name, disks) return instance # diff --git a/samples/ingredients/instances/create_start_instance/create_with_existing_disks.py b/samples/ingredients/instances/create_start_instance/create_with_existing_disks.py new file mode 100644 index 000000000..2affc851d --- /dev/null +++ b/samples/ingredients/instances/create_start_instance/create_with_existing_disks.py @@ -0,0 +1,50 @@ +# Copyright 2022 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 is an ingredient file. It is not meant to be run directly. Check the samples/snippets +# folder for complete code samples that are ready to be used. +# Disabling flake8 for the ingredients file, as it would fail F821 - undefined name check. +# flake8: noqa +from typing import List + +from google.cloud import compute_v1 + + +# +def create_with_existing_disks(project_id: str, zone: str, instance_name: str, disk_names: List[str]) -> compute_v1.Instance: + """ + Create a new VM instance using selected disks. The first disk in disk_names will + be used as boot disk. + + Args: + project_id: project ID or project number of the Cloud project you want to use. + zone: name of the zone to create the instance in. For example: "us-west3-b" + instance_name: name of the new virtual machine (VM) instance. + disk_names: list of disk names to be attached to the new virtual machine. + First disk in this list will be used as the boot device. + + Returns: + Instance object. + """ + assert(len(disk_names) >= 1) + disks = [get_disk(project_id, zone, disk_name) for disk_name in disk_names] + attached_disks = [] + for disk in disks: + adisk = compute_v1.AttachedDisk() + adisk.source = disk.self_link + attached_disks.append(adisk) + attached_disks[0].boot = True + instance = create_instance(project_id, zone, instance_name, attached_disks) + return instance +# diff --git a/samples/ingredients/instances/get.py b/samples/ingredients/instances/get.py new file mode 100644 index 000000000..702696ad7 --- /dev/null +++ b/samples/ingredients/instances/get.py @@ -0,0 +1,39 @@ +# Copyright 2022 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 is an ingredient file. It is not meant to be run directly. Check the samples/snippets +# folder for complete code samples that are ready to be used. +# Disabling flake8 for the ingredients file, as it would fail F821 - undefined name check. +# flake8: noqa +from google.cloud import compute_v1 + + +# +def get_instance(project_id: str, zone: str, instance_name: str) -> compute_v1.Instance: + """ + Get information about a VM instance in the given zone in the specified project. + + Args: + project_id: project ID or project number of the Cloud project you want to use. + zone: name of the zone you want to use. For example: “us-west3-b” + instance_name: name of the VM instance you want to query. + Returns: + An Instance object. + """ + instance_client = compute_v1.InstancesClient() + instance = instance_client.get(project=project_id, zone=zone, instance=instance_name) + + return instance +# + diff --git a/samples/recipes/disks/create_empty_disk.py b/samples/recipes/disks/create_empty_disk.py new file mode 100644 index 000000000..923f79d07 --- /dev/null +++ b/samples/recipes/disks/create_empty_disk.py @@ -0,0 +1,21 @@ +# Copyright 2022 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. +# flake8: noqa + +# +# + +# + +# diff --git a/samples/recipes/instances/create_start_instance/create_with_existing_disks.py b/samples/recipes/instances/create_start_instance/create_with_existing_disks.py new file mode 100644 index 000000000..3f6bf6ac2 --- /dev/null +++ b/samples/recipes/instances/create_start_instance/create_with_existing_disks.py @@ -0,0 +1,27 @@ +# Copyright 2022 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. +# flake8: noqa + + +# +# + +# + + +# + + +# +# diff --git a/samples/recipes/instances/get.py b/samples/recipes/instances/get.py new file mode 100644 index 000000000..2dcc5c884 --- /dev/null +++ b/samples/recipes/instances/get.py @@ -0,0 +1,20 @@ +# Copyright 2022 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. +# flake8: noqa + +# +# + +# +# diff --git a/samples/snippets/disks/create_empty_disk.py b/samples/snippets/disks/create_empty_disk.py new file mode 100644 index 000000000..d1352f861 --- /dev/null +++ b/samples/snippets/disks/create_empty_disk.py @@ -0,0 +1,72 @@ +# Copyright 2022 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. +# flake8: noqa + + +# This file is automatically generated. Please do not modify it directly. +# Find the relevant recipe file in the samples/recipes or samples/ingredients +# directory and apply your changes there. + + +# [START compute_disk_create_empty_disk] +import sys + +from google.cloud import compute_v1 + + +def create_empty_disk( + project_id: str, zone: str, disk_name: str, disk_type: str, disk_size_gb: int +) -> compute_v1.Disk: + """ + Creates a new empty disk in a project in given zone. + + Args: + project_id: project ID or project number of the Cloud project you want to use. + zone: name of the zone in which you want to create the disk. + disk_name: name of the disk you want to create. + disk_type: the type of disk you want to create. This value uses the following format: + "zones/{zone}/diskTypes/(pd-standard|pd-ssd|pd-balanced|pd-extreme)". + For example: "zones/us-west3-b/diskTypes/pd-ssd" + disk_size_gb: size of the new disk in gigabytes + + Returns: + An unattached Disk instance. + """ + disk = compute_v1.Disk() + disk.size_gb = disk_size_gb + disk.name = disk_name + disk.zone = zone + disk.type_ = disk_type + + disk_client = compute_v1.DisksClient() + operation = disk_client.insert_unary( + project=project_id, zone=zone, disk_resource=disk + ) + operation_client = compute_v1.ZoneOperationsClient() + operation = operation_client.wait( + project=project_id, zone=zone, operation=operation.name + ) + + if operation.error: + print("Error during disk creation:", operation.error, file=sys.stderr) + raise RuntimeError(operation.error) + if operation.warnings: + print("Warnings during disk creation:\n", file=sys.stderr) + for warning in operation.warnings: + print(f" - {warning.code}: {warning.message}", file=sys.stderr) + + return disk_client.get(project=project_id, zone=zone, disk=disk.name) + + +# [END compute_disk_create_empty_disk] diff --git a/samples/snippets/instances/create.py b/samples/snippets/instances/create.py index a4df25156..efa0de173 100644 --- a/samples/snippets/instances/create.py +++ b/samples/snippets/instances/create.py @@ -50,7 +50,7 @@ def disk_from_image( disk_size_gb: int, boot: bool, source_image: str, - auto_delete: bool = False, + auto_delete: bool = True, ) -> compute_v1.AttachedDisk: """ Create an AttachedDisk object to be used in VM instance creation. Uses an image as the @@ -207,7 +207,7 @@ def create_instance( if operation.warnings: print("Warning during creation:", operation.warnings, file=sys.stderr) print(f"Instance {instance_name} created.") - return instance + return instance_client.get(project=project_id, zone=zone, instance=instance_name) # [END compute_instances_create] diff --git a/samples/snippets/instances/create_start_instance/create_from_custom_image.py b/samples/snippets/instances/create_start_instance/create_from_custom_image.py index 203633f02..59d32f08c 100644 --- a/samples/snippets/instances/create_start_instance/create_from_custom_image.py +++ b/samples/snippets/instances/create_start_instance/create_from_custom_image.py @@ -50,7 +50,7 @@ def disk_from_image( disk_size_gb: int, boot: bool, source_image: str, - auto_delete: bool = False, + auto_delete: bool = True, ) -> compute_v1.AttachedDisk: """ Create an AttachedDisk object to be used in VM instance creation. Uses an image as the @@ -207,7 +207,7 @@ def create_instance( if operation.warnings: print("Warning during creation:", operation.warnings, file=sys.stderr) print(f"Instance {instance_name} created.") - return instance + return instance_client.get(project=project_id, zone=zone, instance=instance_name) def create_from_custom_image( @@ -227,7 +227,7 @@ def create_from_custom_image( Instance object. """ disk_type = f"zones/{zone}/diskTypes/pd-standard" - disks = [disk_from_image(disk_type, 10, True, custom_image_link)] + disks = [disk_from_image(disk_type, 10, True, custom_image_link, True)] instance = create_instance(project_id, zone, instance_name, disks) return instance diff --git a/samples/snippets/instances/create_start_instance/create_from_public_image.py b/samples/snippets/instances/create_start_instance/create_from_public_image.py index 28d762a86..bfe848afa 100644 --- a/samples/snippets/instances/create_start_instance/create_from_public_image.py +++ b/samples/snippets/instances/create_start_instance/create_from_public_image.py @@ -50,7 +50,7 @@ def disk_from_image( disk_size_gb: int, boot: bool, source_image: str, - auto_delete: bool = False, + auto_delete: bool = True, ) -> compute_v1.AttachedDisk: """ Create an AttachedDisk object to be used in VM instance creation. Uses an image as the @@ -207,7 +207,7 @@ def create_instance( if operation.warnings: print("Warning during creation:", operation.warnings, file=sys.stderr) print(f"Instance {instance_name} created.") - return instance + return instance_client.get(project=project_id, zone=zone, instance=instance_name) def create_from_public_image( @@ -226,7 +226,7 @@ def create_from_public_image( """ newest_debian = get_image_from_family(project="debian-cloud", family="debian-10") disk_type = f"zones/{zone}/diskTypes/pd-standard" - disks = [disk_from_image(disk_type, 10, True, newest_debian.self_link)] + disks = [disk_from_image(disk_type, 10, True, newest_debian.self_link, True)] instance = create_instance(project_id, zone, instance_name, disks) return instance diff --git a/samples/snippets/instances/create_start_instance/create_from_snapshot.py b/samples/snippets/instances/create_start_instance/create_from_snapshot.py index 92880c972..2c6996ed8 100644 --- a/samples/snippets/instances/create_start_instance/create_from_snapshot.py +++ b/samples/snippets/instances/create_start_instance/create_from_snapshot.py @@ -33,7 +33,7 @@ def disk_from_snapshot( disk_size_gb: int, boot: bool, source_snapshot: str, - auto_delete: bool = False, + auto_delete: bool = True, ) -> compute_v1.AttachedDisk(): """ Create an AttachedDisk object to be used in VM instance creation. Uses a disk snapshot as the @@ -189,7 +189,7 @@ def create_instance( if operation.warnings: print("Warning during creation:", operation.warnings, file=sys.stderr) print(f"Instance {instance_name} created.") - return instance + return instance_client.get(project=project_id, zone=zone, instance=instance_name) def create_from_snapshot( diff --git a/samples/snippets/instances/create_start_instance/create_with_additional_disk.py b/samples/snippets/instances/create_start_instance/create_with_additional_disk.py index bffe08010..a14005eb5 100644 --- a/samples/snippets/instances/create_start_instance/create_with_additional_disk.py +++ b/samples/snippets/instances/create_start_instance/create_with_additional_disk.py @@ -50,7 +50,7 @@ def disk_from_image( disk_size_gb: int, boot: bool, source_image: str, - auto_delete: bool = False, + auto_delete: bool = True, ) -> compute_v1.AttachedDisk: """ Create an AttachedDisk object to be used in VM instance creation. Uses an image as the @@ -84,7 +84,7 @@ def disk_from_image( def empty_disk( - disk_type: str, disk_size_gb: int, boot: bool = False, auto_delete: bool = False + disk_type: str, disk_size_gb: int, boot: bool = False, auto_delete: bool = True ) -> compute_v1.AttachedDisk(): """ Create an AttachedDisk object to be used in VM instance creation. The created disk contains @@ -108,8 +108,8 @@ def empty_disk( disk.initialize_params = initialize_params # Remember to set auto_delete to True if you want the disk to be deleted when you delete # your VM instance. - disk.auto_delete = True - disk.boot = False + disk.auto_delete = auto_delete + disk.boot = boot return disk @@ -237,7 +237,7 @@ def create_instance( if operation.warnings: print("Warning during creation:", operation.warnings, file=sys.stderr) print(f"Instance {instance_name} created.") - return instance + return instance_client.get(project=project_id, zone=zone, instance=instance_name) def create_with_additional_disk( diff --git a/samples/snippets/instances/create_start_instance/create_with_existing_disks.py b/samples/snippets/instances/create_start_instance/create_with_existing_disks.py new file mode 100644 index 000000000..62a118ee8 --- /dev/null +++ b/samples/snippets/instances/create_start_instance/create_with_existing_disks.py @@ -0,0 +1,200 @@ +# Copyright 2022 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. +# flake8: noqa + + +# This file is automatically generated. Please do not modify it directly. +# Find the relevant recipe file in the samples/recipes or samples/ingredients +# directory and apply your changes there. + + +# [START compute_instances_create_with_existing_disks] +import re +import sys +import time +from typing import Iterable, List, NoReturn + +from google.cloud import compute_v1 + + +def get_disk(project_id: str, zone: str, disk_name: str) -> compute_v1.Disk: + """ + Deletes a disk from a project. + + Args: + project_id: project ID or project number of the Cloud project you want to use. + zone: name of the zone in which is the disk you want to delete. + disk_name: name of the disk you want to retrieve. + """ + disk_client = compute_v1.DisksClient() + return disk_client.get(project=project_id, zone=zone, disk=disk_name) + + +def create_instance( + project_id: str, + zone: str, + instance_name: str, + disks: List[compute_v1.AttachedDisk], + machine_type: str = "n1-standard-1", + network_link: str = "global/networks/default", + subnetwork_link: str = None, + internal_ip: str = None, + external_access: bool = False, + external_ipv4: str = None, + accelerators: List[compute_v1.AcceleratorConfig] = None, + preemptible: bool = False, + custom_hostname: str = None, + delete_protection: bool = False, +) -> compute_v1.Instance: + """ + Send an instance creation request to the Compute Engine API and wait for it to complete. + + Args: + project_id: project ID or project number of the Cloud project you want to use. + zone: name of the zone to create the instance in. For example: "us-west3-b" + instance_name: name of the new virtual machine (VM) instance. + disks: a list of compute_v1.AttachedDisk objects describing the disks + you want to attach to your new instance. + machine_type: machine type of the VM being created. This value uses the + following format: "zones/{zone}/machineTypes/{type_name}". + For example: "zones/europe-west3-c/machineTypes/f1-micro" + network_link: name of the network you want the new instance to use. + For example: "global/networks/default" represents the network + named "default", which is created automatically for each project. + subnetwork_link: name of the subnetwork you want the new instance to use. + This value uses the following format: + "regions/{region}/subnetworks/{subnetwork_name}" + internal_ip: internal IP address you want to assign to the new instance. + By default, a free address from the pool of available internal IP addresses of + used subnet will be used. + external_access: boolean flag indicating if the instance should have an external IPv4 + address assigned. + external_ipv4: external IPv4 address to be assigned to this instance. If you specify + an external IP address, it must live in the same region as the zone of the instance. + This setting requires `external_access` to be set to True to work. + accelerators: a list of AcceleratorConfig objects describing the accelerators that will + be attached to the new instance. + preemptible: boolean value indicating if the new instance should be preemptible + or not. + custom_hostname: Custom hostname of the new VM instance. + Custom hostnames must conform to RFC 1035 requirements for valid hostnames. + delete_protection: boolean value indicating if the new virtual machine should be + protected against deletion or not. + Returns: + Instance object. + """ + instance_client = compute_v1.InstancesClient() + operation_client = compute_v1.ZoneOperationsClient() + + # Use the network interface provided in the network_link argument. + network_interface = compute_v1.NetworkInterface() + network_interface.name = network_link + if subnetwork_link: + network_interface.subnetwork = subnetwork_link + + if internal_ip: + network_interface.network_i_p = internal_ip + + if external_access: + access = compute_v1.AccessConfig() + access.type_ = compute_v1.AccessConfig.Type.ONE_TO_ONE_NAT.name + access.name = "External NAT" + access.network_tier = access.NetworkTier.PREMIUM.name + if external_ipv4: + access.nat_i_p = external_ipv4 + network_interface.access_configs = [access] + + # Collect information into the Instance object. + instance = compute_v1.Instance() + instance.name = instance_name + instance.disks = disks + if re.match(r"^zones/[a-z\d\-]+/machineTypes/[a-z\d\-]+$", machine_type): + instance.machine_type = machine_type + else: + instance.machine_type = f"zones/{zone}/machineTypes/{machine_type}" + + if accelerators: + instance.guest_accelerators = accelerators + + instance.network_interfaces = [network_interface] + + if preemptible: + # Set the preemptible setting + instance.scheduling = compute_v1.Scheduling() + instance.scheduling.preemptible = True + + if custom_hostname is not None: + # Set the custom hostname for the instance + instance.hostname = custom_hostname + + if delete_protection: + # Set the delete protection bit + instance.deletion_protection = True + + # Prepare the request to insert an instance. + request = compute_v1.InsertInstanceRequest() + request.zone = zone + request.project = project_id + request.instance_resource = instance + + # Wait for the create operation to complete. + print(f"Creating the {instance_name} instance in {zone}...") + + operation = instance_client.insert_unary(request=request) + start = time.time() + while operation.status != compute_v1.Operation.Status.DONE: + operation = operation_client.wait( + operation=operation.name, zone=zone, project=project_id + ) + if time.time() - start >= 300: # 5 minutes + raise TimeoutError() + if operation.error: + print("Error during creation:", operation.error, file=sys.stderr) + raise RuntimeError(operation.error) + if operation.warnings: + print("Warning during creation:", operation.warnings, file=sys.stderr) + print(f"Instance {instance_name} created.") + return instance_client.get(project=project_id, zone=zone, instance=instance_name) + + +def create_with_existing_disks( + project_id: str, zone: str, instance_name: str, disk_names: List[str] +) -> compute_v1.Instance: + """ + Create a new VM instance using selected disks. The first disk in disk_names will + be used as boot disk. + + Args: + project_id: project ID or project number of the Cloud project you want to use. + zone: name of the zone to create the instance in. For example: "us-west3-b" + instance_name: name of the new virtual machine (VM) instance. + disk_names: list of disk names to be attached to the new virtual machine. + First disk in this list will be used as the boot device. + + Returns: + Instance object. + """ + assert len(disk_names) >= 1 + disks = [get_disk(project_id, zone, disk_name) for disk_name in disk_names] + attached_disks = [] + for disk in disks: + adisk = compute_v1.AttachedDisk() + adisk.source = disk.self_link + attached_disks.append(adisk) + attached_disks[0].boot = True + instance = create_instance(project_id, zone, instance_name, attached_disks) + return instance + + +# [END compute_instances_create_with_existing_disks] diff --git a/samples/snippets/instances/create_start_instance/create_with_snapshotted_data_disk.py b/samples/snippets/instances/create_start_instance/create_with_snapshotted_data_disk.py index f1c904d09..0385c17ab 100644 --- a/samples/snippets/instances/create_start_instance/create_with_snapshotted_data_disk.py +++ b/samples/snippets/instances/create_start_instance/create_with_snapshotted_data_disk.py @@ -50,7 +50,7 @@ def disk_from_image( disk_size_gb: int, boot: bool, source_image: str, - auto_delete: bool = False, + auto_delete: bool = True, ) -> compute_v1.AttachedDisk: """ Create an AttachedDisk object to be used in VM instance creation. Uses an image as the @@ -88,7 +88,7 @@ def disk_from_snapshot( disk_size_gb: int, boot: bool, source_snapshot: str, - auto_delete: bool = False, + auto_delete: bool = True, ) -> compute_v1.AttachedDisk(): """ Create an AttachedDisk object to be used in VM instance creation. Uses a disk snapshot as the @@ -244,7 +244,7 @@ def create_instance( if operation.warnings: print("Warning during creation:", operation.warnings, file=sys.stderr) print(f"Instance {instance_name} created.") - return instance + return instance_client.get(project=project_id, zone=zone, instance=instance_name) def create_with_snapshotted_data_disk( diff --git a/samples/snippets/instances/create_with_subnet.py b/samples/snippets/instances/create_with_subnet.py index 6c4be0122..27a52a9f7 100644 --- a/samples/snippets/instances/create_with_subnet.py +++ b/samples/snippets/instances/create_with_subnet.py @@ -50,7 +50,7 @@ def disk_from_image( disk_size_gb: int, boot: bool, source_image: str, - auto_delete: bool = False, + auto_delete: bool = True, ) -> compute_v1.AttachedDisk: """ Create an AttachedDisk object to be used in VM instance creation. Uses an image as the @@ -207,7 +207,7 @@ def create_instance( if operation.warnings: print("Warning during creation:", operation.warnings, file=sys.stderr) print(f"Instance {instance_name} created.") - return instance + return instance_client.get(project=project_id, zone=zone, instance=instance_name) def create_with_subnet( diff --git a/samples/snippets/instances/custom_hostname/create.py b/samples/snippets/instances/custom_hostname/create.py index 9ede42b7b..699f6397e 100644 --- a/samples/snippets/instances/custom_hostname/create.py +++ b/samples/snippets/instances/custom_hostname/create.py @@ -50,7 +50,7 @@ def disk_from_image( disk_size_gb: int, boot: bool, source_image: str, - auto_delete: bool = False, + auto_delete: bool = True, ) -> compute_v1.AttachedDisk: """ Create an AttachedDisk object to be used in VM instance creation. Uses an image as the @@ -207,7 +207,7 @@ def create_instance( if operation.warnings: print("Warning during creation:", operation.warnings, file=sys.stderr) print(f"Instance {instance_name} created.") - return instance + return instance_client.get(project=project_id, zone=zone, instance=instance_name) def create_instance_custom_hostname( diff --git a/samples/snippets/instances/custom_machine_types/create_shared_with_helper.py b/samples/snippets/instances/custom_machine_types/create_shared_with_helper.py index f699228b9..7674013d4 100644 --- a/samples/snippets/instances/custom_machine_types/create_shared_with_helper.py +++ b/samples/snippets/instances/custom_machine_types/create_shared_with_helper.py @@ -244,7 +244,7 @@ def disk_from_image( disk_size_gb: int, boot: bool, source_image: str, - auto_delete: bool = False, + auto_delete: bool = True, ) -> compute_v1.AttachedDisk: """ Create an AttachedDisk object to be used in VM instance creation. Uses an image as the @@ -401,7 +401,7 @@ def create_instance( if operation.warnings: print("Warning during creation:", operation.warnings, file=sys.stderr) print(f"Instance {instance_name} created.") - return instance + return instance_client.get(project=project_id, zone=zone, instance=instance_name) def create_custom_shared_core_instance( diff --git a/samples/snippets/instances/custom_machine_types/create_with_helper.py b/samples/snippets/instances/custom_machine_types/create_with_helper.py index 700ccdcea..5821f160b 100644 --- a/samples/snippets/instances/custom_machine_types/create_with_helper.py +++ b/samples/snippets/instances/custom_machine_types/create_with_helper.py @@ -244,7 +244,7 @@ def disk_from_image( disk_size_gb: int, boot: bool, source_image: str, - auto_delete: bool = False, + auto_delete: bool = True, ) -> compute_v1.AttachedDisk: """ Create an AttachedDisk object to be used in VM instance creation. Uses an image as the @@ -401,7 +401,7 @@ def create_instance( if operation.warnings: print("Warning during creation:", operation.warnings, file=sys.stderr) print(f"Instance {instance_name} created.") - return instance + return instance_client.get(project=project_id, zone=zone, instance=instance_name) def create_custom_instance( diff --git a/samples/snippets/instances/custom_machine_types/create_without_helper.py b/samples/snippets/instances/custom_machine_types/create_without_helper.py index ae79f9fb7..54e208b6d 100644 --- a/samples/snippets/instances/custom_machine_types/create_without_helper.py +++ b/samples/snippets/instances/custom_machine_types/create_without_helper.py @@ -50,7 +50,7 @@ def disk_from_image( disk_size_gb: int, boot: bool, source_image: str, - auto_delete: bool = False, + auto_delete: bool = True, ) -> compute_v1.AttachedDisk: """ Create an AttachedDisk object to be used in VM instance creation. Uses an image as the @@ -207,7 +207,7 @@ def create_instance( if operation.warnings: print("Warning during creation:", operation.warnings, file=sys.stderr) print(f"Instance {instance_name} created.") - return instance + return instance_client.get(project=project_id, zone=zone, instance=instance_name) def create_custom_instances_no_helper( diff --git a/samples/snippets/instances/custom_machine_types/extra_mem_no_helper.py b/samples/snippets/instances/custom_machine_types/extra_mem_no_helper.py index e4b1abd11..9449ef11f 100644 --- a/samples/snippets/instances/custom_machine_types/extra_mem_no_helper.py +++ b/samples/snippets/instances/custom_machine_types/extra_mem_no_helper.py @@ -50,7 +50,7 @@ def disk_from_image( disk_size_gb: int, boot: bool, source_image: str, - auto_delete: bool = False, + auto_delete: bool = True, ) -> compute_v1.AttachedDisk: """ Create an AttachedDisk object to be used in VM instance creation. Uses an image as the @@ -207,7 +207,7 @@ def create_instance( if operation.warnings: print("Warning during creation:", operation.warnings, file=sys.stderr) print(f"Instance {instance_name} created.") - return instance + return instance_client.get(project=project_id, zone=zone, instance=instance_name) def create_custom_instances_extra_mem( diff --git a/samples/snippets/instances/delete_protection/create.py b/samples/snippets/instances/delete_protection/create.py index 32148a25f..15d31f102 100644 --- a/samples/snippets/instances/delete_protection/create.py +++ b/samples/snippets/instances/delete_protection/create.py @@ -50,7 +50,7 @@ def disk_from_image( disk_size_gb: int, boot: bool, source_image: str, - auto_delete: bool = False, + auto_delete: bool = True, ) -> compute_v1.AttachedDisk: """ Create an AttachedDisk object to be used in VM instance creation. Uses an image as the @@ -207,7 +207,7 @@ def create_instance( if operation.warnings: print("Warning during creation:", operation.warnings, file=sys.stderr) print(f"Instance {instance_name} created.") - return instance + return instance_client.get(project=project_id, zone=zone, instance=instance_name) def create_protected_instance( diff --git a/samples/snippets/instances/get.py b/samples/snippets/instances/get.py new file mode 100644 index 000000000..427ea19a1 --- /dev/null +++ b/samples/snippets/instances/get.py @@ -0,0 +1,45 @@ +# Copyright 2022 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. +# flake8: noqa + + +# This file is automatically generated. Please do not modify it directly. +# Find the relevant recipe file in the samples/recipes or samples/ingredients +# directory and apply your changes there. + + +# [START compute_instances_get] +from google.cloud import compute_v1 + + +def get_instance(project_id: str, zone: str, instance_name: str) -> compute_v1.Instance: + """ + Get information about a VM instance in the given zone in the specified project. + + Args: + project_id: project ID or project number of the Cloud project you want to use. + zone: name of the zone you want to use. For example: “us-west3-b” + instance_name: name of the VM instance you want to query. + Returns: + An Instance object. + """ + instance_client = compute_v1.InstancesClient() + instance = instance_client.get( + project=project_id, zone=zone, instance=instance_name + ) + + return instance + + +# [END compute_instances_get] diff --git a/samples/snippets/instances/preemptible/create_preemptible.py b/samples/snippets/instances/preemptible/create_preemptible.py index 3fd4de32d..5cc7ff47d 100644 --- a/samples/snippets/instances/preemptible/create_preemptible.py +++ b/samples/snippets/instances/preemptible/create_preemptible.py @@ -50,7 +50,7 @@ def disk_from_image( disk_size_gb: int, boot: bool, source_image: str, - auto_delete: bool = False, + auto_delete: bool = True, ) -> compute_v1.AttachedDisk: """ Create an AttachedDisk object to be used in VM instance creation. Uses an image as the @@ -207,7 +207,7 @@ def create_instance( if operation.warnings: print("Warning during creation:", operation.warnings, file=sys.stderr) print(f"Instance {instance_name} created.") - return instance + return instance_client.get(project=project_id, zone=zone, instance=instance_name) def create_preemptible_instance( diff --git a/samples/snippets/tests/test_create_vm.py b/samples/snippets/tests/test_create_vm.py index 5497f233b..fbda262ea 100644 --- a/samples/snippets/tests/test_create_vm.py +++ b/samples/snippets/tests/test_create_vm.py @@ -17,6 +17,10 @@ from google.cloud import compute_v1 import pytest +from ..disks.create_empty_disk import create_empty_disk +from ..disks.create_from_image import create_disk_from_image +from ..disks.delete import delete_disk + from ..instances.create_start_instance.create_from_custom_image import ( create_from_custom_image, ) @@ -27,6 +31,7 @@ from ..instances.create_start_instance.create_with_additional_disk import ( create_with_additional_disk, ) +from ..instances.create_start_instance.create_with_existing_disks import create_with_existing_disks from ..instances.create_start_instance.create_with_snapshotted_data_disk import ( create_with_snapshotted_data_disk, ) @@ -108,89 +113,132 @@ def image(src_disk): wait_for_operation(op, PROJECT) -class TestCreation: - def test_create_from_custom_image(self, image): - instance_name = "i" + uuid.uuid4().hex[:10] - instance = create_from_custom_image( - PROJECT, INSTANCE_ZONE, instance_name, image.self_link +@pytest.fixture() +def boot_disk(): + debian_image = get_active_debian() + disk_name = "test-disk-" + uuid.uuid4().hex[:10] + disk = create_disk_from_image(PROJECT, INSTANCE_ZONE, disk_name, + f"zones/{INSTANCE_ZONE}/diskTypes/pd-standard", + 13, debian_image.self_link) + yield disk + delete_disk(PROJECT, INSTANCE_ZONE, disk_name) + + +@pytest.fixture() +def empty_disk(): + disk_name = "test-disk-" + uuid.uuid4().hex[:10] + disk = create_empty_disk(PROJECT, INSTANCE_ZONE, disk_name, + f"zones/{INSTANCE_ZONE}/diskTypes/pd-standard", + 14) + + yield disk + delete_disk(PROJECT, INSTANCE_ZONE, disk_name) + + +def test_create_from_custom_image(image): + instance_name = "i" + uuid.uuid4().hex[:10] + instance = create_from_custom_image( + PROJECT, INSTANCE_ZONE, instance_name, image.self_link + ) + try: + assert ( + instance.disks[0].disk_size_gb == 10 + ) + finally: + delete_instance(PROJECT, INSTANCE_ZONE, instance_name) + + +def test_create_from_public_image(): + instance_name = "i" + uuid.uuid4().hex[:10] + instance = create_from_public_image( + PROJECT, + INSTANCE_ZONE, + instance_name, + ) + try: + assert instance.disks[0].disk_size_gb == 10 + finally: + delete_instance(PROJECT, INSTANCE_ZONE, instance_name) + + +def test_create_from_snapshot(snapshot): + instance_name = "i" + uuid.uuid4().hex[:10] + instance = create_from_snapshot( + PROJECT, INSTANCE_ZONE, instance_name, snapshot.self_link + ) + try: + assert ( + instance.disks[0].disk_size_gb == 20 + ) + finally: + delete_instance(PROJECT, INSTANCE_ZONE, instance_name) + + +def test_create_with_additional_disk(): + instance_name = "i" + uuid.uuid4().hex[:10] + instance = create_with_additional_disk(PROJECT, INSTANCE_ZONE, instance_name) + try: + assert any( + disk.disk_size_gb == 20 for disk in instance.disks + ) + assert any( + disk.disk_size_gb == 25 for disk in instance.disks + ) + assert len(instance.disks) == 2 + finally: + delete_instance(PROJECT, INSTANCE_ZONE, instance_name) + + +def test_create_with_snapshotted_data_disk(snapshot): + instance_name = "i" + uuid.uuid4().hex[:10] + instance = create_with_snapshotted_data_disk( + PROJECT, INSTANCE_ZONE, instance_name, snapshot.self_link + ) + try: + assert any( + disk.disk_size_gb == 11 for disk in instance.disks ) - try: - assert ( - instance.disks[0].initialize_params.source_image == image.self_link - ) - finally: - delete_instance(PROJECT, INSTANCE_ZONE, instance_name) - - def test_create_from_public_image(self): - instance_name = "i" + uuid.uuid4().hex[:10] - instance = create_from_public_image( - PROJECT, - INSTANCE_ZONE, - instance_name, + assert any( + disk.disk_size_gb == 10 for disk in instance.disks ) - try: - assert "debian-cloud" in instance.disks[0].initialize_params.source_image - assert "debian-10" in instance.disks[0].initialize_params.source_image - finally: - delete_instance(PROJECT, INSTANCE_ZONE, instance_name) - - def test_create_from_snapshot(self, snapshot): - instance_name = "i" + uuid.uuid4().hex[:10] - instance = create_from_snapshot( - PROJECT, INSTANCE_ZONE, instance_name, snapshot.self_link + assert len(instance.disks) == 2 + finally: + delete_instance(PROJECT, INSTANCE_ZONE, instance_name) + + +def test_create_with_subnet(): + instance_name = "i" + uuid.uuid4().hex[:10] + instance = create_with_subnet( + PROJECT, + INSTANCE_ZONE, + instance_name, + "global/networks/default", + f"regions/{REGION}/subnetworks/default", + ) + try: + assert instance.network_interfaces[0].network.endswith("global/networks/default") + assert ( + instance.network_interfaces[0].subnetwork.endswith(f"regions/{REGION}/subnetworks/default") ) - try: - assert ( - instance.disks[0].initialize_params.source_snapshot - == snapshot.self_link - ) - finally: - delete_instance(PROJECT, INSTANCE_ZONE, instance_name) - - def test_create_with_additional_disk(self): - instance_name = "i" + uuid.uuid4().hex[:10] - instance = create_with_additional_disk(PROJECT, INSTANCE_ZONE, instance_name) - try: - assert any( - disk.initialize_params.disk_size_gb == 20 for disk in instance.disks - ) - assert any( - disk.initialize_params.disk_size_gb == 25 for disk in instance.disks - ) - assert len(instance.disks) == 2 - finally: - delete_instance(PROJECT, INSTANCE_ZONE, instance_name) - - def test_create_with_snapshotted_data_disk(self, snapshot): - instance_name = "i" + uuid.uuid4().hex[:10] - instance = create_with_snapshotted_data_disk( - PROJECT, INSTANCE_ZONE, instance_name, snapshot.self_link + finally: + delete_instance(PROJECT, INSTANCE_ZONE, instance_name) + + +def test_create_with_existing_disks(boot_disk, empty_disk): + instance_name = "i" + uuid.uuid4().hex[:10] + instance = create_with_existing_disks(PROJECT, INSTANCE_ZONE, instance_name, + [boot_disk.name, empty_disk.name]) + + try: + print(instance.disks) + for disk in instance.disks: + print(disk, dir(disk), type(disk), disk.disk_size_gb) + assert any( + disk.disk_size_gb == 13 for disk in instance.disks ) - try: - assert any( - disk.initialize_params.disk_size_gb == 11 for disk in instance.disks - ) - assert any( - disk.initialize_params.disk_size_gb == 10 for disk in instance.disks - ) - assert len(instance.disks) == 2 - finally: - delete_instance(PROJECT, INSTANCE_ZONE, instance_name) - - def test_create_with_subnet(self): - instance_name = "i" + uuid.uuid4().hex[:10] - instance = create_with_subnet( - PROJECT, - INSTANCE_ZONE, - instance_name, - "global/networks/default", - f"regions/{REGION}/subnetworks/default", + assert any( + disk.disk_size_gb == 14 for disk in instance.disks ) - try: - assert instance.network_interfaces[0].name == "global/networks/default" - assert ( - instance.network_interfaces[0].subnetwork - == f"regions/{REGION}/subnetworks/default" - ) - finally: - delete_instance(PROJECT, INSTANCE_ZONE, instance_name) + assert len(instance.disks) == 2 + finally: + delete_instance(PROJECT, INSTANCE_ZONE, instance_name) From cbc0efe1c5dc0a6ffce259f20c0f238265ed400f Mon Sep 17 00:00:00 2001 From: Maciej Strzelczyk Date: Mon, 28 Mar 2022 18:03:18 +0200 Subject: [PATCH 09/17] chore(samples): Adding a test to make sure snippets are up-to-date (#243) * chore(samples): Adding a test to make sure snippets are up-to-date --- samples/sgs.py | 1 + .../create_with_existing_disks.py | 4 +-- samples/test_sgs.py | 25 +++++++++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/samples/sgs.py b/samples/sgs.py index d8b2dbeb8..e3fa70a8b 100644 --- a/samples/sgs.py +++ b/samples/sgs.py @@ -90,6 +90,7 @@ def __repr__(self): re.compile(r".*requirements-test\.txt$"), re.compile(r".*?/tests/.*"), re.compile(r".*?/__pycache__/.*"), + re.compile(r".*?sponge_log.xml.*"), ) diff --git a/samples/snippets/instances/create_start_instance/create_with_existing_disks.py b/samples/snippets/instances/create_start_instance/create_with_existing_disks.py index 62a118ee8..df36012ea 100644 --- a/samples/snippets/instances/create_start_instance/create_with_existing_disks.py +++ b/samples/snippets/instances/create_start_instance/create_with_existing_disks.py @@ -30,11 +30,11 @@ def get_disk(project_id: str, zone: str, disk_name: str) -> compute_v1.Disk: """ - Deletes a disk from a project. + Gets a disk from a project. Args: project_id: project ID or project number of the Cloud project you want to use. - zone: name of the zone in which is the disk you want to delete. + zone: name of the zone where the disk exists. disk_name: name of the disk you want to retrieve. """ disk_client = compute_v1.DisksClient() diff --git a/samples/test_sgs.py b/samples/test_sgs.py index dcc030a17..fafae9ed3 100644 --- a/samples/test_sgs.py +++ b/samples/test_sgs.py @@ -16,6 +16,8 @@ from pathlib import Path import tempfile +import pytest + from . import sgs FIXTURE_INGREDIENTS = Path("sgs_test_fixtures/ingredients") @@ -30,3 +32,26 @@ def test_sgs_generate(): for test_file in map(Path, glob.glob(f"{tmp_dir}/**")): match_file = FIXTURE_OUTPUT / test_file.relative_to(tmp_dir) assert test_file.read_bytes() == match_file.read_bytes() + + +def test_snippets_freshness(): + """ + Make sure that the snippets/ folder is up-to-date and matches + ingredients/ and recipes/. This test will generate SGS output + in a temporary directory and compare it to the content of + snippets/ folder. + """ + with tempfile.TemporaryDirectory() as tmp_dir: + args = Namespace(output_dir=tmp_dir) + sgs.generate(args, Path("ingredients/").absolute(), Path("recipes/").absolute()) + print(list(map(Path, glob.glob(f"{tmp_dir}/**")))) + for test_file in map(Path, glob.glob(f"{tmp_dir}/**", recursive=True)): + match_file = Path("snippets/") / test_file.relative_to(tmp_dir) + if test_file.is_file(): + if test_file.read_bytes() != match_file.read_bytes(): + pytest.fail( + f"This test fails because file {match_file} seems to be outdated. Please run " + f"`python sgs.py generate` to update your snippets." + ) + elif test_file.is_dir(): + assert match_file.is_dir() From cc0243d2f09a4301f5b622ea564462efd34eaf09 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 29 Mar 2022 01:02:11 +0000 Subject: [PATCH 10/17] chore(python): use black==22.3.0 (#249) Source-Link: https://github.com/googleapis/synthtool/commit/6fab84af09f2cf89a031fd8671d1def6b2931b11 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe --- .github/.OwlBot.lock.yaml | 2 +- docs/conf.py | 5 +- .../services/accelerator_types/client.py | 76 +- .../accelerator_types/transports/base.py | 22 +- .../compute_v1/services/addresses/client.py | 90 +- .../services/addresses/transports/base.py | 30 +- .../compute_v1/services/autoscalers/client.py | 104 +- .../services/autoscalers/transports/base.py | 38 +- .../services/backend_buckets/client.py | 113 +- .../backend_buckets/transports/base.py | 38 +- .../services/backend_services/client.py | 139 +- .../backend_services/transports/base.py | 50 +- .../compute_v1/services/disk_types/client.py | 76 +- .../services/disk_types/transports/base.py | 22 +- .../cloud/compute_v1/services/disks/client.py | 146 +- .../services/disks/transports/base.py | 50 +- .../services/external_vpn_gateways/client.py | 90 +- .../external_vpn_gateways/transports/base.py | 30 +- .../external_vpn_gateways/transports/rest.py | 4 +- .../services/firewall_policies/client.py | 176 +- .../firewall_policies/transports/base.py | 78 +- .../compute_v1/services/firewalls/client.py | 92 +- .../services/firewalls/transports/base.py | 34 +- .../services/forwarding_rules/client.py | 111 +- .../forwarding_rules/transports/base.py | 42 +- .../services/global_addresses/client.py | 78 +- .../global_addresses/transports/base.py | 26 +- .../global_forwarding_rules/client.py | 97 +- .../transports/base.py | 38 +- .../global_network_endpoint_groups/client.py | 102 +- .../transports/base.py | 26 +- .../transports/rest.py | 18 +- .../services/global_operations/client.py | 90 +- .../global_operations/transports/base.py | 30 +- .../global_organization_operations/client.py | 69 +- .../transports/base.py | 22 +- .../transports/rest.py | 5 +- .../client.py | 83 +- .../transports/base.py | 30 +- .../services/health_checks/client.py | 104 +- .../services/health_checks/transports/base.py | 38 +- .../services/image_family_views/client.py | 52 +- .../image_family_views/transports/base.py | 14 +- .../compute_v1/services/images/client.py | 127 +- .../services/images/transports/base.py | 50 +- .../instance_group_managers/client.py | 208 +- .../transports/base.py | 62 +- .../transports/rest.py | 296 +- .../services/instance_groups/client.py | 123 +- .../instance_groups/transports/base.py | 46 +- .../services/instance_templates/client.py | 97 +- .../instance_templates/transports/base.py | 34 +- .../compute_v1/services/instances/client.py | 375 +- .../services/instances/transports/base.py | 110 +- .../services/instances/transports/rest.py | 230 +- .../interconnect_attachments/client.py | 95 +- .../transports/base.py | 34 +- .../transports/rest.py | 4 +- .../services/interconnect_locations/client.py | 62 +- .../interconnect_locations/transports/base.py | 18 +- .../services/interconnects/client.py | 92 +- .../services/interconnects/transports/base.py | 34 +- .../services/license_codes/client.py | 59 +- .../services/license_codes/transports/base.py | 14 +- .../compute_v1/services/licenses/client.py | 99 +- .../services/licenses/transports/base.py | 34 +- .../services/machine_images/client.py | 99 +- .../machine_images/transports/base.py | 34 +- .../services/machine_types/client.py | 76 +- .../services/machine_types/transports/base.py | 22 +- .../network_endpoint_groups/client.py | 121 +- .../transports/base.py | 30 +- .../transports/rest.py | 22 +- .../compute_v1/services/networks/client.py | 132 +- .../services/networks/transports/base.py | 46 +- .../compute_v1/services/node_groups/client.py | 151 +- .../services/node_groups/transports/base.py | 58 +- .../services/node_templates/client.py | 111 +- .../node_templates/transports/base.py | 38 +- .../compute_v1/services/node_types/client.py | 76 +- .../services/node_types/transports/base.py | 22 +- .../services/packet_mirrorings/client.py | 104 +- .../packet_mirrorings/transports/base.py | 34 +- .../compute_v1/services/projects/client.py | 146 +- .../services/projects/transports/base.py | 46 +- .../services/projects/transports/rest.py | 72 +- .../public_advertised_prefixes/client.py | 83 +- .../transports/base.py | 30 +- .../public_delegated_prefixes/client.py | 95 +- .../transports/base.py | 34 +- .../transports/rest.py | 4 +- .../services/region_autoscalers/client.py | 90 +- .../region_autoscalers/transports/base.py | 34 +- .../region_backend_services/client.py | 97 +- .../transports/base.py | 38 +- .../services/region_commitments/client.py | 88 +- .../region_commitments/transports/base.py | 30 +- .../services/region_disk_types/client.py | 64 +- .../region_disk_types/transports/base.py | 18 +- .../services/region_disks/client.py | 134 +- .../services/region_disks/transports/base.py | 46 +- .../region_health_check_services/client.py | 83 +- .../transports/base.py | 30 +- .../services/region_health_checks/client.py | 90 +- .../region_health_checks/transports/base.py | 34 +- .../region_instance_group_managers/client.py | 196 +- .../region_instance_group_managers/pagers.py | 4 +- .../transports/base.py | 58 +- .../transports/rest.py | 292 +- .../services/region_instance_groups/client.py | 81 +- .../region_instance_groups/transports/base.py | 26 +- .../services/region_instances/client.py | 52 +- .../region_instances/transports/base.py | 14 +- .../region_network_endpoint_groups/client.py | 76 +- .../transports/base.py | 26 +- .../region_notification_endpoints/client.py | 76 +- .../transports/base.py | 26 +- .../services/region_operations/client.py | 78 +- .../region_operations/transports/base.py | 26 +- .../region_ssl_certificates/client.py | 76 +- .../transports/base.py | 26 +- .../region_target_http_proxies/client.py | 83 +- .../transports/base.py | 30 +- .../region_target_https_proxies/client.py | 90 +- .../transports/base.py | 30 +- .../transports/rest.py | 4 +- .../services/region_url_maps/client.py | 99 +- .../region_url_maps/transports/base.py | 38 +- .../compute_v1/services/regions/client.py | 64 +- .../services/regions/transports/base.py | 18 +- .../services/regions/transports/rest.py | 5 +- .../services/reservations/client.py | 125 +- .../services/reservations/transports/base.py | 46 +- .../services/resource_policies/client.py | 111 +- .../resource_policies/transports/base.py | 38 +- .../compute_v1/services/routers/client.py | 130 +- .../services/routers/transports/base.py | 46 +- .../compute_v1/services/routes/client.py | 78 +- .../services/routes/transports/base.py | 26 +- .../services/security_policies/client.py | 120 +- .../security_policies/transports/base.py | 46 +- .../security_policies/transports/rest.py | 32 +- .../services/service_attachments/client.py | 116 +- .../service_attachments/transports/base.py | 42 +- .../compute_v1/services/snapshots/client.py | 106 +- .../services/snapshots/transports/base.py | 38 +- .../services/ssl_certificates/client.py | 90 +- .../ssl_certificates/transports/base.py | 30 +- .../services/ssl_policies/client.py | 92 +- .../services/ssl_policies/transports/base.py | 30 +- .../compute_v1/services/subnetworks/client.py | 144 +- .../services/subnetworks/transports/base.py | 46 +- .../services/subnetworks/transports/rest.py | 62 +- .../services/target_grpc_proxies/client.py | 83 +- .../target_grpc_proxies/transports/base.py | 30 +- .../services/target_http_proxies/client.py | 102 +- .../target_http_proxies/transports/base.py | 38 +- .../services/target_https_proxies/client.py | 123 +- .../target_https_proxies/transports/base.py | 46 +- .../services/target_instances/client.py | 90 +- .../target_instances/transports/base.py | 30 +- .../services/target_pools/client.py | 132 +- .../services/target_pools/transports/base.py | 54 +- .../services/target_ssl_proxies/client.py | 106 +- .../target_ssl_proxies/transports/base.py | 38 +- .../services/target_tcp_proxies/client.py | 92 +- .../target_tcp_proxies/transports/base.py | 34 +- .../services/target_vpn_gateways/client.py | 88 +- .../target_vpn_gateways/transports/base.py | 30 +- .../compute_v1/services/url_maps/client.py | 118 +- .../services/url_maps/transports/base.py | 46 +- .../services/vpn_gateways/client.py | 111 +- .../services/vpn_gateways/transports/base.py | 38 +- .../compute_v1/services/vpn_tunnels/client.py | 90 +- .../services/vpn_tunnels/transports/base.py | 30 +- .../services/zone_operations/client.py | 78 +- .../zone_operations/transports/base.py | 26 +- .../cloud/compute_v1/services/zones/client.py | 64 +- .../services/zones/transports/base.py | 18 +- .../services/zones/transports/rest.py | 5 +- google/cloud/compute_v1/types/compute.py | 29942 +++++++++++++--- noxfile.py | 9 +- samples/noxfile.py | 4 +- samples/requirements.txt | 4 +- .../compute_v1/test_accelerator_types.py | 262 +- tests/unit/gapic/compute_v1/test_addresses.py | 357 +- .../unit/gapic/compute_v1/test_autoscalers.py | 451 +- .../gapic/compute_v1/test_backend_buckets.py | 485 +- .../gapic/compute_v1/test_backend_services.py | 607 +- .../unit/gapic/compute_v1/test_disk_types.py | 281 +- tests/unit/gapic/compute_v1/test_disks.py | 714 +- .../compute_v1/test_external_vpn_gateways.py | 353 +- .../compute_v1/test_firewall_policies.py | 821 +- tests/unit/gapic/compute_v1/test_firewalls.py | 384 +- .../gapic/compute_v1/test_forwarding_rules.py | 443 +- .../gapic/compute_v1/test_global_addresses.py | 301 +- .../test_global_forwarding_rules.py | 369 +- .../test_global_network_endpoint_groups.py | 378 +- .../compute_v1/test_global_operations.py | 364 +- .../test_global_organization_operations.py | 194 +- .../test_global_public_delegated_prefixes.py | 283 +- .../gapic/compute_v1/test_health_checks.py | 421 +- .../compute_v1/test_image_family_views.py | 141 +- tests/unit/gapic/compute_v1/test_images.py | 615 +- .../test_instance_group_managers.py | 916 +- .../gapic/compute_v1/test_instance_groups.py | 473 +- .../compute_v1/test_instance_templates.py | 403 +- tests/unit/gapic/compute_v1/test_instances.py | 2129 +- .../test_interconnect_attachments.py | 348 +- .../compute_v1/test_interconnect_locations.py | 185 +- .../gapic/compute_v1/test_interconnects.py | 372 +- .../gapic/compute_v1/test_license_codes.py | 177 +- tests/unit/gapic/compute_v1/test_licenses.py | 450 +- .../gapic/compute_v1/test_machine_images.py | 427 +- .../gapic/compute_v1/test_machine_types.py | 263 +- .../test_network_endpoint_groups.py | 461 +- tests/unit/gapic/compute_v1/test_networks.py | 599 +- .../unit/gapic/compute_v1/test_node_groups.py | 731 +- .../gapic/compute_v1/test_node_templates.py | 458 +- .../unit/gapic/compute_v1/test_node_types.py | 281 +- .../compute_v1/test_packet_mirrorings.py | 412 +- tests/unit/gapic/compute_v1/test_projects.py | 642 +- .../test_public_advertised_prefixes.py | 283 +- .../test_public_delegated_prefixes.py | 328 +- .../compute_v1/test_region_autoscalers.py | 385 +- .../test_region_backend_services.py | 375 +- .../compute_v1/test_region_commitments.py | 344 +- .../compute_v1/test_region_disk_types.py | 221 +- .../gapic/compute_v1/test_region_disks.py | 616 +- .../test_region_health_check_services.py | 293 +- .../compute_v1/test_region_health_checks.py | 353 +- .../test_region_instance_group_managers.py | 870 +- .../compute_v1/test_region_instance_groups.py | 278 +- .../gapic/compute_v1/test_region_instances.py | 125 +- .../test_region_network_endpoint_groups.py | 256 +- .../test_region_notification_endpoints.py | 256 +- .../compute_v1/test_region_operations.py | 322 +- .../test_region_ssl_certificates.py | 261 +- .../test_region_target_http_proxies.py | 300 +- .../test_region_target_https_proxies.py | 320 +- .../gapic/compute_v1/test_region_url_maps.py | 426 +- tests/unit/gapic/compute_v1/test_regions.py | 230 +- .../gapic/compute_v1/test_reservations.py | 564 +- .../compute_v1/test_resource_policies.py | 459 +- tests/unit/gapic/compute_v1/test_routers.py | 599 +- tests/unit/gapic/compute_v1/test_routes.py | 315 +- .../compute_v1/test_security_policies.py | 562 +- .../compute_v1/test_service_attachments.py | 484 +- tests/unit/gapic/compute_v1/test_snapshots.py | 472 +- .../gapic/compute_v1/test_ssl_certificates.py | 331 +- .../gapic/compute_v1/test_ssl_policies.py | 406 +- .../unit/gapic/compute_v1/test_subnetworks.py | 648 +- .../compute_v1/test_target_grpc_proxies.py | 318 +- .../compute_v1/test_target_http_proxies.py | 399 +- .../compute_v1/test_target_https_proxies.py | 488 +- .../gapic/compute_v1/test_target_instances.py | 333 +- .../gapic/compute_v1/test_target_pools.py | 546 +- .../compute_v1/test_target_ssl_proxies.py | 406 +- .../compute_v1/test_target_tcp_proxies.py | 344 +- .../compute_v1/test_target_vpn_gateways.py | 325 +- tests/unit/gapic/compute_v1/test_url_maps.py | 511 +- .../gapic/compute_v1/test_vpn_gateways.py | 455 +- .../unit/gapic/compute_v1/test_vpn_tunnels.py | 349 +- .../gapic/compute_v1/test_zone_operations.py | 317 +- tests/unit/gapic/compute_v1/test_zones.py | 230 +- 265 files changed, 60995 insertions(+), 15991 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 44c78f7cc..87dd00611 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:4e1991042fe54b991db9ca17c8fb386e61b22fe4d1472a568bf0fcac85dcf5d3 + digest: sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe diff --git a/docs/conf.py b/docs/conf.py index 14a089750..dc4215e87 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -361,7 +361,10 @@ intersphinx_mapping = { "python": ("https://python.readthedocs.org/en/latest/", None), "google-auth": ("https://googleapis.dev/python/google-auth/latest/", None), - "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None,), + "google.api_core": ( + "https://googleapis.dev/python/google-api-core/latest/", + None, + ), "grpc": ("https://grpc.github.io/grpc/python/", None), "proto-plus": ("https://proto-plus-python.readthedocs.io/en/latest/", None), "protobuf": ("https://googleapis.dev/python/protobuf/latest/", None), diff --git a/google/cloud/compute_v1/services/accelerator_types/client.py b/google/cloud/compute_v1/services/accelerator_types/client.py index 3a5f8bd70..15497538b 100644 --- a/google/cloud/compute_v1/services/accelerator_types/client.py +++ b/google/cloud/compute_v1/services/accelerator_types/client.py @@ -53,7 +53,10 @@ class AcceleratorTypesClientMeta(type): ) # type: Dict[str, Type[AcceleratorTypesTransport]] _transport_registry["rest"] = AcceleratorTypesRestTransport - def get_transport_class(cls, label: str = None,) -> Type[AcceleratorTypesTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[AcceleratorTypesTransport]: """Returns an appropriate transport class. Args: @@ -160,7 +163,9 @@ def transport(self) -> AcceleratorTypesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -173,9 +178,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -184,9 +193,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -195,9 +208,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -206,10 +223,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -443,12 +464,20 @@ def aggregated_list( rpc = self._transport._wrapped_methods[self._transport.aggregated_list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.AggregatedListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -539,7 +568,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -616,12 +650,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -643,7 +685,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/accelerator_types/transports/base.py b/google/cloud/compute_v1/services/accelerator_types/transports/base.py index b2c96ca1d..7fd9ea6f9 100644 --- a/google/cloud/compute_v1/services/accelerator_types/transports/base.py +++ b/google/cloud/compute_v1/services/accelerator_types/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -123,22 +125,28 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.aggregated_list: gapic_v1.method.wrap_method( - self.aggregated_list, default_timeout=None, client_info=client_info, + self.aggregated_list, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/addresses/client.py b/google/cloud/compute_v1/services/addresses/client.py index 96437fc2f..946732c02 100644 --- a/google/cloud/compute_v1/services/addresses/client.py +++ b/google/cloud/compute_v1/services/addresses/client.py @@ -51,7 +51,10 @@ class AddressesClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[AddressesTransport]] _transport_registry["rest"] = AddressesRestTransport - def get_transport_class(cls, label: str = None,) -> Type[AddressesTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[AddressesTransport]: """Returns an appropriate transport class. Args: @@ -156,7 +159,9 @@ def transport(self) -> AddressesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -169,9 +174,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -180,9 +189,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -191,9 +204,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -202,10 +219,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -439,12 +460,20 @@ def aggregated_list( rpc = self._transport._wrapped_methods[self._transport.aggregated_list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.AggregatedListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -540,7 +569,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -626,7 +660,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -720,7 +759,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -794,12 +838,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -821,7 +873,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/addresses/transports/base.py b/google/cloud/compute_v1/services/addresses/transports/base.py index fbeb83aae..9aaad770a 100644 --- a/google/cloud/compute_v1/services/addresses/transports/base.py +++ b/google/cloud/compute_v1/services/addresses/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,28 +124,38 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.aggregated_list: gapic_v1.method.wrap_method( - self.aggregated_list, default_timeout=None, client_info=client_info, + self.aggregated_list, + default_timeout=None, + client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/autoscalers/client.py b/google/cloud/compute_v1/services/autoscalers/client.py index 338a56b57..704c71887 100644 --- a/google/cloud/compute_v1/services/autoscalers/client.py +++ b/google/cloud/compute_v1/services/autoscalers/client.py @@ -51,7 +51,10 @@ class AutoscalersClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[AutoscalersTransport]] _transport_registry["rest"] = AutoscalersRestTransport - def get_transport_class(cls, label: str = None,) -> Type[AutoscalersTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[AutoscalersTransport]: """Returns an appropriate transport class. Args: @@ -156,7 +159,9 @@ def transport(self) -> AutoscalersTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -169,9 +174,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -180,9 +189,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -191,9 +204,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -202,10 +219,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -439,12 +460,20 @@ def aggregated_list( rpc = self._transport._wrapped_methods[self._transport.aggregated_list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.AggregatedListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -538,7 +567,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -628,7 +662,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -722,7 +761,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -798,12 +842,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -900,7 +952,12 @@ def patch_unary( rpc = self._transport._wrapped_methods[self._transport.patch] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -994,7 +1051,12 @@ def update_unary( rpc = self._transport._wrapped_methods[self._transport.update] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1015,7 +1077,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/autoscalers/transports/base.py b/google/cloud/compute_v1/services/autoscalers/transports/base.py index 17ced7f56..0ff248d1f 100644 --- a/google/cloud/compute_v1/services/autoscalers/transports/base.py +++ b/google/cloud/compute_v1/services/autoscalers/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,34 +124,48 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.aggregated_list: gapic_v1.method.wrap_method( - self.aggregated_list, default_timeout=None, client_info=client_info, + self.aggregated_list, + default_timeout=None, + client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.patch: gapic_v1.method.wrap_method( - self.patch, default_timeout=None, client_info=client_info, + self.patch, + default_timeout=None, + client_info=client_info, ), self.update: gapic_v1.method.wrap_method( - self.update, default_timeout=None, client_info=client_info, + self.update, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/backend_buckets/client.py b/google/cloud/compute_v1/services/backend_buckets/client.py index 4f60bef1b..00bad1169 100644 --- a/google/cloud/compute_v1/services/backend_buckets/client.py +++ b/google/cloud/compute_v1/services/backend_buckets/client.py @@ -53,7 +53,10 @@ class BackendBucketsClientMeta(type): ) # type: Dict[str, Type[BackendBucketsTransport]] _transport_registry["rest"] = BackendBucketsRestTransport - def get_transport_class(cls, label: str = None,) -> Type[BackendBucketsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[BackendBucketsTransport]: """Returns an appropriate transport class. Args: @@ -158,7 +161,9 @@ def transport(self) -> BackendBucketsTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -171,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -182,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -193,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -204,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -474,7 +495,12 @@ def add_signed_url_key_unary( rpc = self._transport._wrapped_methods[self._transport.add_signed_url_key] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -561,7 +587,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -661,7 +692,12 @@ def delete_signed_url_key_unary( rpc = self._transport._wrapped_methods[self._transport.delete_signed_url_key] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -740,7 +776,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -826,7 +867,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -894,12 +940,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -998,7 +1052,12 @@ def patch_unary( rpc = self._transport._wrapped_methods[self._transport.patch] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1099,7 +1158,12 @@ def set_edge_security_policy_unary( rpc = self._transport._wrapped_methods[self._transport.set_edge_security_policy] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1195,7 +1259,12 @@ def update_unary( rpc = self._transport._wrapped_methods[self._transport.update] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1216,7 +1285,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/backend_buckets/transports/base.py b/google/cloud/compute_v1/services/backend_buckets/transports/base.py index be6d0db64..6740ea3e9 100644 --- a/google/cloud/compute_v1/services/backend_buckets/transports/base.py +++ b/google/cloud/compute_v1/services/backend_buckets/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,10 +124,14 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.add_signed_url_key: gapic_v1.method.wrap_method( - self.add_signed_url_key, default_timeout=None, client_info=client_info, + self.add_signed_url_key, + default_timeout=None, + client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.delete_signed_url_key: gapic_v1.method.wrap_method( self.delete_signed_url_key, @@ -133,16 +139,24 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.patch: gapic_v1.method.wrap_method( - self.patch, default_timeout=None, client_info=client_info, + self.patch, + default_timeout=None, + client_info=client_info, ), self.set_edge_security_policy: gapic_v1.method.wrap_method( self.set_edge_security_policy, @@ -150,16 +164,18 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.update: gapic_v1.method.wrap_method( - self.update, default_timeout=None, client_info=client_info, + self.update, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/backend_services/client.py b/google/cloud/compute_v1/services/backend_services/client.py index a6282dac9..d4d40b2b6 100644 --- a/google/cloud/compute_v1/services/backend_services/client.py +++ b/google/cloud/compute_v1/services/backend_services/client.py @@ -53,7 +53,10 @@ class BackendServicesClientMeta(type): ) # type: Dict[str, Type[BackendServicesTransport]] _transport_registry["rest"] = BackendServicesRestTransport - def get_transport_class(cls, label: str = None,) -> Type[BackendServicesTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[BackendServicesTransport]: """Returns an appropriate transport class. Args: @@ -158,7 +161,9 @@ def transport(self) -> BackendServicesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -171,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -182,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -193,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -204,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -474,7 +495,12 @@ def add_signed_url_key_unary( rpc = self._transport._wrapped_methods[self._transport.add_signed_url_key] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -544,12 +570,20 @@ def aggregated_list( rpc = self._transport._wrapped_methods[self._transport.aggregated_list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.AggregatedListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -637,7 +671,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -737,7 +776,12 @@ def delete_signed_url_key_unary( rpc = self._transport._wrapped_methods[self._transport.delete_signed_url_key] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -825,7 +869,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -911,7 +960,12 @@ def get_health( rpc = self._transport._wrapped_methods[self._transport.get_health] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -998,7 +1052,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1066,12 +1125,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1171,7 +1238,12 @@ def patch_unary( rpc = self._transport._wrapped_methods[self._transport.patch] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1273,7 +1345,12 @@ def set_edge_security_policy_unary( rpc = self._transport._wrapped_methods[self._transport.set_edge_security_policy] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1375,7 +1452,12 @@ def set_security_policy_unary( rpc = self._transport._wrapped_methods[self._transport.set_security_policy] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1472,7 +1554,12 @@ def update_unary( rpc = self._transport._wrapped_methods[self._transport.update] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1493,7 +1580,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/backend_services/transports/base.py b/google/cloud/compute_v1/services/backend_services/transports/base.py index 91b4f12c6..c83dceae5 100644 --- a/google/cloud/compute_v1/services/backend_services/transports/base.py +++ b/google/cloud/compute_v1/services/backend_services/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,13 +124,19 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.add_signed_url_key: gapic_v1.method.wrap_method( - self.add_signed_url_key, default_timeout=None, client_info=client_info, + self.add_signed_url_key, + default_timeout=None, + client_info=client_info, ), self.aggregated_list: gapic_v1.method.wrap_method( - self.aggregated_list, default_timeout=None, client_info=client_info, + self.aggregated_list, + default_timeout=None, + client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.delete_signed_url_key: gapic_v1.method.wrap_method( self.delete_signed_url_key, @@ -136,19 +144,29 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.get_health: gapic_v1.method.wrap_method( - self.get_health, default_timeout=None, client_info=client_info, + self.get_health, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.patch: gapic_v1.method.wrap_method( - self.patch, default_timeout=None, client_info=client_info, + self.patch, + default_timeout=None, + client_info=client_info, ), self.set_edge_security_policy: gapic_v1.method.wrap_method( self.set_edge_security_policy, @@ -156,19 +174,23 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.set_security_policy: gapic_v1.method.wrap_method( - self.set_security_policy, default_timeout=None, client_info=client_info, + self.set_security_policy, + default_timeout=None, + client_info=client_info, ), self.update: gapic_v1.method.wrap_method( - self.update, default_timeout=None, client_info=client_info, + self.update, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/disk_types/client.py b/google/cloud/compute_v1/services/disk_types/client.py index 2d27e2e77..3df0e6401 100644 --- a/google/cloud/compute_v1/services/disk_types/client.py +++ b/google/cloud/compute_v1/services/disk_types/client.py @@ -51,7 +51,10 @@ class DiskTypesClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[DiskTypesTransport]] _transport_registry["rest"] = DiskTypesRestTransport - def get_transport_class(cls, label: str = None,) -> Type[DiskTypesTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[DiskTypesTransport]: """Returns an appropriate transport class. Args: @@ -156,7 +159,9 @@ def transport(self) -> DiskTypesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -169,9 +174,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -180,9 +189,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -191,9 +204,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -202,10 +219,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -439,12 +460,20 @@ def aggregated_list( rpc = self._transport._wrapped_methods[self._transport.aggregated_list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.AggregatedListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -536,7 +565,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -612,12 +646,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -639,7 +681,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/disk_types/transports/base.py b/google/cloud/compute_v1/services/disk_types/transports/base.py index 512e9e766..b5faaa609 100644 --- a/google/cloud/compute_v1/services/disk_types/transports/base.py +++ b/google/cloud/compute_v1/services/disk_types/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -123,22 +125,28 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.aggregated_list: gapic_v1.method.wrap_method( - self.aggregated_list, default_timeout=None, client_info=client_info, + self.aggregated_list, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/disks/client.py b/google/cloud/compute_v1/services/disks/client.py index c690c23c6..76562a4b1 100644 --- a/google/cloud/compute_v1/services/disks/client.py +++ b/google/cloud/compute_v1/services/disks/client.py @@ -51,7 +51,10 @@ class DisksClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[DisksTransport]] _transport_registry["rest"] = DisksRestTransport - def get_transport_class(cls, label: str = None,) -> Type[DisksTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[DisksTransport]: """Returns an appropriate transport class. Args: @@ -156,7 +159,9 @@ def transport(self) -> DisksTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -169,9 +174,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -180,9 +189,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -191,9 +204,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -202,10 +219,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -483,7 +504,12 @@ def add_resource_policies_unary( rpc = self._transport._wrapped_methods[self._transport.add_resource_policies] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -548,12 +574,20 @@ def aggregated_list( rpc = self._transport._wrapped_methods[self._transport.aggregated_list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.AggregatedListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -663,7 +697,12 @@ def create_snapshot_unary( rpc = self._transport._wrapped_methods[self._transport.create_snapshot] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -763,7 +802,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -857,7 +901,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -980,7 +1029,12 @@ def get_iam_policy( rpc = self._transport._wrapped_methods[self._transport.get_iam_policy] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1080,7 +1134,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1156,12 +1215,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1269,7 +1336,12 @@ def remove_resource_policies_unary( rpc = self._transport._wrapped_methods[self._transport.remove_resource_policies] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1372,7 +1444,12 @@ def resize_unary( rpc = self._transport._wrapped_methods[self._transport.resize] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1507,7 +1584,12 @@ def set_iam_policy( rpc = self._transport._wrapped_methods[self._transport.set_iam_policy] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1616,7 +1698,12 @@ def set_labels_unary( rpc = self._transport._wrapped_methods[self._transport.set_labels] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1711,7 +1798,12 @@ def test_iam_permissions( rpc = self._transport._wrapped_methods[self._transport.test_iam_permissions] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1732,7 +1824,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/disks/transports/base.py b/google/cloud/compute_v1/services/disks/transports/base.py index 5eb65f42c..1b8efd44a 100644 --- a/google/cloud/compute_v1/services/disks/transports/base.py +++ b/google/cloud/compute_v1/services/disks/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -127,25 +129,39 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.aggregated_list: gapic_v1.method.wrap_method( - self.aggregated_list, default_timeout=None, client_info=client_info, + self.aggregated_list, + default_timeout=None, + client_info=client_info, ), self.create_snapshot: gapic_v1.method.wrap_method( - self.create_snapshot, default_timeout=None, client_info=client_info, + self.create_snapshot, + default_timeout=None, + client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.get_iam_policy: gapic_v1.method.wrap_method( - self.get_iam_policy, default_timeout=None, client_info=client_info, + self.get_iam_policy, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.remove_resource_policies: gapic_v1.method.wrap_method( self.remove_resource_policies, @@ -153,13 +169,19 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.resize: gapic_v1.method.wrap_method( - self.resize, default_timeout=None, client_info=client_info, + self.resize, + default_timeout=None, + client_info=client_info, ), self.set_iam_policy: gapic_v1.method.wrap_method( - self.set_iam_policy, default_timeout=None, client_info=client_info, + self.set_iam_policy, + default_timeout=None, + client_info=client_info, ), self.set_labels: gapic_v1.method.wrap_method( - self.set_labels, default_timeout=None, client_info=client_info, + self.set_labels, + default_timeout=None, + client_info=client_info, ), self.test_iam_permissions: gapic_v1.method.wrap_method( self.test_iam_permissions, @@ -171,9 +193,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/external_vpn_gateways/client.py b/google/cloud/compute_v1/services/external_vpn_gateways/client.py index 8fc02ad2b..1846aafd0 100644 --- a/google/cloud/compute_v1/services/external_vpn_gateways/client.py +++ b/google/cloud/compute_v1/services/external_vpn_gateways/client.py @@ -54,7 +54,8 @@ class ExternalVpnGatewaysClientMeta(type): _transport_registry["rest"] = ExternalVpnGatewaysRestTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[ExternalVpnGatewaysTransport]: """Returns an appropriate transport class. @@ -160,7 +161,9 @@ def transport(self) -> ExternalVpnGatewaysTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -173,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -184,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -195,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -206,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -465,7 +484,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -553,7 +577,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -639,7 +668,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -707,12 +741,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -814,7 +856,12 @@ def set_labels_unary( rpc = self._transport._wrapped_methods[self._transport.set_labels] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -901,7 +948,12 @@ def test_iam_permissions( rpc = self._transport._wrapped_methods[self._transport.test_iam_permissions] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -922,7 +974,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/external_vpn_gateways/transports/base.py b/google/cloud/compute_v1/services/external_vpn_gateways/transports/base.py index 352b12327..6a5b7459a 100644 --- a/google/cloud/compute_v1/services/external_vpn_gateways/transports/base.py +++ b/google/cloud/compute_v1/services/external_vpn_gateways/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,19 +124,29 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.set_labels: gapic_v1.method.wrap_method( - self.set_labels, default_timeout=None, client_info=client_info, + self.set_labels, + default_timeout=None, + client_info=client_info, ), self.test_iam_permissions: gapic_v1.method.wrap_method( self.test_iam_permissions, @@ -146,9 +158,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/external_vpn_gateways/transports/rest.py b/google/cloud/compute_v1/services/external_vpn_gateways/transports/rest.py index 4edb56cba..f78fb2cdf 100644 --- a/google/cloud/compute_v1/services/external_vpn_gateways/transports/rest.py +++ b/google/cloud/compute_v1/services/external_vpn_gateways/transports/rest.py @@ -919,8 +919,8 @@ def __call__( request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) - request_kwargs = compute.TestIamPermissionsExternalVpnGatewayRequest.to_dict( - request + request_kwargs = ( + compute.TestIamPermissionsExternalVpnGatewayRequest.to_dict(request) ) transcoded_request = path_template.transcode(http_options, **request_kwargs) diff --git a/google/cloud/compute_v1/services/firewall_policies/client.py b/google/cloud/compute_v1/services/firewall_policies/client.py index 64476d335..0f1aa06d8 100644 --- a/google/cloud/compute_v1/services/firewall_policies/client.py +++ b/google/cloud/compute_v1/services/firewall_policies/client.py @@ -53,7 +53,10 @@ class FirewallPoliciesClientMeta(type): ) # type: Dict[str, Type[FirewallPoliciesTransport]] _transport_registry["rest"] = FirewallPoliciesRestTransport - def get_transport_class(cls, label: str = None,) -> Type[FirewallPoliciesTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[FirewallPoliciesTransport]: """Returns an appropriate transport class. Args: @@ -158,7 +161,9 @@ def transport(self) -> FirewallPoliciesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -171,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -182,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -193,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -204,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -468,7 +489,12 @@ def add_association_unary( rpc = self._transport._wrapped_methods[self._transport.add_association] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -555,7 +581,12 @@ def add_rule_unary( rpc = self._transport._wrapped_methods[self._transport.add_rule] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -634,7 +665,12 @@ def clone_rules_unary( rpc = self._transport._wrapped_methods[self._transport.clone_rules] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -713,7 +749,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -777,7 +818,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -841,7 +887,12 @@ def get_association( rpc = self._transport._wrapped_methods[self._transport.get_association] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -946,7 +997,12 @@ def get_iam_policy( rpc = self._transport._wrapped_methods[self._transport.get_iam_policy] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1014,7 +1070,12 @@ def get_rule( rpc = self._transport._wrapped_methods[self._transport.get_rule] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1104,7 +1165,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1151,12 +1217,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1201,7 +1275,12 @@ def list_associations( rpc = self._transport._wrapped_methods[self._transport.list_associations] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1290,7 +1369,12 @@ def move_unary( rpc = self._transport._wrapped_methods[self._transport.move] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1378,7 +1462,12 @@ def patch_unary( rpc = self._transport._wrapped_methods[self._transport.patch] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1465,7 +1554,12 @@ def patch_rule_unary( rpc = self._transport._wrapped_methods[self._transport.patch_rule] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1545,7 +1639,12 @@ def remove_association_unary( rpc = self._transport._wrapped_methods[self._transport.remove_association] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1624,7 +1723,12 @@ def remove_rule_unary( rpc = self._transport._wrapped_methods[self._transport.remove_rule] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1741,7 +1845,12 @@ def set_iam_policy( rpc = self._transport._wrapped_methods[self._transport.set_iam_policy] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1816,7 +1925,12 @@ def test_iam_permissions( rpc = self._transport._wrapped_methods[self._transport.test_iam_permissions] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1837,7 +1951,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/firewall_policies/transports/base.py b/google/cloud/compute_v1/services/firewall_policies/transports/base.py index c6a31296d..10c48b4a9 100644 --- a/google/cloud/compute_v1/services/firewall_policies/transports/base.py +++ b/google/cloud/compute_v1/services/firewall_policies/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,55 +124,89 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.add_association: gapic_v1.method.wrap_method( - self.add_association, default_timeout=None, client_info=client_info, + self.add_association, + default_timeout=None, + client_info=client_info, ), self.add_rule: gapic_v1.method.wrap_method( - self.add_rule, default_timeout=None, client_info=client_info, + self.add_rule, + default_timeout=None, + client_info=client_info, ), self.clone_rules: gapic_v1.method.wrap_method( - self.clone_rules, default_timeout=None, client_info=client_info, + self.clone_rules, + default_timeout=None, + client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.get_association: gapic_v1.method.wrap_method( - self.get_association, default_timeout=None, client_info=client_info, + self.get_association, + default_timeout=None, + client_info=client_info, ), self.get_iam_policy: gapic_v1.method.wrap_method( - self.get_iam_policy, default_timeout=None, client_info=client_info, + self.get_iam_policy, + default_timeout=None, + client_info=client_info, ), self.get_rule: gapic_v1.method.wrap_method( - self.get_rule, default_timeout=None, client_info=client_info, + self.get_rule, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.list_associations: gapic_v1.method.wrap_method( - self.list_associations, default_timeout=None, client_info=client_info, + self.list_associations, + default_timeout=None, + client_info=client_info, ), self.move: gapic_v1.method.wrap_method( - self.move, default_timeout=None, client_info=client_info, + self.move, + default_timeout=None, + client_info=client_info, ), self.patch: gapic_v1.method.wrap_method( - self.patch, default_timeout=None, client_info=client_info, + self.patch, + default_timeout=None, + client_info=client_info, ), self.patch_rule: gapic_v1.method.wrap_method( - self.patch_rule, default_timeout=None, client_info=client_info, + self.patch_rule, + default_timeout=None, + client_info=client_info, ), self.remove_association: gapic_v1.method.wrap_method( - self.remove_association, default_timeout=None, client_info=client_info, + self.remove_association, + default_timeout=None, + client_info=client_info, ), self.remove_rule: gapic_v1.method.wrap_method( - self.remove_rule, default_timeout=None, client_info=client_info, + self.remove_rule, + default_timeout=None, + client_info=client_info, ), self.set_iam_policy: gapic_v1.method.wrap_method( - self.set_iam_policy, default_timeout=None, client_info=client_info, + self.set_iam_policy, + default_timeout=None, + client_info=client_info, ), self.test_iam_permissions: gapic_v1.method.wrap_method( self.test_iam_permissions, @@ -182,9 +218,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/firewalls/client.py b/google/cloud/compute_v1/services/firewalls/client.py index e1861a5d6..d2bbc3a64 100644 --- a/google/cloud/compute_v1/services/firewalls/client.py +++ b/google/cloud/compute_v1/services/firewalls/client.py @@ -51,7 +51,10 @@ class FirewallsClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[FirewallsTransport]] _transport_registry["rest"] = FirewallsRestTransport - def get_transport_class(cls, label: str = None,) -> Type[FirewallsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[FirewallsTransport]: """Returns an appropriate transport class. Args: @@ -156,7 +159,9 @@ def transport(self) -> FirewallsTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -169,9 +174,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -180,9 +189,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -191,9 +204,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -202,10 +219,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -459,7 +480,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -533,7 +559,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -619,7 +650,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -685,12 +721,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -786,7 +830,12 @@ def patch_unary( rpc = self._transport._wrapped_methods[self._transport.patch] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -883,7 +932,12 @@ def update_unary( rpc = self._transport._wrapped_methods[self._transport.update] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -904,7 +958,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/firewalls/transports/base.py b/google/cloud/compute_v1/services/firewalls/transports/base.py index e558e72c2..4f9ecc4d9 100644 --- a/google/cloud/compute_v1/services/firewalls/transports/base.py +++ b/google/cloud/compute_v1/services/firewalls/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,31 +124,43 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.patch: gapic_v1.method.wrap_method( - self.patch, default_timeout=None, client_info=client_info, + self.patch, + default_timeout=None, + client_info=client_info, ), self.update: gapic_v1.method.wrap_method( - self.update, default_timeout=None, client_info=client_info, + self.update, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/forwarding_rules/client.py b/google/cloud/compute_v1/services/forwarding_rules/client.py index b1e92d1a1..a7c0aaa73 100644 --- a/google/cloud/compute_v1/services/forwarding_rules/client.py +++ b/google/cloud/compute_v1/services/forwarding_rules/client.py @@ -53,7 +53,10 @@ class ForwardingRulesClientMeta(type): ) # type: Dict[str, Type[ForwardingRulesTransport]] _transport_registry["rest"] = ForwardingRulesRestTransport - def get_transport_class(cls, label: str = None,) -> Type[ForwardingRulesTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[ForwardingRulesTransport]: """Returns an appropriate transport class. Args: @@ -158,7 +161,9 @@ def transport(self) -> ForwardingRulesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -171,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -182,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -193,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -204,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -441,12 +462,20 @@ def aggregated_list( rpc = self._transport._wrapped_methods[self._transport.aggregated_list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.AggregatedListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -544,7 +573,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -638,7 +672,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -735,7 +774,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -813,12 +857,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -929,7 +981,12 @@ def patch_unary( rpc = self._transport._wrapped_methods[self._transport.patch] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1038,7 +1095,12 @@ def set_labels_unary( rpc = self._transport._wrapped_methods[self._transport.set_labels] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1146,7 +1208,12 @@ def set_target_unary( rpc = self._transport._wrapped_methods[self._transport.set_target] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1167,7 +1234,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/forwarding_rules/transports/base.py b/google/cloud/compute_v1/services/forwarding_rules/transports/base.py index 007de6ef7..d0beee2c8 100644 --- a/google/cloud/compute_v1/services/forwarding_rules/transports/base.py +++ b/google/cloud/compute_v1/services/forwarding_rules/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,37 +124,53 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.aggregated_list: gapic_v1.method.wrap_method( - self.aggregated_list, default_timeout=None, client_info=client_info, + self.aggregated_list, + default_timeout=None, + client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.patch: gapic_v1.method.wrap_method( - self.patch, default_timeout=None, client_info=client_info, + self.patch, + default_timeout=None, + client_info=client_info, ), self.set_labels: gapic_v1.method.wrap_method( - self.set_labels, default_timeout=None, client_info=client_info, + self.set_labels, + default_timeout=None, + client_info=client_info, ), self.set_target: gapic_v1.method.wrap_method( - self.set_target, default_timeout=None, client_info=client_info, + self.set_target, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/global_addresses/client.py b/google/cloud/compute_v1/services/global_addresses/client.py index 56661e785..326e398d1 100644 --- a/google/cloud/compute_v1/services/global_addresses/client.py +++ b/google/cloud/compute_v1/services/global_addresses/client.py @@ -53,7 +53,10 @@ class GlobalAddressesClientMeta(type): ) # type: Dict[str, Type[GlobalAddressesTransport]] _transport_registry["rest"] = GlobalAddressesRestTransport - def get_transport_class(cls, label: str = None,) -> Type[GlobalAddressesTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[GlobalAddressesTransport]: """Returns an appropriate transport class. Args: @@ -158,7 +161,9 @@ def transport(self) -> GlobalAddressesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -171,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -182,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -193,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -204,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -463,7 +484,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -543,7 +569,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -629,7 +660,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -695,12 +731,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -722,7 +766,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/global_addresses/transports/base.py b/google/cloud/compute_v1/services/global_addresses/transports/base.py index 0d358e62c..c2224499b 100644 --- a/google/cloud/compute_v1/services/global_addresses/transports/base.py +++ b/google/cloud/compute_v1/services/global_addresses/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,25 +124,33 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/global_forwarding_rules/client.py b/google/cloud/compute_v1/services/global_forwarding_rules/client.py index 22cd7a9c8..8edb12412 100644 --- a/google/cloud/compute_v1/services/global_forwarding_rules/client.py +++ b/google/cloud/compute_v1/services/global_forwarding_rules/client.py @@ -54,7 +54,8 @@ class GlobalForwardingRulesClientMeta(type): _transport_registry["rest"] = GlobalForwardingRulesRestTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[GlobalForwardingRulesTransport]: """Returns an appropriate transport class. @@ -160,7 +161,9 @@ def transport(self) -> GlobalForwardingRulesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -173,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -184,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -195,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -206,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -465,7 +484,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -551,7 +575,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -638,7 +667,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -706,12 +740,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -810,7 +852,12 @@ def patch_unary( rpc = self._transport._wrapped_methods[self._transport.patch] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -911,7 +958,12 @@ def set_labels_unary( rpc = self._transport._wrapped_methods[self._transport.set_labels] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1010,7 +1062,12 @@ def set_target_unary( rpc = self._transport._wrapped_methods[self._transport.set_target] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1031,7 +1088,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/global_forwarding_rules/transports/base.py b/google/cloud/compute_v1/services/global_forwarding_rules/transports/base.py index 56b3fda91..1249dbd2f 100644 --- a/google/cloud/compute_v1/services/global_forwarding_rules/transports/base.py +++ b/google/cloud/compute_v1/services/global_forwarding_rules/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,34 +124,48 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.patch: gapic_v1.method.wrap_method( - self.patch, default_timeout=None, client_info=client_info, + self.patch, + default_timeout=None, + client_info=client_info, ), self.set_labels: gapic_v1.method.wrap_method( - self.set_labels, default_timeout=None, client_info=client_info, + self.set_labels, + default_timeout=None, + client_info=client_info, ), self.set_target: gapic_v1.method.wrap_method( - self.set_target, default_timeout=None, client_info=client_info, + self.set_target, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/global_network_endpoint_groups/client.py b/google/cloud/compute_v1/services/global_network_endpoint_groups/client.py index 31fbf8d16..a4227738e 100644 --- a/google/cloud/compute_v1/services/global_network_endpoint_groups/client.py +++ b/google/cloud/compute_v1/services/global_network_endpoint_groups/client.py @@ -54,7 +54,8 @@ class GlobalNetworkEndpointGroupsClientMeta(type): _transport_registry["rest"] = GlobalNetworkEndpointGroupsRestTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[GlobalNetworkEndpointGroupsTransport]: """Returns an appropriate transport class. @@ -162,7 +163,9 @@ def transport(self) -> GlobalNetworkEndpointGroupsTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -175,9 +178,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -186,9 +193,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -197,9 +208,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -208,10 +223,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -495,7 +514,12 @@ def attach_network_endpoints_unary( rpc = self._transport._wrapped_methods[self._transport.attach_network_endpoints] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -585,7 +609,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -700,7 +729,12 @@ def detach_network_endpoints_unary( rpc = self._transport._wrapped_methods[self._transport.detach_network_endpoints] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -785,7 +819,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -874,7 +913,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -940,12 +984,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1030,12 +1082,20 @@ def list_network_endpoints( rpc = self._transport._wrapped_methods[self._transport.list_network_endpoints] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListNetworkEndpointsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1057,7 +1117,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/global_network_endpoint_groups/transports/base.py b/google/cloud/compute_v1/services/global_network_endpoint_groups/transports/base.py index f7ec08807..b289b0e4f 100644 --- a/google/cloud/compute_v1/services/global_network_endpoint_groups/transports/base.py +++ b/google/cloud/compute_v1/services/global_network_endpoint_groups/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -127,7 +129,9 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.detach_network_endpoints: gapic_v1.method.wrap_method( self.detach_network_endpoints, @@ -135,13 +139,19 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.list_network_endpoints: gapic_v1.method.wrap_method( self.list_network_endpoints, @@ -153,9 +163,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/global_network_endpoint_groups/transports/rest.py b/google/cloud/compute_v1/services/global_network_endpoint_groups/transports/rest.py index a5c003148..21f8c6166 100644 --- a/google/cloud/compute_v1/services/global_network_endpoint_groups/transports/rest.py +++ b/google/cloud/compute_v1/services/global_network_endpoint_groups/transports/rest.py @@ -457,8 +457,10 @@ def __call__( request, metadata = self._interceptor.pre_attach_network_endpoints( request, metadata ) - request_kwargs = compute.AttachNetworkEndpointsGlobalNetworkEndpointGroupRequest.to_dict( - request + request_kwargs = ( + compute.AttachNetworkEndpointsGlobalNetworkEndpointGroupRequest.to_dict( + request + ) ) transcoded_request = path_template.transcode(http_options, **request_kwargs) @@ -681,8 +683,10 @@ def __call__( request, metadata = self._interceptor.pre_detach_network_endpoints( request, metadata ) - request_kwargs = compute.DetachNetworkEndpointsGlobalNetworkEndpointGroupRequest.to_dict( - request + request_kwargs = ( + compute.DetachNetworkEndpointsGlobalNetworkEndpointGroupRequest.to_dict( + request + ) ) transcoded_request = path_template.transcode(http_options, **request_kwargs) @@ -1090,8 +1094,10 @@ def __call__( request, metadata = self._interceptor.pre_list_network_endpoints( request, metadata ) - request_kwargs = compute.ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest.to_dict( - request + request_kwargs = ( + compute.ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest.to_dict( + request + ) ) transcoded_request = path_template.transcode(http_options, **request_kwargs) diff --git a/google/cloud/compute_v1/services/global_operations/client.py b/google/cloud/compute_v1/services/global_operations/client.py index 6500109c9..211302584 100644 --- a/google/cloud/compute_v1/services/global_operations/client.py +++ b/google/cloud/compute_v1/services/global_operations/client.py @@ -53,7 +53,10 @@ class GlobalOperationsClientMeta(type): ) # type: Dict[str, Type[GlobalOperationsTransport]] _transport_registry["rest"] = GlobalOperationsRestTransport - def get_transport_class(cls, label: str = None,) -> Type[GlobalOperationsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[GlobalOperationsTransport]: """Returns an appropriate transport class. Args: @@ -158,7 +161,9 @@ def transport(self) -> GlobalOperationsTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -171,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -182,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -193,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -204,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -441,12 +462,20 @@ def aggregated_list( rpc = self._transport._wrapped_methods[self._transport.aggregated_list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.AggregatedListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -522,7 +551,12 @@ def delete( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -609,7 +643,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -677,12 +716,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -782,7 +829,12 @@ def wait( rpc = self._transport._wrapped_methods[self._transport.wait] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -803,7 +855,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/global_operations/transports/base.py b/google/cloud/compute_v1/services/global_operations/transports/base.py index e646b8d67..cc66e8598 100644 --- a/google/cloud/compute_v1/services/global_operations/transports/base.py +++ b/google/cloud/compute_v1/services/global_operations/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,28 +124,38 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.aggregated_list: gapic_v1.method.wrap_method( - self.aggregated_list, default_timeout=None, client_info=client_info, + self.aggregated_list, + default_timeout=None, + client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.wait: gapic_v1.method.wrap_method( - self.wait, default_timeout=None, client_info=client_info, + self.wait, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/global_organization_operations/client.py b/google/cloud/compute_v1/services/global_organization_operations/client.py index 50bf9a6b3..9d9e2f127 100644 --- a/google/cloud/compute_v1/services/global_organization_operations/client.py +++ b/google/cloud/compute_v1/services/global_organization_operations/client.py @@ -54,7 +54,8 @@ class GlobalOrganizationOperationsClientMeta(type): _transport_registry["rest"] = GlobalOrganizationOperationsRestTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[GlobalOrganizationOperationsTransport]: """Returns an appropriate transport class. @@ -162,7 +163,9 @@ def transport(self) -> GlobalOrganizationOperationsTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -175,9 +178,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -186,9 +193,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -197,9 +208,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -208,10 +223,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -447,7 +466,12 @@ def delete( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -527,7 +551,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -576,12 +605,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -603,7 +640,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/global_organization_operations/transports/base.py b/google/cloud/compute_v1/services/global_organization_operations/transports/base.py index 2cc123fcd..3e7d4caaa 100644 --- a/google/cloud/compute_v1/services/global_organization_operations/transports/base.py +++ b/google/cloud/compute_v1/services/global_organization_operations/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,22 +124,28 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/global_organization_operations/transports/rest.py b/google/cloud/compute_v1/services/global_organization_operations/transports/rest.py index d3e23c2e2..375ffbb6e 100644 --- a/google/cloud/compute_v1/services/global_organization_operations/transports/rest.py +++ b/google/cloud/compute_v1/services/global_organization_operations/transports/rest.py @@ -496,7 +496,10 @@ def __call__( """ http_options: List[Dict[str, str]] = [ - {"method": "get", "uri": "/compute/v1/locations/global/operations",}, + { + "method": "get", + "uri": "/compute/v1/locations/global/operations", + }, ] request, metadata = self._interceptor.pre_list(request, metadata) request_kwargs = compute.ListGlobalOrganizationOperationsRequest.to_dict( diff --git a/google/cloud/compute_v1/services/global_public_delegated_prefixes/client.py b/google/cloud/compute_v1/services/global_public_delegated_prefixes/client.py index 5726df920..df06e43c7 100644 --- a/google/cloud/compute_v1/services/global_public_delegated_prefixes/client.py +++ b/google/cloud/compute_v1/services/global_public_delegated_prefixes/client.py @@ -54,7 +54,8 @@ class GlobalPublicDelegatedPrefixesClientMeta(type): _transport_registry["rest"] = GlobalPublicDelegatedPrefixesRestTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[GlobalPublicDelegatedPrefixesTransport]: """Returns an appropriate transport class. @@ -162,7 +163,9 @@ def transport(self) -> GlobalPublicDelegatedPrefixesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -175,9 +178,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -186,9 +193,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -197,9 +208,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -208,10 +223,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -467,7 +486,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -549,7 +573,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -638,7 +667,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -704,12 +738,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -812,7 +854,12 @@ def patch_unary( rpc = self._transport._wrapped_methods[self._transport.patch] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -833,7 +880,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/global_public_delegated_prefixes/transports/base.py b/google/cloud/compute_v1/services/global_public_delegated_prefixes/transports/base.py index b858b8086..e2f7aa7f1 100644 --- a/google/cloud/compute_v1/services/global_public_delegated_prefixes/transports/base.py +++ b/google/cloud/compute_v1/services/global_public_delegated_prefixes/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,28 +124,38 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.patch: gapic_v1.method.wrap_method( - self.patch, default_timeout=None, client_info=client_info, + self.patch, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/health_checks/client.py b/google/cloud/compute_v1/services/health_checks/client.py index c6ad28573..ade7a237e 100644 --- a/google/cloud/compute_v1/services/health_checks/client.py +++ b/google/cloud/compute_v1/services/health_checks/client.py @@ -51,7 +51,10 @@ class HealthChecksClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[HealthChecksTransport]] _transport_registry["rest"] = HealthChecksRestTransport - def get_transport_class(cls, label: str = None,) -> Type[HealthChecksTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[HealthChecksTransport]: """Returns an appropriate transport class. Args: @@ -156,7 +159,9 @@ def transport(self) -> HealthChecksTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -169,9 +174,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -180,9 +189,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -191,9 +204,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -202,10 +219,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -442,12 +463,20 @@ def aggregated_list( rpc = self._transport._wrapped_methods[self._transport.aggregated_list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.AggregatedListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -535,7 +564,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -628,7 +662,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -714,7 +753,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -782,12 +826,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -886,7 +938,12 @@ def patch_unary( rpc = self._transport._wrapped_methods[self._transport.patch] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -982,7 +1039,12 @@ def update_unary( rpc = self._transport._wrapped_methods[self._transport.update] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1003,7 +1065,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/health_checks/transports/base.py b/google/cloud/compute_v1/services/health_checks/transports/base.py index e7a567492..feb1eb7ff 100644 --- a/google/cloud/compute_v1/services/health_checks/transports/base.py +++ b/google/cloud/compute_v1/services/health_checks/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,34 +124,48 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.aggregated_list: gapic_v1.method.wrap_method( - self.aggregated_list, default_timeout=None, client_info=client_info, + self.aggregated_list, + default_timeout=None, + client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.patch: gapic_v1.method.wrap_method( - self.patch, default_timeout=None, client_info=client_info, + self.patch, + default_timeout=None, + client_info=client_info, ), self.update: gapic_v1.method.wrap_method( - self.update, default_timeout=None, client_info=client_info, + self.update, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/image_family_views/client.py b/google/cloud/compute_v1/services/image_family_views/client.py index 19bcd1eed..b0c3897c4 100644 --- a/google/cloud/compute_v1/services/image_family_views/client.py +++ b/google/cloud/compute_v1/services/image_family_views/client.py @@ -52,7 +52,10 @@ class ImageFamilyViewsClientMeta(type): ) # type: Dict[str, Type[ImageFamilyViewsTransport]] _transport_registry["rest"] = ImageFamilyViewsRestTransport - def get_transport_class(cls, label: str = None,) -> Type[ImageFamilyViewsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[ImageFamilyViewsTransport]: """Returns an appropriate transport class. Args: @@ -157,7 +160,9 @@ def transport(self) -> ImageFamilyViewsTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -170,9 +175,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -181,9 +190,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -192,9 +205,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -203,10 +220,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -459,7 +480,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -480,7 +506,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/image_family_views/transports/base.py b/google/cloud/compute_v1/services/image_family_views/transports/base.py index ef58807e8..96875805a 100644 --- a/google/cloud/compute_v1/services/image_family_views/transports/base.py +++ b/google/cloud/compute_v1/services/image_family_views/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -123,16 +125,18 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/images/client.py b/google/cloud/compute_v1/services/images/client.py index 438d862aa..1b39ec338 100644 --- a/google/cloud/compute_v1/services/images/client.py +++ b/google/cloud/compute_v1/services/images/client.py @@ -51,7 +51,10 @@ class ImagesClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[ImagesTransport]] _transport_registry["rest"] = ImagesRestTransport - def get_transport_class(cls, label: str = None,) -> Type[ImagesTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[ImagesTransport]: """Returns an appropriate transport class. Args: @@ -156,7 +159,9 @@ def transport(self) -> ImagesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -169,9 +174,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -180,9 +189,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -191,9 +204,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -202,10 +219,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -458,7 +479,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -553,7 +579,12 @@ def deprecate_unary( rpc = self._transport._wrapped_methods[self._transport.deprecate] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -627,7 +658,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -704,7 +740,12 @@ def get_from_family( rpc = self._transport._wrapped_methods[self._transport.get_from_family] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -817,7 +858,12 @@ def get_iam_policy( rpc = self._transport._wrapped_methods[self._transport.get_iam_policy] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -902,7 +948,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -974,12 +1025,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1074,7 +1133,12 @@ def patch_unary( rpc = self._transport._wrapped_methods[self._transport.patch] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1199,7 +1263,12 @@ def set_iam_policy( rpc = self._transport._wrapped_methods[self._transport.set_iam_policy] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1299,7 +1368,12 @@ def set_labels_unary( rpc = self._transport._wrapped_methods[self._transport.set_labels] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1384,7 +1458,12 @@ def test_iam_permissions( rpc = self._transport._wrapped_methods[self._transport.test_iam_permissions] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1405,7 +1484,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/images/transports/base.py b/google/cloud/compute_v1/services/images/transports/base.py index cf427a815..5b8f5cce7 100644 --- a/google/cloud/compute_v1/services/images/transports/base.py +++ b/google/cloud/compute_v1/services/images/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,34 +124,54 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.deprecate: gapic_v1.method.wrap_method( - self.deprecate, default_timeout=None, client_info=client_info, + self.deprecate, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.get_from_family: gapic_v1.method.wrap_method( - self.get_from_family, default_timeout=None, client_info=client_info, + self.get_from_family, + default_timeout=None, + client_info=client_info, ), self.get_iam_policy: gapic_v1.method.wrap_method( - self.get_iam_policy, default_timeout=None, client_info=client_info, + self.get_iam_policy, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.patch: gapic_v1.method.wrap_method( - self.patch, default_timeout=None, client_info=client_info, + self.patch, + default_timeout=None, + client_info=client_info, ), self.set_iam_policy: gapic_v1.method.wrap_method( - self.set_iam_policy, default_timeout=None, client_info=client_info, + self.set_iam_policy, + default_timeout=None, + client_info=client_info, ), self.set_labels: gapic_v1.method.wrap_method( - self.set_labels, default_timeout=None, client_info=client_info, + self.set_labels, + default_timeout=None, + client_info=client_info, ), self.test_iam_permissions: gapic_v1.method.wrap_method( self.test_iam_permissions, @@ -161,9 +183,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/instance_group_managers/client.py b/google/cloud/compute_v1/services/instance_group_managers/client.py index 7db2d3aa7..921236396 100644 --- a/google/cloud/compute_v1/services/instance_group_managers/client.py +++ b/google/cloud/compute_v1/services/instance_group_managers/client.py @@ -54,7 +54,8 @@ class InstanceGroupManagersClientMeta(type): _transport_registry["rest"] = InstanceGroupManagersRestTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[InstanceGroupManagersTransport]: """Returns an appropriate transport class. @@ -160,7 +161,9 @@ def transport(self) -> InstanceGroupManagersTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -173,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -184,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -195,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -206,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -510,7 +529,12 @@ def abandon_instances_unary( rpc = self._transport._wrapped_methods[self._transport.abandon_instances] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -576,12 +600,20 @@ def aggregated_list( rpc = self._transport._wrapped_methods[self._transport.aggregated_list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.AggregatedListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -707,7 +739,12 @@ def apply_updates_to_instances_unary( ] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -829,7 +866,12 @@ def create_instances_unary( rpc = self._transport._wrapped_methods[self._transport.create_instances] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -929,7 +971,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1057,7 +1104,12 @@ def delete_instances_unary( rpc = self._transport._wrapped_methods[self._transport.delete_instances] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1184,7 +1236,12 @@ def delete_per_instance_configs_unary( ] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1277,7 +1334,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1384,7 +1446,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1461,12 +1528,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1557,12 +1632,20 @@ def list_errors( rpc = self._transport._wrapped_methods[self._transport.list_errors] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListErrorsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1659,12 +1742,20 @@ def list_managed_instances( rpc = self._transport._wrapped_methods[self._transport.list_managed_instances] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListManagedInstancesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1761,12 +1852,20 @@ def list_per_instance_configs( ] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPerInstanceConfigsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1889,7 +1988,12 @@ def patch_unary( rpc = self._transport._wrapped_methods[self._transport.patch] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2018,7 +2122,12 @@ def patch_per_instance_configs_unary( ] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2149,7 +2258,12 @@ def recreate_instances_unary( rpc = self._transport._wrapped_methods[self._transport.recreate_instances] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2279,7 +2393,12 @@ def resize_unary( rpc = self._transport._wrapped_methods[self._transport.resize] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2404,7 +2523,12 @@ def set_instance_template_unary( rpc = self._transport._wrapped_methods[self._transport.set_instance_template] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2525,7 +2649,12 @@ def set_target_pools_unary( rpc = self._transport._wrapped_methods[self._transport.set_target_pools] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2654,7 +2783,12 @@ def update_per_instance_configs_unary( ] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2675,7 +2809,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/instance_group_managers/transports/base.py b/google/cloud/compute_v1/services/instance_group_managers/transports/base.py index d3c9a113a..5875032a6 100644 --- a/google/cloud/compute_v1/services/instance_group_managers/transports/base.py +++ b/google/cloud/compute_v1/services/instance_group_managers/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,10 +124,14 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.abandon_instances: gapic_v1.method.wrap_method( - self.abandon_instances, default_timeout=None, client_info=client_info, + self.abandon_instances, + default_timeout=None, + client_info=client_info, ), self.aggregated_list: gapic_v1.method.wrap_method( - self.aggregated_list, default_timeout=None, client_info=client_info, + self.aggregated_list, + default_timeout=None, + client_info=client_info, ), self.apply_updates_to_instances: gapic_v1.method.wrap_method( self.apply_updates_to_instances, @@ -133,13 +139,19 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.create_instances: gapic_v1.method.wrap_method( - self.create_instances, default_timeout=None, client_info=client_info, + self.create_instances, + default_timeout=None, + client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.delete_instances: gapic_v1.method.wrap_method( - self.delete_instances, default_timeout=None, client_info=client_info, + self.delete_instances, + default_timeout=None, + client_info=client_info, ), self.delete_per_instance_configs: gapic_v1.method.wrap_method( self.delete_per_instance_configs, @@ -147,16 +159,24 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.list_errors: gapic_v1.method.wrap_method( - self.list_errors, default_timeout=None, client_info=client_info, + self.list_errors, + default_timeout=None, + client_info=client_info, ), self.list_managed_instances: gapic_v1.method.wrap_method( self.list_managed_instances, @@ -169,7 +189,9 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.patch: gapic_v1.method.wrap_method( - self.patch, default_timeout=None, client_info=client_info, + self.patch, + default_timeout=None, + client_info=client_info, ), self.patch_per_instance_configs: gapic_v1.method.wrap_method( self.patch_per_instance_configs, @@ -177,10 +199,14 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.recreate_instances: gapic_v1.method.wrap_method( - self.recreate_instances, default_timeout=None, client_info=client_info, + self.recreate_instances, + default_timeout=None, + client_info=client_info, ), self.resize: gapic_v1.method.wrap_method( - self.resize, default_timeout=None, client_info=client_info, + self.resize, + default_timeout=None, + client_info=client_info, ), self.set_instance_template: gapic_v1.method.wrap_method( self.set_instance_template, @@ -188,7 +214,9 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.set_target_pools: gapic_v1.method.wrap_method( - self.set_target_pools, default_timeout=None, client_info=client_info, + self.set_target_pools, + default_timeout=None, + client_info=client_info, ), self.update_per_instance_configs: gapic_v1.method.wrap_method( self.update_per_instance_configs, @@ -200,9 +228,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/instance_group_managers/transports/rest.py b/google/cloud/compute_v1/services/instance_group_managers/transports/rest.py index 4a1ff8716..b40cb5154 100644 --- a/google/cloud/compute_v1/services/instance_group_managers/transports/rest.py +++ b/google/cloud/compute_v1/services/instance_group_managers/transports/rest.py @@ -854,8 +854,8 @@ def __call__( request, metadata = self._interceptor.pre_abandon_instances( request, metadata ) - request_kwargs = compute.AbandonInstancesInstanceGroupManagerRequest.to_dict( - request + request_kwargs = ( + compute.AbandonInstancesInstanceGroupManagerRequest.to_dict(request) ) transcoded_request = path_template.transcode(http_options, **request_kwargs) @@ -1020,37 +1020,37 @@ def __call__( metadata: Sequence[Tuple[str, str]] = (), ) -> compute.Operation: r"""Call the apply updates to - instances method over HTTP. - - Args: - request (~.compute.ApplyUpdatesToInstancesInstanceGroupManagerRequest): - The request object. A request message for - InstanceGroupManagers.ApplyUpdatesToInstances. - See the method description for details. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.compute.Operation: - Represents an Operation resource. Google Compute Engine - has three Operation resources: \* - `Global `__ - \* - `Regional `__ - \* - `Zonal `__ - You can use an operation resource to manage asynchronous - API requests. For more information, read Handling API - responses. Operations can be global, regional or zonal. - - For global operations, use the ``globalOperations`` - resource. - For regional operations, use the - ``regionOperations`` resource. - For zonal operations, - use the ``zonalOperations`` resource. For more - information, read Global, Regional, and Zonal Resources. + instances method over HTTP. + + Args: + request (~.compute.ApplyUpdatesToInstancesInstanceGroupManagerRequest): + The request object. A request message for + InstanceGroupManagers.ApplyUpdatesToInstances. + See the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. """ @@ -1064,8 +1064,10 @@ def __call__( request, metadata = self._interceptor.pre_apply_updates_to_instances( request, metadata ) - request_kwargs = compute.ApplyUpdatesToInstancesInstanceGroupManagerRequest.to_dict( - request + request_kwargs = ( + compute.ApplyUpdatesToInstancesInstanceGroupManagerRequest.to_dict( + request + ) ) transcoded_request = path_template.transcode(http_options, **request_kwargs) @@ -1479,37 +1481,37 @@ def __call__( metadata: Sequence[Tuple[str, str]] = (), ) -> compute.Operation: r"""Call the delete per instance - configs method over HTTP. - - Args: - request (~.compute.DeletePerInstanceConfigsInstanceGroupManagerRequest): - The request object. A request message for - InstanceGroupManagers.DeletePerInstanceConfigs. - See the method description for details. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.compute.Operation: - Represents an Operation resource. Google Compute Engine - has three Operation resources: \* - `Global `__ - \* - `Regional `__ - \* - `Zonal `__ - You can use an operation resource to manage asynchronous - API requests. For more information, read Handling API - responses. Operations can be global, regional or zonal. - - For global operations, use the ``globalOperations`` - resource. - For regional operations, use the - ``regionOperations`` resource. - For zonal operations, - use the ``zonalOperations`` resource. For more - information, read Global, Regional, and Zonal Resources. + configs method over HTTP. + + Args: + request (~.compute.DeletePerInstanceConfigsInstanceGroupManagerRequest): + The request object. A request message for + InstanceGroupManagers.DeletePerInstanceConfigs. + See the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. """ @@ -1523,8 +1525,10 @@ def __call__( request, metadata = self._interceptor.pre_delete_per_instance_configs( request, metadata ) - request_kwargs = compute.DeletePerInstanceConfigsInstanceGroupManagerRequest.to_dict( - request + request_kwargs = ( + compute.DeletePerInstanceConfigsInstanceGroupManagerRequest.to_dict( + request + ) ) transcoded_request = path_template.transcode(http_options, **request_kwargs) @@ -2015,8 +2019,10 @@ def __call__( request, metadata = self._interceptor.pre_list_managed_instances( request, metadata ) - request_kwargs = compute.ListManagedInstancesInstanceGroupManagersRequest.to_dict( - request + request_kwargs = ( + compute.ListManagedInstancesInstanceGroupManagersRequest.to_dict( + request + ) ) transcoded_request = path_template.transcode(http_options, **request_kwargs) @@ -2108,8 +2114,10 @@ def __call__( request, metadata = self._interceptor.pre_list_per_instance_configs( request, metadata ) - request_kwargs = compute.ListPerInstanceConfigsInstanceGroupManagersRequest.to_dict( - request + request_kwargs = ( + compute.ListPerInstanceConfigsInstanceGroupManagersRequest.to_dict( + request + ) ) transcoded_request = path_template.transcode(http_options, **request_kwargs) @@ -2286,37 +2294,37 @@ def __call__( metadata: Sequence[Tuple[str, str]] = (), ) -> compute.Operation: r"""Call the patch per instance - configs method over HTTP. - - Args: - request (~.compute.PatchPerInstanceConfigsInstanceGroupManagerRequest): - The request object. A request message for - InstanceGroupManagers.PatchPerInstanceConfigs. - See the method description for details. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.compute.Operation: - Represents an Operation resource. Google Compute Engine - has three Operation resources: \* - `Global `__ - \* - `Regional `__ - \* - `Zonal `__ - You can use an operation resource to manage asynchronous - API requests. For more information, read Handling API - responses. Operations can be global, regional or zonal. - - For global operations, use the ``globalOperations`` - resource. - For regional operations, use the - ``regionOperations`` resource. - For zonal operations, - use the ``zonalOperations`` resource. For more - information, read Global, Regional, and Zonal Resources. + configs method over HTTP. + + Args: + request (~.compute.PatchPerInstanceConfigsInstanceGroupManagerRequest): + The request object. A request message for + InstanceGroupManagers.PatchPerInstanceConfigs. + See the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. """ @@ -2330,8 +2338,10 @@ def __call__( request, metadata = self._interceptor.pre_patch_per_instance_configs( request, metadata ) - request_kwargs = compute.PatchPerInstanceConfigsInstanceGroupManagerRequest.to_dict( - request + request_kwargs = ( + compute.PatchPerInstanceConfigsInstanceGroupManagerRequest.to_dict( + request + ) ) transcoded_request = path_template.transcode(http_options, **request_kwargs) @@ -2448,8 +2458,8 @@ def __call__( request, metadata = self._interceptor.pre_recreate_instances( request, metadata ) - request_kwargs = compute.RecreateInstancesInstanceGroupManagerRequest.to_dict( - request + request_kwargs = ( + compute.RecreateInstancesInstanceGroupManagerRequest.to_dict(request) ) transcoded_request = path_template.transcode(http_options, **request_kwargs) @@ -2672,8 +2682,8 @@ def __call__( request, metadata = self._interceptor.pre_set_instance_template( request, metadata ) - request_kwargs = compute.SetInstanceTemplateInstanceGroupManagerRequest.to_dict( - request + request_kwargs = ( + compute.SetInstanceTemplateInstanceGroupManagerRequest.to_dict(request) ) transcoded_request = path_template.transcode(http_options, **request_kwargs) @@ -2865,37 +2875,37 @@ def __call__( metadata: Sequence[Tuple[str, str]] = (), ) -> compute.Operation: r"""Call the update per instance - configs method over HTTP. - - Args: - request (~.compute.UpdatePerInstanceConfigsInstanceGroupManagerRequest): - The request object. A request message for - InstanceGroupManagers.UpdatePerInstanceConfigs. - See the method description for details. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.compute.Operation: - Represents an Operation resource. Google Compute Engine - has three Operation resources: \* - `Global `__ - \* - `Regional `__ - \* - `Zonal `__ - You can use an operation resource to manage asynchronous - API requests. For more information, read Handling API - responses. Operations can be global, regional or zonal. - - For global operations, use the ``globalOperations`` - resource. - For regional operations, use the - ``regionOperations`` resource. - For zonal operations, - use the ``zonalOperations`` resource. For more - information, read Global, Regional, and Zonal Resources. + configs method over HTTP. + + Args: + request (~.compute.UpdatePerInstanceConfigsInstanceGroupManagerRequest): + The request object. A request message for + InstanceGroupManagers.UpdatePerInstanceConfigs. + See the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. """ @@ -2909,8 +2919,10 @@ def __call__( request, metadata = self._interceptor.pre_update_per_instance_configs( request, metadata ) - request_kwargs = compute.UpdatePerInstanceConfigsInstanceGroupManagerRequest.to_dict( - request + request_kwargs = ( + compute.UpdatePerInstanceConfigsInstanceGroupManagerRequest.to_dict( + request + ) ) transcoded_request = path_template.transcode(http_options, **request_kwargs) diff --git a/google/cloud/compute_v1/services/instance_groups/client.py b/google/cloud/compute_v1/services/instance_groups/client.py index 12c07bc0a..12f29ab85 100644 --- a/google/cloud/compute_v1/services/instance_groups/client.py +++ b/google/cloud/compute_v1/services/instance_groups/client.py @@ -53,7 +53,10 @@ class InstanceGroupsClientMeta(type): ) # type: Dict[str, Type[InstanceGroupsTransport]] _transport_registry["rest"] = InstanceGroupsRestTransport - def get_transport_class(cls, label: str = None,) -> Type[InstanceGroupsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[InstanceGroupsTransport]: """Returns an appropriate transport class. Args: @@ -158,7 +161,9 @@ def transport(self) -> InstanceGroupsTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -171,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -182,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -193,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -204,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -493,7 +514,12 @@ def add_instances_unary( rpc = self._transport._wrapped_methods[self._transport.add_instances] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -559,12 +585,20 @@ def aggregated_list( rpc = self._transport._wrapped_methods[self._transport.aggregated_list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.AggregatedListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -665,7 +699,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -763,7 +802,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -859,7 +903,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -938,12 +987,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1048,12 +1105,20 @@ def list_instances( rpc = self._transport._wrapped_methods[self._transport.list_instances] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListInstancesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1173,7 +1238,12 @@ def remove_instances_unary( rpc = self._transport._wrapped_methods[self._transport.remove_instances] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1288,7 +1358,12 @@ def set_named_ports_unary( rpc = self._transport._wrapped_methods[self._transport.set_named_ports] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1309,7 +1384,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/instance_groups/transports/base.py b/google/cloud/compute_v1/services/instance_groups/transports/base.py index 7bd126837..7d87a9179 100644 --- a/google/cloud/compute_v1/services/instance_groups/transports/base.py +++ b/google/cloud/compute_v1/services/instance_groups/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,40 +124,58 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.add_instances: gapic_v1.method.wrap_method( - self.add_instances, default_timeout=None, client_info=client_info, + self.add_instances, + default_timeout=None, + client_info=client_info, ), self.aggregated_list: gapic_v1.method.wrap_method( - self.aggregated_list, default_timeout=None, client_info=client_info, + self.aggregated_list, + default_timeout=None, + client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.list_instances: gapic_v1.method.wrap_method( - self.list_instances, default_timeout=None, client_info=client_info, + self.list_instances, + default_timeout=None, + client_info=client_info, ), self.remove_instances: gapic_v1.method.wrap_method( - self.remove_instances, default_timeout=None, client_info=client_info, + self.remove_instances, + default_timeout=None, + client_info=client_info, ), self.set_named_ports: gapic_v1.method.wrap_method( - self.set_named_ports, default_timeout=None, client_info=client_info, + self.set_named_ports, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/instance_templates/client.py b/google/cloud/compute_v1/services/instance_templates/client.py index 1a46128f2..521808fbe 100644 --- a/google/cloud/compute_v1/services/instance_templates/client.py +++ b/google/cloud/compute_v1/services/instance_templates/client.py @@ -54,7 +54,8 @@ class InstanceTemplatesClientMeta(type): _transport_registry["rest"] = InstanceTemplatesRestTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[InstanceTemplatesTransport]: """Returns an appropriate transport class. @@ -160,7 +161,9 @@ def transport(self) -> InstanceTemplatesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -173,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -184,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -195,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -206,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -468,7 +487,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -545,7 +569,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -658,7 +687,12 @@ def get_iam_policy( rpc = self._transport._wrapped_methods[self._transport.get_iam_policy] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -748,7 +782,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -815,12 +854,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -946,7 +993,12 @@ def set_iam_policy( rpc = self._transport._wrapped_methods[self._transport.set_iam_policy] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1031,7 +1083,12 @@ def test_iam_permissions( rpc = self._transport._wrapped_methods[self._transport.test_iam_permissions] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1052,7 +1109,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/instance_templates/transports/base.py b/google/cloud/compute_v1/services/instance_templates/transports/base.py index a9de7e13b..a90c3e2d4 100644 --- a/google/cloud/compute_v1/services/instance_templates/transports/base.py +++ b/google/cloud/compute_v1/services/instance_templates/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,22 +124,34 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.get_iam_policy: gapic_v1.method.wrap_method( - self.get_iam_policy, default_timeout=None, client_info=client_info, + self.get_iam_policy, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.set_iam_policy: gapic_v1.method.wrap_method( - self.set_iam_policy, default_timeout=None, client_info=client_info, + self.set_iam_policy, + default_timeout=None, + client_info=client_info, ), self.test_iam_permissions: gapic_v1.method.wrap_method( self.test_iam_permissions, @@ -149,9 +163,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/instances/client.py b/google/cloud/compute_v1/services/instances/client.py index fd931dbf4..6ee82ab54 100644 --- a/google/cloud/compute_v1/services/instances/client.py +++ b/google/cloud/compute_v1/services/instances/client.py @@ -51,7 +51,10 @@ class InstancesClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[InstancesTransport]] _transport_registry["rest"] = InstancesRestTransport - def get_transport_class(cls, label: str = None,) -> Type[InstancesTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[InstancesTransport]: """Returns an appropriate transport class. Args: @@ -156,7 +159,9 @@ def transport(self) -> InstancesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -169,9 +174,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -180,9 +189,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -191,9 +204,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -202,10 +219,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -490,7 +511,12 @@ def add_access_config_unary( rpc = self._transport._wrapped_methods[self._transport.add_access_config] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -599,7 +625,12 @@ def add_resource_policies_unary( rpc = self._transport._wrapped_methods[self._transport.add_resource_policies] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -668,12 +699,20 @@ def aggregated_list( rpc = self._transport._wrapped_methods[self._transport.aggregated_list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.AggregatedListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -781,7 +820,12 @@ def attach_disk_unary( rpc = self._transport._wrapped_methods[self._transport.attach_disk] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -881,7 +925,12 @@ def bulk_insert_unary( rpc = self._transport._wrapped_methods[self._transport.bulk_insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -979,7 +1028,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1095,7 +1149,12 @@ def delete_access_config_unary( rpc = self._transport._wrapped_methods[self._transport.delete_access_config] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1202,7 +1261,12 @@ def detach_disk_unary( rpc = self._transport._wrapped_methods[self._transport.detach_disk] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1289,7 +1353,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1382,7 +1451,12 @@ def get_effective_firewalls( rpc = self._transport._wrapped_methods[self._transport.get_effective_firewalls] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1464,7 +1538,12 @@ def get_guest_attributes( rpc = self._transport._wrapped_methods[self._transport.get_guest_attributes] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1587,7 +1666,12 @@ def get_iam_policy( rpc = self._transport._wrapped_methods[self._transport.get_iam_policy] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1669,7 +1753,12 @@ def get_screenshot( rpc = self._transport._wrapped_methods[self._transport.get_screenshot] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1752,7 +1841,12 @@ def get_serial_port_output( rpc = self._transport._wrapped_methods[self._transport.get_serial_port_output] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1836,7 +1930,12 @@ def get_shielded_instance_identity( ] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1932,7 +2031,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2008,12 +2112,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -2108,12 +2220,20 @@ def list_referrers( rpc = self._transport._wrapped_methods[self._transport.list_referrers] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListReferrersPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -2226,7 +2346,12 @@ def remove_resource_policies_unary( rpc = self._transport._wrapped_methods[self._transport.remove_resource_policies] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2324,7 +2449,12 @@ def reset_unary( rpc = self._transport._wrapped_methods[self._transport.reset] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2422,7 +2552,12 @@ def resume_unary( rpc = self._transport._wrapped_methods[self._transport.resume] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2509,7 +2644,12 @@ def send_diagnostic_interrupt( ] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2606,7 +2746,12 @@ def set_deletion_protection_unary( rpc = self._transport._wrapped_methods[self._transport.set_deletion_protection] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2724,7 +2869,12 @@ def set_disk_auto_delete_unary( rpc = self._transport._wrapped_methods[self._transport.set_disk_auto_delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2859,7 +3009,12 @@ def set_iam_policy( rpc = self._transport._wrapped_methods[self._transport.set_iam_policy] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2969,7 +3124,12 @@ def set_labels_unary( rpc = self._transport._wrapped_methods[self._transport.set_labels] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -3079,7 +3239,12 @@ def set_machine_resources_unary( rpc = self._transport._wrapped_methods[self._transport.set_machine_resources] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -3189,7 +3354,12 @@ def set_machine_type_unary( rpc = self._transport._wrapped_methods[self._transport.set_machine_type] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -3295,7 +3465,12 @@ def set_metadata_unary( rpc = self._transport._wrapped_methods[self._transport.set_metadata] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -3407,7 +3582,12 @@ def set_min_cpu_platform_unary( rpc = self._transport._wrapped_methods[self._transport.set_min_cpu_platform] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -3515,7 +3695,12 @@ def set_scheduling_unary( rpc = self._transport._wrapped_methods[self._transport.set_scheduling] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -3626,7 +3811,12 @@ def set_service_account_unary( rpc = self._transport._wrapped_methods[self._transport.set_service_account] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -3744,7 +3934,12 @@ def set_shielded_instance_integrity_policy_unary( ] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -3850,7 +4045,12 @@ def set_tags_unary( rpc = self._transport._wrapped_methods[self._transport.set_tags] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -3950,7 +4150,12 @@ def simulate_maintenance_event_unary( ] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -4048,7 +4253,12 @@ def start_unary( rpc = self._transport._wrapped_methods[self._transport.start] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -4166,7 +4376,12 @@ def start_with_encryption_key_unary( ] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -4268,7 +4483,12 @@ def stop_unary( rpc = self._transport._wrapped_methods[self._transport.stop] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -4373,7 +4593,12 @@ def suspend_unary( rpc = self._transport._wrapped_methods[self._transport.suspend] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -4468,7 +4693,12 @@ def test_iam_permissions( rpc = self._transport._wrapped_methods[self._transport.test_iam_permissions] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -4576,7 +4806,12 @@ def update_unary( rpc = self._transport._wrapped_methods[self._transport.update] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -4694,7 +4929,12 @@ def update_access_config_unary( rpc = self._transport._wrapped_methods[self._transport.update_access_config] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -4802,7 +5042,12 @@ def update_display_device_unary( rpc = self._transport._wrapped_methods[self._transport.update_display_device] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -4923,7 +5168,12 @@ def update_network_interface_unary( rpc = self._transport._wrapped_methods[self._transport.update_network_interface] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -5039,7 +5289,12 @@ def update_shielded_instance_config_unary( ] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -5060,7 +5315,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/instances/transports/base.py b/google/cloud/compute_v1/services/instances/transports/base.py index e29a16276..276bc5069 100644 --- a/google/cloud/compute_v1/services/instances/transports/base.py +++ b/google/cloud/compute_v1/services/instances/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,7 +124,9 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.add_access_config: gapic_v1.method.wrap_method( - self.add_access_config, default_timeout=None, client_info=client_info, + self.add_access_config, + default_timeout=None, + client_info=client_info, ), self.add_resource_policies: gapic_v1.method.wrap_method( self.add_resource_policies, @@ -130,16 +134,24 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.aggregated_list: gapic_v1.method.wrap_method( - self.aggregated_list, default_timeout=None, client_info=client_info, + self.aggregated_list, + default_timeout=None, + client_info=client_info, ), self.attach_disk: gapic_v1.method.wrap_method( - self.attach_disk, default_timeout=None, client_info=client_info, + self.attach_disk, + default_timeout=None, + client_info=client_info, ), self.bulk_insert: gapic_v1.method.wrap_method( - self.bulk_insert, default_timeout=None, client_info=client_info, + self.bulk_insert, + default_timeout=None, + client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.delete_access_config: gapic_v1.method.wrap_method( self.delete_access_config, @@ -147,10 +159,14 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.detach_disk: gapic_v1.method.wrap_method( - self.detach_disk, default_timeout=None, client_info=client_info, + self.detach_disk, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.get_effective_firewalls: gapic_v1.method.wrap_method( self.get_effective_firewalls, @@ -163,10 +179,14 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.get_iam_policy: gapic_v1.method.wrap_method( - self.get_iam_policy, default_timeout=None, client_info=client_info, + self.get_iam_policy, + default_timeout=None, + client_info=client_info, ), self.get_screenshot: gapic_v1.method.wrap_method( - self.get_screenshot, default_timeout=None, client_info=client_info, + self.get_screenshot, + default_timeout=None, + client_info=client_info, ), self.get_serial_port_output: gapic_v1.method.wrap_method( self.get_serial_port_output, @@ -179,13 +199,19 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.list_referrers: gapic_v1.method.wrap_method( - self.list_referrers, default_timeout=None, client_info=client_info, + self.list_referrers, + default_timeout=None, + client_info=client_info, ), self.remove_resource_policies: gapic_v1.method.wrap_method( self.remove_resource_policies, @@ -193,10 +219,14 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.reset: gapic_v1.method.wrap_method( - self.reset, default_timeout=None, client_info=client_info, + self.reset, + default_timeout=None, + client_info=client_info, ), self.resume: gapic_v1.method.wrap_method( - self.resume, default_timeout=None, client_info=client_info, + self.resume, + default_timeout=None, + client_info=client_info, ), self.send_diagnostic_interrupt: gapic_v1.method.wrap_method( self.send_diagnostic_interrupt, @@ -214,10 +244,14 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.set_iam_policy: gapic_v1.method.wrap_method( - self.set_iam_policy, default_timeout=None, client_info=client_info, + self.set_iam_policy, + default_timeout=None, + client_info=client_info, ), self.set_labels: gapic_v1.method.wrap_method( - self.set_labels, default_timeout=None, client_info=client_info, + self.set_labels, + default_timeout=None, + client_info=client_info, ), self.set_machine_resources: gapic_v1.method.wrap_method( self.set_machine_resources, @@ -225,10 +259,14 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.set_machine_type: gapic_v1.method.wrap_method( - self.set_machine_type, default_timeout=None, client_info=client_info, + self.set_machine_type, + default_timeout=None, + client_info=client_info, ), self.set_metadata: gapic_v1.method.wrap_method( - self.set_metadata, default_timeout=None, client_info=client_info, + self.set_metadata, + default_timeout=None, + client_info=client_info, ), self.set_min_cpu_platform: gapic_v1.method.wrap_method( self.set_min_cpu_platform, @@ -236,10 +274,14 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.set_scheduling: gapic_v1.method.wrap_method( - self.set_scheduling, default_timeout=None, client_info=client_info, + self.set_scheduling, + default_timeout=None, + client_info=client_info, ), self.set_service_account: gapic_v1.method.wrap_method( - self.set_service_account, default_timeout=None, client_info=client_info, + self.set_service_account, + default_timeout=None, + client_info=client_info, ), self.set_shielded_instance_integrity_policy: gapic_v1.method.wrap_method( self.set_shielded_instance_integrity_policy, @@ -247,7 +289,9 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.set_tags: gapic_v1.method.wrap_method( - self.set_tags, default_timeout=None, client_info=client_info, + self.set_tags, + default_timeout=None, + client_info=client_info, ), self.simulate_maintenance_event: gapic_v1.method.wrap_method( self.simulate_maintenance_event, @@ -255,7 +299,9 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.start: gapic_v1.method.wrap_method( - self.start, default_timeout=None, client_info=client_info, + self.start, + default_timeout=None, + client_info=client_info, ), self.start_with_encryption_key: gapic_v1.method.wrap_method( self.start_with_encryption_key, @@ -263,10 +309,14 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.stop: gapic_v1.method.wrap_method( - self.stop, default_timeout=None, client_info=client_info, + self.stop, + default_timeout=None, + client_info=client_info, ), self.suspend: gapic_v1.method.wrap_method( - self.suspend, default_timeout=None, client_info=client_info, + self.suspend, + default_timeout=None, + client_info=client_info, ), self.test_iam_permissions: gapic_v1.method.wrap_method( self.test_iam_permissions, @@ -274,7 +324,9 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.update: gapic_v1.method.wrap_method( - self.update, default_timeout=None, client_info=client_info, + self.update, + default_timeout=None, + client_info=client_info, ), self.update_access_config: gapic_v1.method.wrap_method( self.update_access_config, @@ -301,9 +353,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/instances/transports/rest.py b/google/cloud/compute_v1/services/instances/transports/rest.py index 87025085e..083df274c 100644 --- a/google/cloud/compute_v1/services/instances/transports/rest.py +++ b/google/cloud/compute_v1/services/instances/transports/rest.py @@ -2950,23 +2950,23 @@ def __call__( metadata: Sequence[Tuple[str, str]] = (), ) -> compute.ShieldedInstanceIdentity: r"""Call the get shielded instance - identity method over HTTP. - - Args: - request (~.compute.GetShieldedInstanceIdentityInstanceRequest): - The request object. A request message for - Instances.GetShieldedInstanceIdentity. - See the method description for details. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.compute.ShieldedInstanceIdentity: - A Shielded Instance Identity. + identity method over HTTP. + + Args: + request (~.compute.GetShieldedInstanceIdentityInstanceRequest): + The request object. A request message for + Instances.GetShieldedInstanceIdentity. + See the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.ShieldedInstanceIdentity: + A Shielded Instance Identity. """ http_options: List[Dict[str, str]] = [ @@ -4896,37 +4896,37 @@ def __call__( metadata: Sequence[Tuple[str, str]] = (), ) -> compute.Operation: r"""Call the set shielded instance - integrity policy method over HTTP. - - Args: - request (~.compute.SetShieldedInstanceIntegrityPolicyInstanceRequest): - The request object. A request message for - Instances.SetShieldedInstanceIntegrityPolicy. - See the method description for details. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.compute.Operation: - Represents an Operation resource. Google Compute Engine - has three Operation resources: \* - `Global `__ - \* - `Regional `__ - \* - `Zonal `__ - You can use an operation resource to manage asynchronous - API requests. For more information, read Handling API - responses. Operations can be global, regional or zonal. - - For global operations, use the ``globalOperations`` - resource. - For regional operations, use the - ``regionOperations`` resource. - For zonal operations, - use the ``zonalOperations`` resource. For more - information, read Global, Regional, and Zonal Resources. + integrity policy method over HTTP. + + Args: + request (~.compute.SetShieldedInstanceIntegrityPolicyInstanceRequest): + The request object. A request message for + Instances.SetShieldedInstanceIntegrityPolicy. + See the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. """ @@ -4943,8 +4943,10 @@ def __call__( ) = self._interceptor.pre_set_shielded_instance_integrity_policy( request, metadata ) - request_kwargs = compute.SetShieldedInstanceIntegrityPolicyInstanceRequest.to_dict( - request + request_kwargs = ( + compute.SetShieldedInstanceIntegrityPolicyInstanceRequest.to_dict( + request + ) ) transcoded_request = path_template.transcode(http_options, **request_kwargs) @@ -5126,37 +5128,37 @@ def __call__( metadata: Sequence[Tuple[str, str]] = (), ) -> compute.Operation: r"""Call the simulate maintenance - event method over HTTP. - - Args: - request (~.compute.SimulateMaintenanceEventInstanceRequest): - The request object. A request message for - Instances.SimulateMaintenanceEvent. See - the method description for details. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.compute.Operation: - Represents an Operation resource. Google Compute Engine - has three Operation resources: \* - `Global `__ - \* - `Regional `__ - \* - `Zonal `__ - You can use an operation resource to manage asynchronous - API requests. For more information, read Handling API - responses. Operations can be global, regional or zonal. - - For global operations, use the ``globalOperations`` - resource. - For regional operations, use the - ``regionOperations`` resource. - For zonal operations, - use the ``zonalOperations`` resource. For more - information, read Global, Regional, and Zonal Resources. + event method over HTTP. + + Args: + request (~.compute.SimulateMaintenanceEventInstanceRequest): + The request object. A request message for + Instances.SimulateMaintenanceEvent. See + the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. """ @@ -6215,37 +6217,37 @@ def __call__( metadata: Sequence[Tuple[str, str]] = (), ) -> compute.Operation: r"""Call the update shielded instance - config method over HTTP. - - Args: - request (~.compute.UpdateShieldedInstanceConfigInstanceRequest): - The request object. A request message for - Instances.UpdateShieldedInstanceConfig. - See the method description for details. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.compute.Operation: - Represents an Operation resource. Google Compute Engine - has three Operation resources: \* - `Global `__ - \* - `Regional `__ - \* - `Zonal `__ - You can use an operation resource to manage asynchronous - API requests. For more information, read Handling API - responses. Operations can be global, regional or zonal. - - For global operations, use the ``globalOperations`` - resource. - For regional operations, use the - ``regionOperations`` resource. - For zonal operations, - use the ``zonalOperations`` resource. For more - information, read Global, Regional, and Zonal Resources. + config method over HTTP. + + Args: + request (~.compute.UpdateShieldedInstanceConfigInstanceRequest): + The request object. A request message for + Instances.UpdateShieldedInstanceConfig. + See the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. """ @@ -6259,8 +6261,8 @@ def __call__( request, metadata = self._interceptor.pre_update_shielded_instance_config( request, metadata ) - request_kwargs = compute.UpdateShieldedInstanceConfigInstanceRequest.to_dict( - request + request_kwargs = ( + compute.UpdateShieldedInstanceConfigInstanceRequest.to_dict(request) ) transcoded_request = path_template.transcode(http_options, **request_kwargs) diff --git a/google/cloud/compute_v1/services/interconnect_attachments/client.py b/google/cloud/compute_v1/services/interconnect_attachments/client.py index ca1100326..d384a485c 100644 --- a/google/cloud/compute_v1/services/interconnect_attachments/client.py +++ b/google/cloud/compute_v1/services/interconnect_attachments/client.py @@ -54,7 +54,8 @@ class InterconnectAttachmentsClientMeta(type): _transport_registry["rest"] = InterconnectAttachmentsRestTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[InterconnectAttachmentsTransport]: """Returns an appropriate transport class. @@ -160,7 +161,9 @@ def transport(self) -> InterconnectAttachmentsTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -173,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -184,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -195,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -206,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -448,12 +467,20 @@ def aggregated_list( rpc = self._transport._wrapped_methods[self._transport.aggregated_list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.AggregatedListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -549,7 +576,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -637,7 +669,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -733,7 +770,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -809,12 +851,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -927,7 +977,12 @@ def patch_unary( rpc = self._transport._wrapped_methods[self._transport.patch] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -948,7 +1003,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/interconnect_attachments/transports/base.py b/google/cloud/compute_v1/services/interconnect_attachments/transports/base.py index ae59cea5a..a93486cd4 100644 --- a/google/cloud/compute_v1/services/interconnect_attachments/transports/base.py +++ b/google/cloud/compute_v1/services/interconnect_attachments/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,31 +124,43 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.aggregated_list: gapic_v1.method.wrap_method( - self.aggregated_list, default_timeout=None, client_info=client_info, + self.aggregated_list, + default_timeout=None, + client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.patch: gapic_v1.method.wrap_method( - self.patch, default_timeout=None, client_info=client_info, + self.patch, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/interconnect_attachments/transports/rest.py b/google/cloud/compute_v1/services/interconnect_attachments/transports/rest.py index 9f80844e9..c79cb66b2 100644 --- a/google/cloud/compute_v1/services/interconnect_attachments/transports/rest.py +++ b/google/cloud/compute_v1/services/interconnect_attachments/transports/rest.py @@ -394,8 +394,8 @@ def __call__( }, ] request, metadata = self._interceptor.pre_aggregated_list(request, metadata) - request_kwargs = compute.AggregatedListInterconnectAttachmentsRequest.to_dict( - request + request_kwargs = ( + compute.AggregatedListInterconnectAttachmentsRequest.to_dict(request) ) transcoded_request = path_template.transcode(http_options, **request_kwargs) diff --git a/google/cloud/compute_v1/services/interconnect_locations/client.py b/google/cloud/compute_v1/services/interconnect_locations/client.py index 546a6fb7d..9390572f5 100644 --- a/google/cloud/compute_v1/services/interconnect_locations/client.py +++ b/google/cloud/compute_v1/services/interconnect_locations/client.py @@ -54,7 +54,8 @@ class InterconnectLocationsClientMeta(type): _transport_registry["rest"] = InterconnectLocationsRestTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[InterconnectLocationsTransport]: """Returns an appropriate transport class. @@ -160,7 +161,9 @@ def transport(self) -> InterconnectLocationsTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -173,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -184,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -195,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -206,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -459,7 +478,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -527,12 +551,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -554,7 +586,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/interconnect_locations/transports/base.py b/google/cloud/compute_v1/services/interconnect_locations/transports/base.py index 9f2a1d7e3..2d1ecba58 100644 --- a/google/cloud/compute_v1/services/interconnect_locations/transports/base.py +++ b/google/cloud/compute_v1/services/interconnect_locations/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -123,19 +125,23 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/interconnects/client.py b/google/cloud/compute_v1/services/interconnects/client.py index 9db49dd22..e714f1b3e 100644 --- a/google/cloud/compute_v1/services/interconnects/client.py +++ b/google/cloud/compute_v1/services/interconnects/client.py @@ -51,7 +51,10 @@ class InterconnectsClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[InterconnectsTransport]] _transport_registry["rest"] = InterconnectsRestTransport - def get_transport_class(cls, label: str = None,) -> Type[InterconnectsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[InterconnectsTransport]: """Returns an appropriate transport class. Args: @@ -156,7 +159,9 @@ def transport(self) -> InterconnectsTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -169,9 +174,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -180,9 +189,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -191,9 +204,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -202,10 +219,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -459,7 +480,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -536,7 +562,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -611,7 +642,12 @@ def get_diagnostics( rpc = self._transport._wrapped_methods[self._transport.get_diagnostics] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -697,7 +733,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -765,12 +806,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -867,7 +916,12 @@ def patch_unary( rpc = self._transport._wrapped_methods[self._transport.patch] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -888,7 +942,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/interconnects/transports/base.py b/google/cloud/compute_v1/services/interconnects/transports/base.py index f6abfb3d6..116fc1d83 100644 --- a/google/cloud/compute_v1/services/interconnects/transports/base.py +++ b/google/cloud/compute_v1/services/interconnects/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,31 +124,43 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.get_diagnostics: gapic_v1.method.wrap_method( - self.get_diagnostics, default_timeout=None, client_info=client_info, + self.get_diagnostics, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.patch: gapic_v1.method.wrap_method( - self.patch, default_timeout=None, client_info=client_info, + self.patch, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/license_codes/client.py b/google/cloud/compute_v1/services/license_codes/client.py index 129beef2a..529e7dee0 100644 --- a/google/cloud/compute_v1/services/license_codes/client.py +++ b/google/cloud/compute_v1/services/license_codes/client.py @@ -50,7 +50,10 @@ class LicenseCodesClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[LicenseCodesTransport]] _transport_registry["rest"] = LicenseCodesRestTransport - def get_transport_class(cls, label: str = None,) -> Type[LicenseCodesTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[LicenseCodesTransport]: """Returns an appropriate transport class. Args: @@ -155,7 +158,9 @@ def transport(self) -> LicenseCodesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -168,9 +173,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -179,9 +188,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -190,9 +203,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -201,10 +218,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -453,7 +474,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -539,7 +565,12 @@ def test_iam_permissions( rpc = self._transport._wrapped_methods[self._transport.test_iam_permissions] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -560,7 +591,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/license_codes/transports/base.py b/google/cloud/compute_v1/services/license_codes/transports/base.py index e0e45aa05..4549127cc 100644 --- a/google/cloud/compute_v1/services/license_codes/transports/base.py +++ b/google/cloud/compute_v1/services/license_codes/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -123,7 +125,9 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.test_iam_permissions: gapic_v1.method.wrap_method( self.test_iam_permissions, @@ -135,9 +139,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/licenses/client.py b/google/cloud/compute_v1/services/licenses/client.py index 96d0e27fe..5defa8590 100644 --- a/google/cloud/compute_v1/services/licenses/client.py +++ b/google/cloud/compute_v1/services/licenses/client.py @@ -51,7 +51,10 @@ class LicensesClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[LicensesTransport]] _transport_registry["rest"] = LicensesRestTransport - def get_transport_class(cls, label: str = None,) -> Type[LicensesTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[LicensesTransport]: """Returns an appropriate transport class. Args: @@ -156,7 +159,9 @@ def transport(self) -> LicensesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -169,9 +174,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -180,9 +189,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -191,9 +204,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -202,10 +219,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -462,7 +483,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -540,7 +566,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -655,7 +686,12 @@ def get_iam_policy( rpc = self._transport._wrapped_methods[self._transport.get_iam_policy] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -741,7 +777,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -813,12 +854,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -946,7 +995,12 @@ def set_iam_policy( rpc = self._transport._wrapped_methods[self._transport.set_iam_policy] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1032,7 +1086,12 @@ def test_iam_permissions( rpc = self._transport._wrapped_methods[self._transport.test_iam_permissions] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1053,7 +1112,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/licenses/transports/base.py b/google/cloud/compute_v1/services/licenses/transports/base.py index 98f565039..7c8345708 100644 --- a/google/cloud/compute_v1/services/licenses/transports/base.py +++ b/google/cloud/compute_v1/services/licenses/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,22 +124,34 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.get_iam_policy: gapic_v1.method.wrap_method( - self.get_iam_policy, default_timeout=None, client_info=client_info, + self.get_iam_policy, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.set_iam_policy: gapic_v1.method.wrap_method( - self.set_iam_policy, default_timeout=None, client_info=client_info, + self.set_iam_policy, + default_timeout=None, + client_info=client_info, ), self.test_iam_permissions: gapic_v1.method.wrap_method( self.test_iam_permissions, @@ -149,9 +163,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/machine_images/client.py b/google/cloud/compute_v1/services/machine_images/client.py index 8fd71649e..0a45d4157 100644 --- a/google/cloud/compute_v1/services/machine_images/client.py +++ b/google/cloud/compute_v1/services/machine_images/client.py @@ -51,7 +51,10 @@ class MachineImagesClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[MachineImagesTransport]] _transport_registry["rest"] = MachineImagesRestTransport - def get_transport_class(cls, label: str = None,) -> Type[MachineImagesTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[MachineImagesTransport]: """Returns an appropriate transport class. Args: @@ -156,7 +159,9 @@ def transport(self) -> MachineImagesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -169,9 +174,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -180,9 +189,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -191,9 +204,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -202,10 +219,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -462,7 +483,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -541,7 +567,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -654,7 +685,12 @@ def get_iam_policy( rpc = self._transport._wrapped_methods[self._transport.get_iam_policy] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -744,7 +780,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -811,12 +852,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -942,7 +991,12 @@ def set_iam_policy( rpc = self._transport._wrapped_methods[self._transport.set_iam_policy] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1027,7 +1081,12 @@ def test_iam_permissions( rpc = self._transport._wrapped_methods[self._transport.test_iam_permissions] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1048,7 +1107,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/machine_images/transports/base.py b/google/cloud/compute_v1/services/machine_images/transports/base.py index a9279af75..575f1e77f 100644 --- a/google/cloud/compute_v1/services/machine_images/transports/base.py +++ b/google/cloud/compute_v1/services/machine_images/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,22 +124,34 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.get_iam_policy: gapic_v1.method.wrap_method( - self.get_iam_policy, default_timeout=None, client_info=client_info, + self.get_iam_policy, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.set_iam_policy: gapic_v1.method.wrap_method( - self.set_iam_policy, default_timeout=None, client_info=client_info, + self.set_iam_policy, + default_timeout=None, + client_info=client_info, ), self.test_iam_permissions: gapic_v1.method.wrap_method( self.test_iam_permissions, @@ -149,9 +163,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/machine_types/client.py b/google/cloud/compute_v1/services/machine_types/client.py index dcad0c427..5bfc729b1 100644 --- a/google/cloud/compute_v1/services/machine_types/client.py +++ b/google/cloud/compute_v1/services/machine_types/client.py @@ -51,7 +51,10 @@ class MachineTypesClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[MachineTypesTransport]] _transport_registry["rest"] = MachineTypesRestTransport - def get_transport_class(cls, label: str = None,) -> Type[MachineTypesTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[MachineTypesTransport]: """Returns an appropriate transport class. Args: @@ -156,7 +159,9 @@ def transport(self) -> MachineTypesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -169,9 +174,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -180,9 +189,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -191,9 +204,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -202,10 +219,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -439,12 +460,20 @@ def aggregated_list( rpc = self._transport._wrapped_methods[self._transport.aggregated_list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.AggregatedListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -531,7 +560,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -608,12 +642,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -635,7 +677,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/machine_types/transports/base.py b/google/cloud/compute_v1/services/machine_types/transports/base.py index 9009a68be..350a43f69 100644 --- a/google/cloud/compute_v1/services/machine_types/transports/base.py +++ b/google/cloud/compute_v1/services/machine_types/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -123,22 +125,28 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.aggregated_list: gapic_v1.method.wrap_method( - self.aggregated_list, default_timeout=None, client_info=client_info, + self.aggregated_list, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/network_endpoint_groups/client.py b/google/cloud/compute_v1/services/network_endpoint_groups/client.py index e898b885b..de607c012 100644 --- a/google/cloud/compute_v1/services/network_endpoint_groups/client.py +++ b/google/cloud/compute_v1/services/network_endpoint_groups/client.py @@ -54,7 +54,8 @@ class NetworkEndpointGroupsClientMeta(type): _transport_registry["rest"] = NetworkEndpointGroupsRestTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[NetworkEndpointGroupsTransport]: """Returns an appropriate transport class. @@ -160,7 +161,9 @@ def transport(self) -> NetworkEndpointGroupsTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -173,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -184,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -195,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -206,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -444,12 +463,20 @@ def aggregated_list( rpc = self._transport._wrapped_methods[self._transport.aggregated_list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.AggregatedListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -572,7 +599,12 @@ def attach_network_endpoints_unary( rpc = self._transport._wrapped_methods[self._transport.attach_network_endpoints] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -675,7 +707,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -797,7 +834,12 @@ def detach_network_endpoints_unary( rpc = self._transport._wrapped_methods[self._transport.detach_network_endpoints] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -893,7 +935,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -993,7 +1040,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1070,12 +1122,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1186,12 +1246,20 @@ def list_network_endpoints( rpc = self._transport._wrapped_methods[self._transport.list_network_endpoints] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListNetworkEndpointsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1291,7 +1359,12 @@ def test_iam_permissions( rpc = self._transport._wrapped_methods[self._transport.test_iam_permissions] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1312,7 +1385,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/network_endpoint_groups/transports/base.py b/google/cloud/compute_v1/services/network_endpoint_groups/transports/base.py index 1c61b5c31..4159b7958 100644 --- a/google/cloud/compute_v1/services/network_endpoint_groups/transports/base.py +++ b/google/cloud/compute_v1/services/network_endpoint_groups/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,7 +124,9 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.aggregated_list: gapic_v1.method.wrap_method( - self.aggregated_list, default_timeout=None, client_info=client_info, + self.aggregated_list, + default_timeout=None, + client_info=client_info, ), self.attach_network_endpoints: gapic_v1.method.wrap_method( self.attach_network_endpoints, @@ -130,7 +134,9 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.detach_network_endpoints: gapic_v1.method.wrap_method( self.detach_network_endpoints, @@ -138,13 +144,19 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.list_network_endpoints: gapic_v1.method.wrap_method( self.list_network_endpoints, @@ -161,9 +173,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/network_endpoint_groups/transports/rest.py b/google/cloud/compute_v1/services/network_endpoint_groups/transports/rest.py index 11f485775..b7628b98c 100644 --- a/google/cloud/compute_v1/services/network_endpoint_groups/transports/rest.py +++ b/google/cloud/compute_v1/services/network_endpoint_groups/transports/rest.py @@ -606,8 +606,10 @@ def __call__( request, metadata = self._interceptor.pre_attach_network_endpoints( request, metadata ) - request_kwargs = compute.AttachNetworkEndpointsNetworkEndpointGroupRequest.to_dict( - request + request_kwargs = ( + compute.AttachNetworkEndpointsNetworkEndpointGroupRequest.to_dict( + request + ) ) transcoded_request = path_template.transcode(http_options, **request_kwargs) @@ -828,8 +830,10 @@ def __call__( request, metadata = self._interceptor.pre_detach_network_endpoints( request, metadata ) - request_kwargs = compute.DetachNetworkEndpointsNetworkEndpointGroupRequest.to_dict( - request + request_kwargs = ( + compute.DetachNetworkEndpointsNetworkEndpointGroupRequest.to_dict( + request + ) ) transcoded_request = path_template.transcode(http_options, **request_kwargs) @@ -1232,8 +1236,10 @@ def __call__( request, metadata = self._interceptor.pre_list_network_endpoints( request, metadata ) - request_kwargs = compute.ListNetworkEndpointsNetworkEndpointGroupsRequest.to_dict( - request + request_kwargs = ( + compute.ListNetworkEndpointsNetworkEndpointGroupsRequest.to_dict( + request + ) ) transcoded_request = path_template.transcode(http_options, **request_kwargs) @@ -1335,8 +1341,8 @@ def __call__( request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) - request_kwargs = compute.TestIamPermissionsNetworkEndpointGroupRequest.to_dict( - request + request_kwargs = ( + compute.TestIamPermissionsNetworkEndpointGroupRequest.to_dict(request) ) transcoded_request = path_template.transcode(http_options, **request_kwargs) diff --git a/google/cloud/compute_v1/services/networks/client.py b/google/cloud/compute_v1/services/networks/client.py index 051f03439..ed388e8a3 100644 --- a/google/cloud/compute_v1/services/networks/client.py +++ b/google/cloud/compute_v1/services/networks/client.py @@ -51,7 +51,10 @@ class NetworksClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[NetworksTransport]] _transport_registry["rest"] = NetworksRestTransport - def get_transport_class(cls, label: str = None,) -> Type[NetworksTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[NetworksTransport]: """Returns an appropriate transport class. Args: @@ -156,7 +159,9 @@ def transport(self) -> NetworksTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -169,9 +174,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -180,9 +189,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -191,9 +204,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -202,10 +219,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -473,7 +494,12 @@ def add_peering_unary( rpc = self._transport._wrapped_methods[self._transport.add_peering] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -557,7 +583,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -632,7 +663,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -702,7 +738,12 @@ def get_effective_firewalls( rpc = self._transport._wrapped_methods[self._transport.get_effective_firewalls] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -787,7 +828,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -853,12 +899,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -933,12 +987,20 @@ def list_peering_routes( rpc = self._transport._wrapped_methods[self._transport.list_peering_routes] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPeeringRoutesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1033,7 +1095,12 @@ def patch_unary( rpc = self._transport._wrapped_methods[self._transport.patch] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1132,7 +1199,12 @@ def remove_peering_unary( rpc = self._transport._wrapped_methods[self._transport.remove_peering] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1218,7 +1290,12 @@ def switch_to_custom_mode_unary( rpc = self._transport._wrapped_methods[self._transport.switch_to_custom_mode] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1320,7 +1397,12 @@ def update_peering_unary( rpc = self._transport._wrapped_methods[self._transport.update_peering] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1341,7 +1423,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/networks/transports/base.py b/google/cloud/compute_v1/services/networks/transports/base.py index 17dde890d..9152fa6f2 100644 --- a/google/cloud/compute_v1/services/networks/transports/base.py +++ b/google/cloud/compute_v1/services/networks/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,13 +124,19 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.add_peering: gapic_v1.method.wrap_method( - self.add_peering, default_timeout=None, client_info=client_info, + self.add_peering, + default_timeout=None, + client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.get_effective_firewalls: gapic_v1.method.wrap_method( self.get_effective_firewalls, @@ -136,19 +144,29 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.list_peering_routes: gapic_v1.method.wrap_method( - self.list_peering_routes, default_timeout=None, client_info=client_info, + self.list_peering_routes, + default_timeout=None, + client_info=client_info, ), self.patch: gapic_v1.method.wrap_method( - self.patch, default_timeout=None, client_info=client_info, + self.patch, + default_timeout=None, + client_info=client_info, ), self.remove_peering: gapic_v1.method.wrap_method( - self.remove_peering, default_timeout=None, client_info=client_info, + self.remove_peering, + default_timeout=None, + client_info=client_info, ), self.switch_to_custom_mode: gapic_v1.method.wrap_method( self.switch_to_custom_mode, @@ -156,16 +174,18 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.update_peering: gapic_v1.method.wrap_method( - self.update_peering, default_timeout=None, client_info=client_info, + self.update_peering, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/node_groups/client.py b/google/cloud/compute_v1/services/node_groups/client.py index f81f7cc88..41aa068bd 100644 --- a/google/cloud/compute_v1/services/node_groups/client.py +++ b/google/cloud/compute_v1/services/node_groups/client.py @@ -51,7 +51,10 @@ class NodeGroupsClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[NodeGroupsTransport]] _transport_registry["rest"] = NodeGroupsRestTransport - def get_transport_class(cls, label: str = None,) -> Type[NodeGroupsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[NodeGroupsTransport]: """Returns an appropriate transport class. Args: @@ -156,7 +159,9 @@ def transport(self) -> NodeGroupsTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -169,9 +174,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -180,9 +189,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -191,9 +204,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -202,10 +219,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -481,7 +502,12 @@ def add_nodes_unary( rpc = self._transport._wrapped_methods[self._transport.add_nodes] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -548,12 +574,20 @@ def aggregated_list( rpc = self._transport._wrapped_methods[self._transport.aggregated_list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.AggregatedListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -651,7 +685,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -760,7 +799,12 @@ def delete_nodes_unary( rpc = self._transport._wrapped_methods[self._transport.delete_nodes] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -853,7 +897,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -976,7 +1025,12 @@ def get_iam_policy( rpc = self._transport._wrapped_methods[self._transport.get_iam_policy] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1084,7 +1138,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1161,12 +1220,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1252,12 +1319,20 @@ def list_nodes( rpc = self._transport._wrapped_methods[self._transport.list_nodes] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListNodesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1363,7 +1438,12 @@ def patch_unary( rpc = self._transport._wrapped_methods[self._transport.patch] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1498,7 +1578,12 @@ def set_iam_policy( rpc = self._transport._wrapped_methods[self._transport.set_iam_policy] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1607,7 +1692,12 @@ def set_node_template_unary( rpc = self._transport._wrapped_methods[self._transport.set_node_template] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1702,7 +1792,12 @@ def test_iam_permissions( rpc = self._transport._wrapped_methods[self._transport.test_iam_permissions] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1723,7 +1818,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/node_groups/transports/base.py b/google/cloud/compute_v1/services/node_groups/transports/base.py index d2165e6c3..98d77f281 100644 --- a/google/cloud/compute_v1/services/node_groups/transports/base.py +++ b/google/cloud/compute_v1/services/node_groups/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,40 +124,64 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.add_nodes: gapic_v1.method.wrap_method( - self.add_nodes, default_timeout=None, client_info=client_info, + self.add_nodes, + default_timeout=None, + client_info=client_info, ), self.aggregated_list: gapic_v1.method.wrap_method( - self.aggregated_list, default_timeout=None, client_info=client_info, + self.aggregated_list, + default_timeout=None, + client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.delete_nodes: gapic_v1.method.wrap_method( - self.delete_nodes, default_timeout=None, client_info=client_info, + self.delete_nodes, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.get_iam_policy: gapic_v1.method.wrap_method( - self.get_iam_policy, default_timeout=None, client_info=client_info, + self.get_iam_policy, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.list_nodes: gapic_v1.method.wrap_method( - self.list_nodes, default_timeout=None, client_info=client_info, + self.list_nodes, + default_timeout=None, + client_info=client_info, ), self.patch: gapic_v1.method.wrap_method( - self.patch, default_timeout=None, client_info=client_info, + self.patch, + default_timeout=None, + client_info=client_info, ), self.set_iam_policy: gapic_v1.method.wrap_method( - self.set_iam_policy, default_timeout=None, client_info=client_info, + self.set_iam_policy, + default_timeout=None, + client_info=client_info, ), self.set_node_template: gapic_v1.method.wrap_method( - self.set_node_template, default_timeout=None, client_info=client_info, + self.set_node_template, + default_timeout=None, + client_info=client_info, ), self.test_iam_permissions: gapic_v1.method.wrap_method( self.test_iam_permissions, @@ -167,9 +193,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/node_templates/client.py b/google/cloud/compute_v1/services/node_templates/client.py index 816644f73..b7e577eb3 100644 --- a/google/cloud/compute_v1/services/node_templates/client.py +++ b/google/cloud/compute_v1/services/node_templates/client.py @@ -51,7 +51,10 @@ class NodeTemplatesClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[NodeTemplatesTransport]] _transport_registry["rest"] = NodeTemplatesRestTransport - def get_transport_class(cls, label: str = None,) -> Type[NodeTemplatesTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[NodeTemplatesTransport]: """Returns an appropriate transport class. Args: @@ -156,7 +159,9 @@ def transport(self) -> NodeTemplatesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -169,9 +174,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -180,9 +189,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -191,9 +204,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -202,10 +219,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -439,12 +460,20 @@ def aggregated_list( rpc = self._transport._wrapped_methods[self._transport.aggregated_list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.AggregatedListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -542,7 +571,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -628,7 +662,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -751,7 +790,12 @@ def get_iam_policy( rpc = self._transport._wrapped_methods[self._transport.get_iam_policy] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -847,7 +891,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -924,12 +973,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1065,7 +1122,12 @@ def set_iam_policy( rpc = self._transport._wrapped_methods[self._transport.set_iam_policy] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1160,7 +1222,12 @@ def test_iam_permissions( rpc = self._transport._wrapped_methods[self._transport.test_iam_permissions] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1181,7 +1248,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/node_templates/transports/base.py b/google/cloud/compute_v1/services/node_templates/transports/base.py index 7757feafc..02c522cc4 100644 --- a/google/cloud/compute_v1/services/node_templates/transports/base.py +++ b/google/cloud/compute_v1/services/node_templates/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,25 +124,39 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.aggregated_list: gapic_v1.method.wrap_method( - self.aggregated_list, default_timeout=None, client_info=client_info, + self.aggregated_list, + default_timeout=None, + client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.get_iam_policy: gapic_v1.method.wrap_method( - self.get_iam_policy, default_timeout=None, client_info=client_info, + self.get_iam_policy, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.set_iam_policy: gapic_v1.method.wrap_method( - self.set_iam_policy, default_timeout=None, client_info=client_info, + self.set_iam_policy, + default_timeout=None, + client_info=client_info, ), self.test_iam_permissions: gapic_v1.method.wrap_method( self.test_iam_permissions, @@ -152,9 +168,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/node_types/client.py b/google/cloud/compute_v1/services/node_types/client.py index 4c820bd90..36641bfbd 100644 --- a/google/cloud/compute_v1/services/node_types/client.py +++ b/google/cloud/compute_v1/services/node_types/client.py @@ -51,7 +51,10 @@ class NodeTypesClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[NodeTypesTransport]] _transport_registry["rest"] = NodeTypesRestTransport - def get_transport_class(cls, label: str = None,) -> Type[NodeTypesTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[NodeTypesTransport]: """Returns an appropriate transport class. Args: @@ -156,7 +159,9 @@ def transport(self) -> NodeTypesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -169,9 +174,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -180,9 +189,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -191,9 +204,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -202,10 +219,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -439,12 +460,20 @@ def aggregated_list( rpc = self._transport._wrapped_methods[self._transport.aggregated_list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.AggregatedListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -535,7 +564,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -611,12 +645,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -638,7 +680,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/node_types/transports/base.py b/google/cloud/compute_v1/services/node_types/transports/base.py index 97045aea1..d95811133 100644 --- a/google/cloud/compute_v1/services/node_types/transports/base.py +++ b/google/cloud/compute_v1/services/node_types/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -123,22 +125,28 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.aggregated_list: gapic_v1.method.wrap_method( - self.aggregated_list, default_timeout=None, client_info=client_info, + self.aggregated_list, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/packet_mirrorings/client.py b/google/cloud/compute_v1/services/packet_mirrorings/client.py index 1377bb878..250e5c327 100644 --- a/google/cloud/compute_v1/services/packet_mirrorings/client.py +++ b/google/cloud/compute_v1/services/packet_mirrorings/client.py @@ -53,7 +53,10 @@ class PacketMirroringsClientMeta(type): ) # type: Dict[str, Type[PacketMirroringsTransport]] _transport_registry["rest"] = PacketMirroringsRestTransport - def get_transport_class(cls, label: str = None,) -> Type[PacketMirroringsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[PacketMirroringsTransport]: """Returns an appropriate transport class. Args: @@ -158,7 +161,9 @@ def transport(self) -> PacketMirroringsTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -171,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -182,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -193,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -204,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -442,12 +463,20 @@ def aggregated_list( rpc = self._transport._wrapped_methods[self._transport.aggregated_list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.AggregatedListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -543,7 +572,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -633,7 +667,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -728,7 +767,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -804,12 +848,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -918,7 +970,12 @@ def patch_unary( rpc = self._transport._wrapped_methods[self._transport.patch] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1013,7 +1070,12 @@ def test_iam_permissions( rpc = self._transport._wrapped_methods[self._transport.test_iam_permissions] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1034,7 +1096,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/packet_mirrorings/transports/base.py b/google/cloud/compute_v1/services/packet_mirrorings/transports/base.py index 201f7466c..9c46c4b0c 100644 --- a/google/cloud/compute_v1/services/packet_mirrorings/transports/base.py +++ b/google/cloud/compute_v1/services/packet_mirrorings/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,22 +124,34 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.aggregated_list: gapic_v1.method.wrap_method( - self.aggregated_list, default_timeout=None, client_info=client_info, + self.aggregated_list, + default_timeout=None, + client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.patch: gapic_v1.method.wrap_method( - self.patch, default_timeout=None, client_info=client_info, + self.patch, + default_timeout=None, + client_info=client_info, ), self.test_iam_permissions: gapic_v1.method.wrap_method( self.test_iam_permissions, @@ -149,9 +163,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/projects/client.py b/google/cloud/compute_v1/services/projects/client.py index d5b38b12d..5b56c412c 100644 --- a/google/cloud/compute_v1/services/projects/client.py +++ b/google/cloud/compute_v1/services/projects/client.py @@ -51,7 +51,10 @@ class ProjectsClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[ProjectsTransport]] _transport_registry["rest"] = ProjectsRestTransport - def get_transport_class(cls, label: str = None,) -> Type[ProjectsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[ProjectsTransport]: """Returns an appropriate transport class. Args: @@ -156,7 +159,9 @@ def transport(self) -> ProjectsTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -169,9 +174,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -180,9 +189,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -191,9 +204,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -202,10 +219,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -451,7 +472,12 @@ def disable_xpn_host_unary( rpc = self._transport._wrapped_methods[self._transport.disable_xpn_host] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -541,7 +567,12 @@ def disable_xpn_resource_unary( rpc = self._transport._wrapped_methods[self._transport.disable_xpn_resource] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -618,7 +649,12 @@ def enable_xpn_host_unary( rpc = self._transport._wrapped_methods[self._transport.enable_xpn_host] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -709,7 +745,12 @@ def enable_xpn_resource_unary( rpc = self._transport._wrapped_methods[self._transport.enable_xpn_resource] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -783,7 +824,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -851,7 +897,12 @@ def get_xpn_host( rpc = self._transport._wrapped_methods[self._transport.get_xpn_host] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -917,12 +968,20 @@ def get_xpn_resources( rpc = self._transport._wrapped_methods[self._transport.get_xpn_resources] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.GetXpnResourcesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -999,12 +1058,20 @@ def list_xpn_hosts( rpc = self._transport._wrapped_methods[self._transport.list_xpn_hosts] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListXpnHostsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1090,7 +1157,12 @@ def move_disk_unary( rpc = self._transport._wrapped_methods[self._transport.move_disk] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1179,7 +1251,12 @@ def move_instance_unary( rpc = self._transport._wrapped_methods[self._transport.move_instance] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1268,7 +1345,12 @@ def set_common_instance_metadata_unary( ] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1360,7 +1442,12 @@ def set_default_network_tier_unary( rpc = self._transport._wrapped_methods[self._transport.set_default_network_tier] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1448,7 +1535,12 @@ def set_usage_export_bucket_unary( rpc = self._transport._wrapped_methods[self._transport.set_usage_export_bucket] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1469,7 +1561,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/projects/transports/base.py b/google/cloud/compute_v1/services/projects/transports/base.py index 6fe9074f5..280b57a1c 100644 --- a/google/cloud/compute_v1/services/projects/transports/base.py +++ b/google/cloud/compute_v1/services/projects/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,7 +124,9 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.disable_xpn_host: gapic_v1.method.wrap_method( - self.disable_xpn_host, default_timeout=None, client_info=client_info, + self.disable_xpn_host, + default_timeout=None, + client_info=client_info, ), self.disable_xpn_resource: gapic_v1.method.wrap_method( self.disable_xpn_resource, @@ -130,28 +134,44 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.enable_xpn_host: gapic_v1.method.wrap_method( - self.enable_xpn_host, default_timeout=None, client_info=client_info, + self.enable_xpn_host, + default_timeout=None, + client_info=client_info, ), self.enable_xpn_resource: gapic_v1.method.wrap_method( - self.enable_xpn_resource, default_timeout=None, client_info=client_info, + self.enable_xpn_resource, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.get_xpn_host: gapic_v1.method.wrap_method( - self.get_xpn_host, default_timeout=None, client_info=client_info, + self.get_xpn_host, + default_timeout=None, + client_info=client_info, ), self.get_xpn_resources: gapic_v1.method.wrap_method( - self.get_xpn_resources, default_timeout=None, client_info=client_info, + self.get_xpn_resources, + default_timeout=None, + client_info=client_info, ), self.list_xpn_hosts: gapic_v1.method.wrap_method( - self.list_xpn_hosts, default_timeout=None, client_info=client_info, + self.list_xpn_hosts, + default_timeout=None, + client_info=client_info, ), self.move_disk: gapic_v1.method.wrap_method( - self.move_disk, default_timeout=None, client_info=client_info, + self.move_disk, + default_timeout=None, + client_info=client_info, ), self.move_instance: gapic_v1.method.wrap_method( - self.move_instance, default_timeout=None, client_info=client_info, + self.move_instance, + default_timeout=None, + client_info=client_info, ), self.set_common_instance_metadata: gapic_v1.method.wrap_method( self.set_common_instance_metadata, @@ -173,9 +193,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/projects/transports/rest.py b/google/cloud/compute_v1/services/projects/transports/rest.py index effe4eb9d..811711bf6 100644 --- a/google/cloud/compute_v1/services/projects/transports/rest.py +++ b/google/cloud/compute_v1/services/projects/transports/rest.py @@ -1027,7 +1027,10 @@ def __call__( """ http_options: List[Dict[str, str]] = [ - {"method": "get", "uri": "/compute/v1/projects/{project}",}, + { + "method": "get", + "uri": "/compute/v1/projects/{project}", + }, ] request, metadata = self._interceptor.pre_get(request, metadata) request_kwargs = compute.GetProjectRequest.to_dict(request) @@ -1116,7 +1119,10 @@ def __call__( """ http_options: List[Dict[str, str]] = [ - {"method": "get", "uri": "/compute/v1/projects/{project}/getXpnHost",}, + { + "method": "get", + "uri": "/compute/v1/projects/{project}/getXpnHost", + }, ] request, metadata = self._interceptor.pre_get_xpn_host(request, metadata) request_kwargs = compute.GetXpnHostProjectRequest.to_dict(request) @@ -1593,37 +1599,37 @@ def __call__( metadata: Sequence[Tuple[str, str]] = (), ) -> compute.Operation: r"""Call the set common instance - metadata method over HTTP. - - Args: - request (~.compute.SetCommonInstanceMetadataProjectRequest): - The request object. A request message for - Projects.SetCommonInstanceMetadata. See - the method description for details. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.compute.Operation: - Represents an Operation resource. Google Compute Engine - has three Operation resources: \* - `Global `__ - \* - `Regional `__ - \* - `Zonal `__ - You can use an operation resource to manage asynchronous - API requests. For more information, read Handling API - responses. Operations can be global, regional or zonal. - - For global operations, use the ``globalOperations`` - resource. - For regional operations, use the - ``regionOperations`` resource. - For zonal operations, - use the ``zonalOperations`` resource. For more - information, read Global, Regional, and Zonal Resources. + metadata method over HTTP. + + Args: + request (~.compute.SetCommonInstanceMetadataProjectRequest): + The request object. A request message for + Projects.SetCommonInstanceMetadata. See + the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. """ diff --git a/google/cloud/compute_v1/services/public_advertised_prefixes/client.py b/google/cloud/compute_v1/services/public_advertised_prefixes/client.py index 4902a8aaf..39e3d31cd 100644 --- a/google/cloud/compute_v1/services/public_advertised_prefixes/client.py +++ b/google/cloud/compute_v1/services/public_advertised_prefixes/client.py @@ -54,7 +54,8 @@ class PublicAdvertisedPrefixesClientMeta(type): _transport_registry["rest"] = PublicAdvertisedPrefixesRestTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[PublicAdvertisedPrefixesTransport]: """Returns an appropriate transport class. @@ -160,7 +161,9 @@ def transport(self) -> PublicAdvertisedPrefixesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -173,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -184,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -195,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -206,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -465,7 +484,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -544,7 +568,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -633,7 +662,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -698,12 +732,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -806,7 +848,12 @@ def patch_unary( rpc = self._transport._wrapped_methods[self._transport.patch] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -827,7 +874,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/public_advertised_prefixes/transports/base.py b/google/cloud/compute_v1/services/public_advertised_prefixes/transports/base.py index 63bd75617..7303b4b56 100644 --- a/google/cloud/compute_v1/services/public_advertised_prefixes/transports/base.py +++ b/google/cloud/compute_v1/services/public_advertised_prefixes/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,28 +124,38 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.patch: gapic_v1.method.wrap_method( - self.patch, default_timeout=None, client_info=client_info, + self.patch, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/public_delegated_prefixes/client.py b/google/cloud/compute_v1/services/public_delegated_prefixes/client.py index 541e307f4..031f492ce 100644 --- a/google/cloud/compute_v1/services/public_delegated_prefixes/client.py +++ b/google/cloud/compute_v1/services/public_delegated_prefixes/client.py @@ -54,7 +54,8 @@ class PublicDelegatedPrefixesClientMeta(type): _transport_registry["rest"] = PublicDelegatedPrefixesRestTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[PublicDelegatedPrefixesTransport]: """Returns an appropriate transport class. @@ -160,7 +161,9 @@ def transport(self) -> PublicDelegatedPrefixesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -173,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -184,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -195,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -206,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -450,12 +469,20 @@ def aggregated_list( rpc = self._transport._wrapped_methods[self._transport.aggregated_list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.AggregatedListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -552,7 +579,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -642,7 +674,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -739,7 +776,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -813,12 +855,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -929,7 +979,12 @@ def patch_unary( rpc = self._transport._wrapped_methods[self._transport.patch] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -950,7 +1005,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/public_delegated_prefixes/transports/base.py b/google/cloud/compute_v1/services/public_delegated_prefixes/transports/base.py index 43aac6305..8d7db3699 100644 --- a/google/cloud/compute_v1/services/public_delegated_prefixes/transports/base.py +++ b/google/cloud/compute_v1/services/public_delegated_prefixes/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,31 +124,43 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.aggregated_list: gapic_v1.method.wrap_method( - self.aggregated_list, default_timeout=None, client_info=client_info, + self.aggregated_list, + default_timeout=None, + client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.patch: gapic_v1.method.wrap_method( - self.patch, default_timeout=None, client_info=client_info, + self.patch, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/public_delegated_prefixes/transports/rest.py b/google/cloud/compute_v1/services/public_delegated_prefixes/transports/rest.py index bdfaea82f..21d842752 100644 --- a/google/cloud/compute_v1/services/public_delegated_prefixes/transports/rest.py +++ b/google/cloud/compute_v1/services/public_delegated_prefixes/transports/rest.py @@ -394,8 +394,8 @@ def __call__( }, ] request, metadata = self._interceptor.pre_aggregated_list(request, metadata) - request_kwargs = compute.AggregatedListPublicDelegatedPrefixesRequest.to_dict( - request + request_kwargs = ( + compute.AggregatedListPublicDelegatedPrefixesRequest.to_dict(request) ) transcoded_request = path_template.transcode(http_options, **request_kwargs) diff --git a/google/cloud/compute_v1/services/region_autoscalers/client.py b/google/cloud/compute_v1/services/region_autoscalers/client.py index e512257d7..eef4699ce 100644 --- a/google/cloud/compute_v1/services/region_autoscalers/client.py +++ b/google/cloud/compute_v1/services/region_autoscalers/client.py @@ -54,7 +54,8 @@ class RegionAutoscalersClientMeta(type): _transport_registry["rest"] = RegionAutoscalersRestTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[RegionAutoscalersTransport]: """Returns an appropriate transport class. @@ -160,7 +161,9 @@ def transport(self) -> RegionAutoscalersTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -173,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -184,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -195,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -206,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -473,7 +492,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -564,7 +588,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -660,7 +689,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -737,12 +771,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -841,7 +883,12 @@ def patch_unary( rpc = self._transport._wrapped_methods[self._transport.patch] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -937,7 +984,12 @@ def update_unary( rpc = self._transport._wrapped_methods[self._transport.update] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -958,7 +1010,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/region_autoscalers/transports/base.py b/google/cloud/compute_v1/services/region_autoscalers/transports/base.py index 986274d5f..fbb6f0c70 100644 --- a/google/cloud/compute_v1/services/region_autoscalers/transports/base.py +++ b/google/cloud/compute_v1/services/region_autoscalers/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,31 +124,43 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.patch: gapic_v1.method.wrap_method( - self.patch, default_timeout=None, client_info=client_info, + self.patch, + default_timeout=None, + client_info=client_info, ), self.update: gapic_v1.method.wrap_method( - self.update, default_timeout=None, client_info=client_info, + self.update, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/region_backend_services/client.py b/google/cloud/compute_v1/services/region_backend_services/client.py index 23cbf3b6d..351bdd98a 100644 --- a/google/cloud/compute_v1/services/region_backend_services/client.py +++ b/google/cloud/compute_v1/services/region_backend_services/client.py @@ -54,7 +54,8 @@ class RegionBackendServicesClientMeta(type): _transport_registry["rest"] = RegionBackendServicesRestTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[RegionBackendServicesTransport]: """Returns an appropriate transport class. @@ -160,7 +161,9 @@ def transport(self) -> RegionBackendServicesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -173,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -184,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -195,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -206,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -476,7 +495,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -574,7 +598,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -669,7 +698,12 @@ def get_health( rpc = self._transport._wrapped_methods[self._transport.get_health] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -767,7 +801,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -846,12 +885,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -963,7 +1010,12 @@ def patch_unary( rpc = self._transport._wrapped_methods[self._transport.patch] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1072,7 +1124,12 @@ def update_unary( rpc = self._transport._wrapped_methods[self._transport.update] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1093,7 +1150,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/region_backend_services/transports/base.py b/google/cloud/compute_v1/services/region_backend_services/transports/base.py index 0aec0c2e7..3756f7197 100644 --- a/google/cloud/compute_v1/services/region_backend_services/transports/base.py +++ b/google/cloud/compute_v1/services/region_backend_services/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,34 +124,48 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.get_health: gapic_v1.method.wrap_method( - self.get_health, default_timeout=None, client_info=client_info, + self.get_health, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.patch: gapic_v1.method.wrap_method( - self.patch, default_timeout=None, client_info=client_info, + self.patch, + default_timeout=None, + client_info=client_info, ), self.update: gapic_v1.method.wrap_method( - self.update, default_timeout=None, client_info=client_info, + self.update, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/region_commitments/client.py b/google/cloud/compute_v1/services/region_commitments/client.py index a3392a565..6d5f66f70 100644 --- a/google/cloud/compute_v1/services/region_commitments/client.py +++ b/google/cloud/compute_v1/services/region_commitments/client.py @@ -54,7 +54,8 @@ class RegionCommitmentsClientMeta(type): _transport_registry["rest"] = RegionCommitmentsRestTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[RegionCommitmentsTransport]: """Returns an appropriate transport class. @@ -160,7 +161,9 @@ def transport(self) -> RegionCommitmentsTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -173,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -184,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -195,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -206,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -444,12 +463,20 @@ def aggregated_list( rpc = self._transport._wrapped_methods[self._transport.aggregated_list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.AggregatedListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -539,7 +566,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -633,7 +665,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -709,12 +746,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -821,7 +866,12 @@ def update_unary( rpc = self._transport._wrapped_methods[self._transport.update] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -842,7 +892,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/region_commitments/transports/base.py b/google/cloud/compute_v1/services/region_commitments/transports/base.py index 54cf026d2..9de3ab268 100644 --- a/google/cloud/compute_v1/services/region_commitments/transports/base.py +++ b/google/cloud/compute_v1/services/region_commitments/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,28 +124,38 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.aggregated_list: gapic_v1.method.wrap_method( - self.aggregated_list, default_timeout=None, client_info=client_info, + self.aggregated_list, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.update: gapic_v1.method.wrap_method( - self.update, default_timeout=None, client_info=client_info, + self.update, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/region_disk_types/client.py b/google/cloud/compute_v1/services/region_disk_types/client.py index bb3ab95ae..6e21c70e2 100644 --- a/google/cloud/compute_v1/services/region_disk_types/client.py +++ b/google/cloud/compute_v1/services/region_disk_types/client.py @@ -53,7 +53,10 @@ class RegionDiskTypesClientMeta(type): ) # type: Dict[str, Type[RegionDiskTypesTransport]] _transport_registry["rest"] = RegionDiskTypesRestTransport - def get_transport_class(cls, label: str = None,) -> Type[RegionDiskTypesTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[RegionDiskTypesTransport]: """Returns an appropriate transport class. Args: @@ -158,7 +161,9 @@ def transport(self) -> RegionDiskTypesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -171,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -182,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -193,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -204,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -468,7 +489,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -544,12 +570,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -571,7 +605,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/region_disk_types/transports/base.py b/google/cloud/compute_v1/services/region_disk_types/transports/base.py index 44470335f..b14adc21d 100644 --- a/google/cloud/compute_v1/services/region_disk_types/transports/base.py +++ b/google/cloud/compute_v1/services/region_disk_types/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -123,19 +125,23 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/region_disks/client.py b/google/cloud/compute_v1/services/region_disks/client.py index 5d5677e9a..9fddfbfac 100644 --- a/google/cloud/compute_v1/services/region_disks/client.py +++ b/google/cloud/compute_v1/services/region_disks/client.py @@ -51,7 +51,10 @@ class RegionDisksClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[RegionDisksTransport]] _transport_registry["rest"] = RegionDisksRestTransport - def get_transport_class(cls, label: str = None,) -> Type[RegionDisksTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[RegionDisksTransport]: """Returns an appropriate transport class. Args: @@ -156,7 +159,9 @@ def transport(self) -> RegionDisksTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -169,9 +174,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -180,9 +189,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -191,9 +204,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -202,10 +219,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -483,7 +504,12 @@ def add_resource_policies_unary( rpc = self._transport._wrapped_methods[self._transport.add_resource_policies] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -590,7 +616,12 @@ def create_snapshot_unary( rpc = self._transport._wrapped_methods[self._transport.create_snapshot] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -689,7 +720,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -780,7 +816,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -903,7 +944,12 @@ def get_iam_policy( rpc = self._transport._wrapped_methods[self._transport.get_iam_policy] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -997,7 +1043,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1072,12 +1123,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1190,7 +1249,12 @@ def remove_resource_policies_unary( rpc = self._transport._wrapped_methods[self._transport.remove_resource_policies] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1295,7 +1359,12 @@ def resize_unary( rpc = self._transport._wrapped_methods[self._transport.resize] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1430,7 +1499,12 @@ def set_iam_policy( rpc = self._transport._wrapped_methods[self._transport.set_iam_policy] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1537,7 +1611,12 @@ def set_labels_unary( rpc = self._transport._wrapped_methods[self._transport.set_labels] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1632,7 +1711,12 @@ def test_iam_permissions( rpc = self._transport._wrapped_methods[self._transport.test_iam_permissions] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1653,7 +1737,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/region_disks/transports/base.py b/google/cloud/compute_v1/services/region_disks/transports/base.py index 9a95d8a66..d605c49f1 100644 --- a/google/cloud/compute_v1/services/region_disks/transports/base.py +++ b/google/cloud/compute_v1/services/region_disks/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -127,22 +129,34 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.create_snapshot: gapic_v1.method.wrap_method( - self.create_snapshot, default_timeout=None, client_info=client_info, + self.create_snapshot, + default_timeout=None, + client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.get_iam_policy: gapic_v1.method.wrap_method( - self.get_iam_policy, default_timeout=None, client_info=client_info, + self.get_iam_policy, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.remove_resource_policies: gapic_v1.method.wrap_method( self.remove_resource_policies, @@ -150,13 +164,19 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.resize: gapic_v1.method.wrap_method( - self.resize, default_timeout=None, client_info=client_info, + self.resize, + default_timeout=None, + client_info=client_info, ), self.set_iam_policy: gapic_v1.method.wrap_method( - self.set_iam_policy, default_timeout=None, client_info=client_info, + self.set_iam_policy, + default_timeout=None, + client_info=client_info, ), self.set_labels: gapic_v1.method.wrap_method( - self.set_labels, default_timeout=None, client_info=client_info, + self.set_labels, + default_timeout=None, + client_info=client_info, ), self.test_iam_permissions: gapic_v1.method.wrap_method( self.test_iam_permissions, @@ -168,9 +188,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/region_health_check_services/client.py b/google/cloud/compute_v1/services/region_health_check_services/client.py index ef8f5db76..e95e5c052 100644 --- a/google/cloud/compute_v1/services/region_health_check_services/client.py +++ b/google/cloud/compute_v1/services/region_health_check_services/client.py @@ -54,7 +54,8 @@ class RegionHealthCheckServicesClientMeta(type): _transport_registry["rest"] = RegionHealthCheckServicesRestTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[RegionHealthCheckServicesTransport]: """Returns an appropriate transport class. @@ -160,7 +161,9 @@ def transport(self) -> RegionHealthCheckServicesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -173,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -184,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -195,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -206,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -476,7 +495,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -562,7 +586,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -659,7 +688,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -736,12 +770,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -853,7 +895,12 @@ def patch_unary( rpc = self._transport._wrapped_methods[self._transport.patch] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -874,7 +921,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/region_health_check_services/transports/base.py b/google/cloud/compute_v1/services/region_health_check_services/transports/base.py index aa5cde282..b8b9164f9 100644 --- a/google/cloud/compute_v1/services/region_health_check_services/transports/base.py +++ b/google/cloud/compute_v1/services/region_health_check_services/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,28 +124,38 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.patch: gapic_v1.method.wrap_method( - self.patch, default_timeout=None, client_info=client_info, + self.patch, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/region_health_checks/client.py b/google/cloud/compute_v1/services/region_health_checks/client.py index 8a9805d31..b28b09d15 100644 --- a/google/cloud/compute_v1/services/region_health_checks/client.py +++ b/google/cloud/compute_v1/services/region_health_checks/client.py @@ -54,7 +54,8 @@ class RegionHealthChecksClientMeta(type): _transport_registry["rest"] = RegionHealthChecksRestTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[RegionHealthChecksTransport]: """Returns an appropriate transport class. @@ -160,7 +161,9 @@ def transport(self) -> RegionHealthChecksTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -173,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -184,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -195,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -206,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -475,7 +494,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -578,7 +602,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -674,7 +703,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -752,12 +786,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -868,7 +910,12 @@ def patch_unary( rpc = self._transport._wrapped_methods[self._transport.patch] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -976,7 +1023,12 @@ def update_unary( rpc = self._transport._wrapped_methods[self._transport.update] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -997,7 +1049,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/region_health_checks/transports/base.py b/google/cloud/compute_v1/services/region_health_checks/transports/base.py index 26834b2c3..282f49ffe 100644 --- a/google/cloud/compute_v1/services/region_health_checks/transports/base.py +++ b/google/cloud/compute_v1/services/region_health_checks/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,31 +124,43 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.patch: gapic_v1.method.wrap_method( - self.patch, default_timeout=None, client_info=client_info, + self.patch, + default_timeout=None, + client_info=client_info, ), self.update: gapic_v1.method.wrap_method( - self.update, default_timeout=None, client_info=client_info, + self.update, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/region_instance_group_managers/client.py b/google/cloud/compute_v1/services/region_instance_group_managers/client.py index 37efe4511..dec49f4d4 100644 --- a/google/cloud/compute_v1/services/region_instance_group_managers/client.py +++ b/google/cloud/compute_v1/services/region_instance_group_managers/client.py @@ -54,7 +54,8 @@ class RegionInstanceGroupManagersClientMeta(type): _transport_registry["rest"] = RegionInstanceGroupManagersRestTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[RegionInstanceGroupManagersTransport]: """Returns an appropriate transport class. @@ -162,7 +163,9 @@ def transport(self) -> RegionInstanceGroupManagersTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -175,9 +178,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -186,9 +193,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -197,9 +208,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -208,10 +223,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -514,7 +533,12 @@ def abandon_instances_unary( rpc = self._transport._wrapped_methods[self._transport.abandon_instances] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -640,7 +664,12 @@ def apply_updates_to_instances_unary( ] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -769,7 +798,12 @@ def create_instances_unary( rpc = self._transport._wrapped_methods[self._transport.create_instances] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -867,7 +901,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1000,7 +1039,12 @@ def delete_instances_unary( rpc = self._transport._wrapped_methods[self._transport.delete_instances] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1126,7 +1170,12 @@ def delete_per_instance_configs_unary( ] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1218,7 +1267,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1324,7 +1378,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1402,12 +1461,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1501,12 +1568,20 @@ def list_errors( rpc = self._transport._wrapped_methods[self._transport.list_errors] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListErrorsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1602,12 +1677,20 @@ def list_managed_instances( rpc = self._transport._wrapped_methods[self._transport.list_managed_instances] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListManagedInstancesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1703,12 +1786,20 @@ def list_per_instance_configs( ] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPerInstanceConfigsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1831,7 +1922,12 @@ def patch_unary( rpc = self._transport._wrapped_methods[self._transport.patch] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1959,7 +2055,12 @@ def patch_per_instance_configs_unary( ] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2090,7 +2191,12 @@ def recreate_instances_unary( rpc = self._transport._wrapped_methods[self._transport.recreate_instances] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2207,7 +2313,12 @@ def resize_unary( rpc = self._transport._wrapped_methods[self._transport.resize] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2329,7 +2440,12 @@ def set_instance_template_unary( rpc = self._transport._wrapped_methods[self._transport.set_instance_template] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2450,7 +2566,12 @@ def set_target_pools_unary( rpc = self._transport._wrapped_methods[self._transport.set_target_pools] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2578,7 +2699,12 @@ def update_per_instance_configs_unary( ] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2599,7 +2725,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/region_instance_group_managers/pagers.py b/google/cloud/compute_v1/services/region_instance_group_managers/pagers.py index ce467d1de..85d760312 100644 --- a/google/cloud/compute_v1/services/region_instance_group_managers/pagers.py +++ b/google/cloud/compute_v1/services/region_instance_group_managers/pagers.py @@ -258,8 +258,8 @@ def __init__( sent along with the request as metadata. """ self._method = method - self._request = compute.ListPerInstanceConfigsRegionInstanceGroupManagersRequest( - request + self._request = ( + compute.ListPerInstanceConfigsRegionInstanceGroupManagersRequest(request) ) self._response = response self._metadata = metadata diff --git a/google/cloud/compute_v1/services/region_instance_group_managers/transports/base.py b/google/cloud/compute_v1/services/region_instance_group_managers/transports/base.py index 43fa111de..9fc17b64f 100644 --- a/google/cloud/compute_v1/services/region_instance_group_managers/transports/base.py +++ b/google/cloud/compute_v1/services/region_instance_group_managers/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,7 +124,9 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.abandon_instances: gapic_v1.method.wrap_method( - self.abandon_instances, default_timeout=None, client_info=client_info, + self.abandon_instances, + default_timeout=None, + client_info=client_info, ), self.apply_updates_to_instances: gapic_v1.method.wrap_method( self.apply_updates_to_instances, @@ -130,13 +134,19 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.create_instances: gapic_v1.method.wrap_method( - self.create_instances, default_timeout=None, client_info=client_info, + self.create_instances, + default_timeout=None, + client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.delete_instances: gapic_v1.method.wrap_method( - self.delete_instances, default_timeout=None, client_info=client_info, + self.delete_instances, + default_timeout=None, + client_info=client_info, ), self.delete_per_instance_configs: gapic_v1.method.wrap_method( self.delete_per_instance_configs, @@ -144,16 +154,24 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.list_errors: gapic_v1.method.wrap_method( - self.list_errors, default_timeout=None, client_info=client_info, + self.list_errors, + default_timeout=None, + client_info=client_info, ), self.list_managed_instances: gapic_v1.method.wrap_method( self.list_managed_instances, @@ -166,7 +184,9 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.patch: gapic_v1.method.wrap_method( - self.patch, default_timeout=None, client_info=client_info, + self.patch, + default_timeout=None, + client_info=client_info, ), self.patch_per_instance_configs: gapic_v1.method.wrap_method( self.patch_per_instance_configs, @@ -174,10 +194,14 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.recreate_instances: gapic_v1.method.wrap_method( - self.recreate_instances, default_timeout=None, client_info=client_info, + self.recreate_instances, + default_timeout=None, + client_info=client_info, ), self.resize: gapic_v1.method.wrap_method( - self.resize, default_timeout=None, client_info=client_info, + self.resize, + default_timeout=None, + client_info=client_info, ), self.set_instance_template: gapic_v1.method.wrap_method( self.set_instance_template, @@ -185,7 +209,9 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.set_target_pools: gapic_v1.method.wrap_method( - self.set_target_pools, default_timeout=None, client_info=client_info, + self.set_target_pools, + default_timeout=None, + client_info=client_info, ), self.update_per_instance_configs: gapic_v1.method.wrap_method( self.update_per_instance_configs, @@ -197,9 +223,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/region_instance_group_managers/transports/rest.py b/google/cloud/compute_v1/services/region_instance_group_managers/transports/rest.py index c6b486615..95cf03d60 100644 --- a/google/cloud/compute_v1/services/region_instance_group_managers/transports/rest.py +++ b/google/cloud/compute_v1/services/region_instance_group_managers/transports/rest.py @@ -836,8 +836,10 @@ def __call__( request, metadata = self._interceptor.pre_abandon_instances( request, metadata ) - request_kwargs = compute.AbandonInstancesRegionInstanceGroupManagerRequest.to_dict( - request + request_kwargs = ( + compute.AbandonInstancesRegionInstanceGroupManagerRequest.to_dict( + request + ) ) transcoded_request = path_template.transcode(http_options, **request_kwargs) @@ -911,37 +913,37 @@ def __call__( metadata: Sequence[Tuple[str, str]] = (), ) -> compute.Operation: r"""Call the apply updates to - instances method over HTTP. - - Args: - request (~.compute.ApplyUpdatesToInstancesRegionInstanceGroupManagerRequest): - The request object. A request message for - RegionInstanceGroupManagers.ApplyUpdatesToInstances. - See the method description for details. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.compute.Operation: - Represents an Operation resource. Google Compute Engine - has three Operation resources: \* - `Global `__ - \* - `Regional `__ - \* - `Zonal `__ - You can use an operation resource to manage asynchronous - API requests. For more information, read Handling API - responses. Operations can be global, regional or zonal. - - For global operations, use the ``globalOperations`` - resource. - For regional operations, use the - ``regionOperations`` resource. - For zonal operations, - use the ``zonalOperations`` resource. For more - information, read Global, Regional, and Zonal Resources. + instances method over HTTP. + + Args: + request (~.compute.ApplyUpdatesToInstancesRegionInstanceGroupManagerRequest): + The request object. A request message for + RegionInstanceGroupManagers.ApplyUpdatesToInstances. + See the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. """ @@ -1073,8 +1075,10 @@ def __call__( request, metadata = self._interceptor.pre_create_instances( request, metadata ) - request_kwargs = compute.CreateInstancesRegionInstanceGroupManagerRequest.to_dict( - request + request_kwargs = ( + compute.CreateInstancesRegionInstanceGroupManagerRequest.to_dict( + request + ) ) transcoded_request = path_template.transcode(http_options, **request_kwargs) @@ -1297,8 +1301,10 @@ def __call__( request, metadata = self._interceptor.pre_delete_instances( request, metadata ) - request_kwargs = compute.DeleteInstancesRegionInstanceGroupManagerRequest.to_dict( - request + request_kwargs = ( + compute.DeleteInstancesRegionInstanceGroupManagerRequest.to_dict( + request + ) ) transcoded_request = path_template.transcode(http_options, **request_kwargs) @@ -1372,37 +1378,37 @@ def __call__( metadata: Sequence[Tuple[str, str]] = (), ) -> compute.Operation: r"""Call the delete per instance - configs method over HTTP. - - Args: - request (~.compute.DeletePerInstanceConfigsRegionInstanceGroupManagerRequest): - The request object. A request message for - RegionInstanceGroupManagers.DeletePerInstanceConfigs. - See the method description for details. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.compute.Operation: - Represents an Operation resource. Google Compute Engine - has three Operation resources: \* - `Global `__ - \* - `Regional `__ - \* - `Zonal `__ - You can use an operation resource to manage asynchronous - API requests. For more information, read Handling API - responses. Operations can be global, regional or zonal. - - For global operations, use the ``globalOperations`` - resource. - For regional operations, use the - ``regionOperations`` resource. - For zonal operations, - use the ``zonalOperations`` resource. For more - information, read Global, Regional, and Zonal Resources. + configs method over HTTP. + + Args: + request (~.compute.DeletePerInstanceConfigsRegionInstanceGroupManagerRequest): + The request object. A request message for + RegionInstanceGroupManagers.DeletePerInstanceConfigs. + See the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. """ @@ -1823,8 +1829,8 @@ def __call__( }, ] request, metadata = self._interceptor.pre_list_errors(request, metadata) - request_kwargs = compute.ListErrorsRegionInstanceGroupManagersRequest.to_dict( - request + request_kwargs = ( + compute.ListErrorsRegionInstanceGroupManagersRequest.to_dict(request) ) transcoded_request = path_template.transcode(http_options, **request_kwargs) @@ -1916,8 +1922,10 @@ def __call__( request, metadata = self._interceptor.pre_list_managed_instances( request, metadata ) - request_kwargs = compute.ListManagedInstancesRegionInstanceGroupManagersRequest.to_dict( - request + request_kwargs = ( + compute.ListManagedInstancesRegionInstanceGroupManagersRequest.to_dict( + request + ) ) transcoded_request = path_template.transcode(http_options, **request_kwargs) @@ -2189,37 +2197,37 @@ def __call__( metadata: Sequence[Tuple[str, str]] = (), ) -> compute.Operation: r"""Call the patch per instance - configs method over HTTP. - - Args: - request (~.compute.PatchPerInstanceConfigsRegionInstanceGroupManagerRequest): - The request object. A request message for - RegionInstanceGroupManagers.PatchPerInstanceConfigs. - See the method description for details. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.compute.Operation: - Represents an Operation resource. Google Compute Engine - has three Operation resources: \* - `Global `__ - \* - `Regional `__ - \* - `Zonal `__ - You can use an operation resource to manage asynchronous - API requests. For more information, read Handling API - responses. Operations can be global, regional or zonal. - - For global operations, use the ``globalOperations`` - resource. - For regional operations, use the - ``regionOperations`` resource. - For zonal operations, - use the ``zonalOperations`` resource. For more - information, read Global, Regional, and Zonal Resources. + configs method over HTTP. + + Args: + request (~.compute.PatchPerInstanceConfigsRegionInstanceGroupManagerRequest): + The request object. A request message for + RegionInstanceGroupManagers.PatchPerInstanceConfigs. + See the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. """ @@ -2351,8 +2359,10 @@ def __call__( request, metadata = self._interceptor.pre_recreate_instances( request, metadata ) - request_kwargs = compute.RecreateInstancesRegionInstanceGroupManagerRequest.to_dict( - request + request_kwargs = ( + compute.RecreateInstancesRegionInstanceGroupManagerRequest.to_dict( + request + ) ) transcoded_request = path_template.transcode(http_options, **request_kwargs) @@ -2577,8 +2587,10 @@ def __call__( request, metadata = self._interceptor.pre_set_instance_template( request, metadata ) - request_kwargs = compute.SetInstanceTemplateRegionInstanceGroupManagerRequest.to_dict( - request + request_kwargs = ( + compute.SetInstanceTemplateRegionInstanceGroupManagerRequest.to_dict( + request + ) ) transcoded_request = path_template.transcode(http_options, **request_kwargs) @@ -2695,8 +2707,8 @@ def __call__( request, metadata = self._interceptor.pre_set_target_pools( request, metadata ) - request_kwargs = compute.SetTargetPoolsRegionInstanceGroupManagerRequest.to_dict( - request + request_kwargs = ( + compute.SetTargetPoolsRegionInstanceGroupManagerRequest.to_dict(request) ) transcoded_request = path_template.transcode(http_options, **request_kwargs) @@ -2770,37 +2782,37 @@ def __call__( metadata: Sequence[Tuple[str, str]] = (), ) -> compute.Operation: r"""Call the update per instance - configs method over HTTP. - - Args: - request (~.compute.UpdatePerInstanceConfigsRegionInstanceGroupManagerRequest): - The request object. A request message for - RegionInstanceGroupManagers.UpdatePerInstanceConfigs. - See the method description for details. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.compute.Operation: - Represents an Operation resource. Google Compute Engine - has three Operation resources: \* - `Global `__ - \* - `Regional `__ - \* - `Zonal `__ - You can use an operation resource to manage asynchronous - API requests. For more information, read Handling API - responses. Operations can be global, regional or zonal. - - For global operations, use the ``globalOperations`` - resource. - For regional operations, use the - ``regionOperations`` resource. - For zonal operations, - use the ``zonalOperations`` resource. For more - information, read Global, Regional, and Zonal Resources. + configs method over HTTP. + + Args: + request (~.compute.UpdatePerInstanceConfigsRegionInstanceGroupManagerRequest): + The request object. A request message for + RegionInstanceGroupManagers.UpdatePerInstanceConfigs. + See the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. """ diff --git a/google/cloud/compute_v1/services/region_instance_groups/client.py b/google/cloud/compute_v1/services/region_instance_groups/client.py index fd1857e78..1f16f7060 100644 --- a/google/cloud/compute_v1/services/region_instance_groups/client.py +++ b/google/cloud/compute_v1/services/region_instance_groups/client.py @@ -54,7 +54,8 @@ class RegionInstanceGroupsClientMeta(type): _transport_registry["rest"] = RegionInstanceGroupsRestTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[RegionInstanceGroupsTransport]: """Returns an appropriate transport class. @@ -160,7 +161,9 @@ def transport(self) -> RegionInstanceGroupsTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -173,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -184,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -195,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -206,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -474,7 +493,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -552,12 +576,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -664,12 +696,20 @@ def list_instances( rpc = self._transport._wrapped_methods[self._transport.list_instances] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListInstancesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -785,7 +825,12 @@ def set_named_ports_unary( rpc = self._transport._wrapped_methods[self._transport.set_named_ports] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -806,7 +851,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/region_instance_groups/transports/base.py b/google/cloud/compute_v1/services/region_instance_groups/transports/base.py index a0080dbf3..f662225cf 100644 --- a/google/cloud/compute_v1/services/region_instance_groups/transports/base.py +++ b/google/cloud/compute_v1/services/region_instance_groups/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,25 +124,33 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.list_instances: gapic_v1.method.wrap_method( - self.list_instances, default_timeout=None, client_info=client_info, + self.list_instances, + default_timeout=None, + client_info=client_info, ), self.set_named_ports: gapic_v1.method.wrap_method( - self.set_named_ports, default_timeout=None, client_info=client_info, + self.set_named_ports, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/region_instances/client.py b/google/cloud/compute_v1/services/region_instances/client.py index 45004121f..2d9aafca7 100644 --- a/google/cloud/compute_v1/services/region_instances/client.py +++ b/google/cloud/compute_v1/services/region_instances/client.py @@ -52,7 +52,10 @@ class RegionInstancesClientMeta(type): ) # type: Dict[str, Type[RegionInstancesTransport]] _transport_registry["rest"] = RegionInstancesRestTransport - def get_transport_class(cls, label: str = None,) -> Type[RegionInstancesTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[RegionInstancesTransport]: """Returns an appropriate transport class. Args: @@ -157,7 +160,9 @@ def transport(self) -> RegionInstancesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -170,9 +175,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -181,9 +190,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -192,9 +205,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -203,10 +220,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -475,7 +496,12 @@ def bulk_insert_unary( rpc = self._transport._wrapped_methods[self._transport.bulk_insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -496,7 +522,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/region_instances/transports/base.py b/google/cloud/compute_v1/services/region_instances/transports/base.py index f52798094..03b8a6229 100644 --- a/google/cloud/compute_v1/services/region_instances/transports/base.py +++ b/google/cloud/compute_v1/services/region_instances/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,16 +124,18 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.bulk_insert: gapic_v1.method.wrap_method( - self.bulk_insert, default_timeout=None, client_info=client_info, + self.bulk_insert, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/region_network_endpoint_groups/client.py b/google/cloud/compute_v1/services/region_network_endpoint_groups/client.py index 951f9325d..558018ce6 100644 --- a/google/cloud/compute_v1/services/region_network_endpoint_groups/client.py +++ b/google/cloud/compute_v1/services/region_network_endpoint_groups/client.py @@ -54,7 +54,8 @@ class RegionNetworkEndpointGroupsClientMeta(type): _transport_registry["rest"] = RegionNetworkEndpointGroupsRestTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[RegionNetworkEndpointGroupsTransport]: """Returns an appropriate transport class. @@ -162,7 +163,9 @@ def transport(self) -> RegionNetworkEndpointGroupsTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -175,9 +178,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -186,9 +193,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -197,9 +208,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -208,10 +223,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -481,7 +500,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -577,7 +601,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -677,7 +706,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -755,12 +789,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -782,7 +824,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/region_network_endpoint_groups/transports/base.py b/google/cloud/compute_v1/services/region_network_endpoint_groups/transports/base.py index 05d4f7d93..90ce19ec3 100644 --- a/google/cloud/compute_v1/services/region_network_endpoint_groups/transports/base.py +++ b/google/cloud/compute_v1/services/region_network_endpoint_groups/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,25 +124,33 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/region_notification_endpoints/client.py b/google/cloud/compute_v1/services/region_notification_endpoints/client.py index 95cf6c547..4092e1de8 100644 --- a/google/cloud/compute_v1/services/region_notification_endpoints/client.py +++ b/google/cloud/compute_v1/services/region_notification_endpoints/client.py @@ -54,7 +54,8 @@ class RegionNotificationEndpointsClientMeta(type): _transport_registry["rest"] = RegionNotificationEndpointsRestTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[RegionNotificationEndpointsTransport]: """Returns an appropriate transport class. @@ -162,7 +163,9 @@ def transport(self) -> RegionNotificationEndpointsTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -175,9 +178,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -186,9 +193,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -197,9 +208,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -208,10 +223,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -478,7 +497,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -568,7 +592,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -665,7 +694,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -741,12 +775,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -768,7 +810,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/region_notification_endpoints/transports/base.py b/google/cloud/compute_v1/services/region_notification_endpoints/transports/base.py index 09b02249c..02db60bd4 100644 --- a/google/cloud/compute_v1/services/region_notification_endpoints/transports/base.py +++ b/google/cloud/compute_v1/services/region_notification_endpoints/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,25 +124,33 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/region_operations/client.py b/google/cloud/compute_v1/services/region_operations/client.py index 157a39134..4e4e8e48b 100644 --- a/google/cloud/compute_v1/services/region_operations/client.py +++ b/google/cloud/compute_v1/services/region_operations/client.py @@ -53,7 +53,10 @@ class RegionOperationsClientMeta(type): ) # type: Dict[str, Type[RegionOperationsTransport]] _transport_registry["rest"] = RegionOperationsRestTransport - def get_transport_class(cls, label: str = None,) -> Type[RegionOperationsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[RegionOperationsTransport]: """Returns an appropriate transport class. Args: @@ -158,7 +161,9 @@ def transport(self) -> RegionOperationsTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -171,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -182,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -193,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -204,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -460,7 +481,12 @@ def delete( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -556,7 +582,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -632,12 +663,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -745,7 +784,12 @@ def wait( rpc = self._transport._wrapped_methods[self._transport.wait] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -766,7 +810,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/region_operations/transports/base.py b/google/cloud/compute_v1/services/region_operations/transports/base.py index aaaeaac4e..eac98d922 100644 --- a/google/cloud/compute_v1/services/region_operations/transports/base.py +++ b/google/cloud/compute_v1/services/region_operations/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,25 +124,33 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.wait: gapic_v1.method.wrap_method( - self.wait, default_timeout=None, client_info=client_info, + self.wait, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/region_ssl_certificates/client.py b/google/cloud/compute_v1/services/region_ssl_certificates/client.py index d69349b6d..5ef1778c5 100644 --- a/google/cloud/compute_v1/services/region_ssl_certificates/client.py +++ b/google/cloud/compute_v1/services/region_ssl_certificates/client.py @@ -54,7 +54,8 @@ class RegionSslCertificatesClientMeta(type): _transport_registry["rest"] = RegionSslCertificatesRestTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[RegionSslCertificatesTransport]: """Returns an appropriate transport class. @@ -160,7 +161,9 @@ def transport(self) -> RegionSslCertificatesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -173,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -184,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -195,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -206,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -476,7 +495,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -576,7 +600,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -673,7 +702,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -752,12 +786,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -779,7 +821,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/region_ssl_certificates/transports/base.py b/google/cloud/compute_v1/services/region_ssl_certificates/transports/base.py index b93876a1a..f47c8d4f7 100644 --- a/google/cloud/compute_v1/services/region_ssl_certificates/transports/base.py +++ b/google/cloud/compute_v1/services/region_ssl_certificates/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,25 +124,33 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/region_target_http_proxies/client.py b/google/cloud/compute_v1/services/region_target_http_proxies/client.py index c9f02143c..0e490db98 100644 --- a/google/cloud/compute_v1/services/region_target_http_proxies/client.py +++ b/google/cloud/compute_v1/services/region_target_http_proxies/client.py @@ -54,7 +54,8 @@ class RegionTargetHttpProxiesClientMeta(type): _transport_registry["rest"] = RegionTargetHttpProxiesRestTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[RegionTargetHttpProxiesTransport]: """Returns an appropriate transport class. @@ -160,7 +161,9 @@ def transport(self) -> RegionTargetHttpProxiesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -173,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -184,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -195,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -206,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -475,7 +494,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -572,7 +596,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -669,7 +698,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -747,12 +781,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -860,7 +902,12 @@ def set_url_map_unary( rpc = self._transport._wrapped_methods[self._transport.set_url_map] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -881,7 +928,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/region_target_http_proxies/transports/base.py b/google/cloud/compute_v1/services/region_target_http_proxies/transports/base.py index fab92da3e..daa159152 100644 --- a/google/cloud/compute_v1/services/region_target_http_proxies/transports/base.py +++ b/google/cloud/compute_v1/services/region_target_http_proxies/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,28 +124,38 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.set_url_map: gapic_v1.method.wrap_method( - self.set_url_map, default_timeout=None, client_info=client_info, + self.set_url_map, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/region_target_https_proxies/client.py b/google/cloud/compute_v1/services/region_target_https_proxies/client.py index 97ad86266..39f9ab4b8 100644 --- a/google/cloud/compute_v1/services/region_target_https_proxies/client.py +++ b/google/cloud/compute_v1/services/region_target_https_proxies/client.py @@ -54,7 +54,8 @@ class RegionTargetHttpsProxiesClientMeta(type): _transport_registry["rest"] = RegionTargetHttpsProxiesRestTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[RegionTargetHttpsProxiesTransport]: """Returns an appropriate transport class. @@ -160,7 +161,9 @@ def transport(self) -> RegionTargetHttpsProxiesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -173,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -184,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -195,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -206,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -475,7 +494,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -571,7 +595,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -668,7 +697,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -747,12 +781,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -874,7 +916,12 @@ def set_ssl_certificates_unary( rpc = self._transport._wrapped_methods[self._transport.set_ssl_certificates] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -981,7 +1028,12 @@ def set_url_map_unary( rpc = self._transport._wrapped_methods[self._transport.set_url_map] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1002,7 +1054,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/region_target_https_proxies/transports/base.py b/google/cloud/compute_v1/services/region_target_https_proxies/transports/base.py index a548a0a2b..119e025e8 100644 --- a/google/cloud/compute_v1/services/region_target_https_proxies/transports/base.py +++ b/google/cloud/compute_v1/services/region_target_https_proxies/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,16 +124,24 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.set_ssl_certificates: gapic_v1.method.wrap_method( self.set_ssl_certificates, @@ -139,16 +149,18 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.set_url_map: gapic_v1.method.wrap_method( - self.set_url_map, default_timeout=None, client_info=client_info, + self.set_url_map, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/region_target_https_proxies/transports/rest.py b/google/cloud/compute_v1/services/region_target_https_proxies/transports/rest.py index 9af391846..025619fab 100644 --- a/google/cloud/compute_v1/services/region_target_https_proxies/transports/rest.py +++ b/google/cloud/compute_v1/services/region_target_https_proxies/transports/rest.py @@ -827,8 +827,8 @@ def __call__( request, metadata = self._interceptor.pre_set_ssl_certificates( request, metadata ) - request_kwargs = compute.SetSslCertificatesRegionTargetHttpsProxyRequest.to_dict( - request + request_kwargs = ( + compute.SetSslCertificatesRegionTargetHttpsProxyRequest.to_dict(request) ) transcoded_request = path_template.transcode(http_options, **request_kwargs) diff --git a/google/cloud/compute_v1/services/region_url_maps/client.py b/google/cloud/compute_v1/services/region_url_maps/client.py index f64068ab5..1c433158b 100644 --- a/google/cloud/compute_v1/services/region_url_maps/client.py +++ b/google/cloud/compute_v1/services/region_url_maps/client.py @@ -51,7 +51,10 @@ class RegionUrlMapsClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[RegionUrlMapsTransport]] _transport_registry["rest"] = RegionUrlMapsRestTransport - def get_transport_class(cls, label: str = None,) -> Type[RegionUrlMapsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[RegionUrlMapsTransport]: """Returns an appropriate transport class. Args: @@ -156,7 +159,9 @@ def transport(self) -> RegionUrlMapsTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -169,9 +174,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -180,9 +189,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -191,9 +204,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -202,10 +219,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -471,7 +492,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -575,7 +601,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -671,7 +702,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -748,12 +784,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -860,7 +904,12 @@ def patch_unary( rpc = self._transport._wrapped_methods[self._transport.patch] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -966,7 +1015,12 @@ def update_unary( rpc = self._transport._wrapped_methods[self._transport.update] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1062,7 +1116,12 @@ def validate( rpc = self._transport._wrapped_methods[self._transport.validate] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1083,7 +1142,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/region_url_maps/transports/base.py b/google/cloud/compute_v1/services/region_url_maps/transports/base.py index 84f072b06..6c1f1b458 100644 --- a/google/cloud/compute_v1/services/region_url_maps/transports/base.py +++ b/google/cloud/compute_v1/services/region_url_maps/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,34 +124,48 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.patch: gapic_v1.method.wrap_method( - self.patch, default_timeout=None, client_info=client_info, + self.patch, + default_timeout=None, + client_info=client_info, ), self.update: gapic_v1.method.wrap_method( - self.update, default_timeout=None, client_info=client_info, + self.update, + default_timeout=None, + client_info=client_info, ), self.validate: gapic_v1.method.wrap_method( - self.validate, default_timeout=None, client_info=client_info, + self.validate, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/regions/client.py b/google/cloud/compute_v1/services/regions/client.py index d81c8e345..3e4f0f7b2 100644 --- a/google/cloud/compute_v1/services/regions/client.py +++ b/google/cloud/compute_v1/services/regions/client.py @@ -51,7 +51,10 @@ class RegionsClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[RegionsTransport]] _transport_registry["rest"] = RegionsRestTransport - def get_transport_class(cls, label: str = None,) -> Type[RegionsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[RegionsTransport]: """Returns an appropriate transport class. Args: @@ -156,7 +159,9 @@ def transport(self) -> RegionsTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -169,9 +174,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -180,9 +189,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -191,9 +204,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -202,10 +219,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -457,7 +478,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -530,12 +556,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -557,7 +591,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/regions/transports/base.py b/google/cloud/compute_v1/services/regions/transports/base.py index b51eb9aa0..771e8ae33 100644 --- a/google/cloud/compute_v1/services/regions/transports/base.py +++ b/google/cloud/compute_v1/services/regions/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -123,19 +125,23 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/regions/transports/rest.py b/google/cloud/compute_v1/services/regions/transports/rest.py index dc86adce0..22c63f479 100644 --- a/google/cloud/compute_v1/services/regions/transports/rest.py +++ b/google/cloud/compute_v1/services/regions/transports/rest.py @@ -350,7 +350,10 @@ def __call__( """ http_options: List[Dict[str, str]] = [ - {"method": "get", "uri": "/compute/v1/projects/{project}/regions",}, + { + "method": "get", + "uri": "/compute/v1/projects/{project}/regions", + }, ] request, metadata = self._interceptor.pre_list(request, metadata) request_kwargs = compute.ListRegionsRequest.to_dict(request) diff --git a/google/cloud/compute_v1/services/reservations/client.py b/google/cloud/compute_v1/services/reservations/client.py index 4e769d007..b4c5f50c5 100644 --- a/google/cloud/compute_v1/services/reservations/client.py +++ b/google/cloud/compute_v1/services/reservations/client.py @@ -51,7 +51,10 @@ class ReservationsClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[ReservationsTransport]] _transport_registry["rest"] = ReservationsRestTransport - def get_transport_class(cls, label: str = None,) -> Type[ReservationsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[ReservationsTransport]: """Returns an appropriate transport class. Args: @@ -156,7 +159,9 @@ def transport(self) -> ReservationsTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -169,9 +174,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -180,9 +189,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -191,9 +204,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -202,10 +219,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -440,12 +461,20 @@ def aggregated_list( rpc = self._transport._wrapped_methods[self._transport.aggregated_list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.AggregatedListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -539,7 +568,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -624,7 +658,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -747,7 +786,12 @@ def get_iam_policy( rpc = self._transport._wrapped_methods[self._transport.get_iam_policy] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -841,7 +885,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -915,12 +964,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1028,7 +1085,12 @@ def resize_unary( rpc = self._transport._wrapped_methods[self._transport.resize] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1163,7 +1225,12 @@ def set_iam_policy( rpc = self._transport._wrapped_methods[self._transport.set_iam_policy] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1258,7 +1325,12 @@ def test_iam_permissions( rpc = self._transport._wrapped_methods[self._transport.test_iam_permissions] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1359,7 +1431,12 @@ def update_unary( rpc = self._transport._wrapped_methods[self._transport.update] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1380,7 +1457,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/reservations/transports/base.py b/google/cloud/compute_v1/services/reservations/transports/base.py index 0e3aef1ff..4a114b0bc 100644 --- a/google/cloud/compute_v1/services/reservations/transports/base.py +++ b/google/cloud/compute_v1/services/reservations/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,28 +124,44 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.aggregated_list: gapic_v1.method.wrap_method( - self.aggregated_list, default_timeout=None, client_info=client_info, + self.aggregated_list, + default_timeout=None, + client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.get_iam_policy: gapic_v1.method.wrap_method( - self.get_iam_policy, default_timeout=None, client_info=client_info, + self.get_iam_policy, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.resize: gapic_v1.method.wrap_method( - self.resize, default_timeout=None, client_info=client_info, + self.resize, + default_timeout=None, + client_info=client_info, ), self.set_iam_policy: gapic_v1.method.wrap_method( - self.set_iam_policy, default_timeout=None, client_info=client_info, + self.set_iam_policy, + default_timeout=None, + client_info=client_info, ), self.test_iam_permissions: gapic_v1.method.wrap_method( self.test_iam_permissions, @@ -151,16 +169,18 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.update: gapic_v1.method.wrap_method( - self.update, default_timeout=None, client_info=client_info, + self.update, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/resource_policies/client.py b/google/cloud/compute_v1/services/resource_policies/client.py index b5699745e..0fbbc6463 100644 --- a/google/cloud/compute_v1/services/resource_policies/client.py +++ b/google/cloud/compute_v1/services/resource_policies/client.py @@ -53,7 +53,10 @@ class ResourcePoliciesClientMeta(type): ) # type: Dict[str, Type[ResourcePoliciesTransport]] _transport_registry["rest"] = ResourcePoliciesRestTransport - def get_transport_class(cls, label: str = None,) -> Type[ResourcePoliciesTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[ResourcePoliciesTransport]: """Returns an appropriate transport class. Args: @@ -158,7 +161,9 @@ def transport(self) -> ResourcePoliciesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -171,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -182,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -193,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -204,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -442,12 +463,20 @@ def aggregated_list( rpc = self._transport._wrapped_methods[self._transport.aggregated_list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.AggregatedListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -543,7 +572,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -630,7 +664,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -753,7 +792,12 @@ def get_iam_policy( rpc = self._transport._wrapped_methods[self._transport.get_iam_policy] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -846,7 +890,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -921,12 +970,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1062,7 +1119,12 @@ def set_iam_policy( rpc = self._transport._wrapped_methods[self._transport.set_iam_policy] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1157,7 +1219,12 @@ def test_iam_permissions( rpc = self._transport._wrapped_methods[self._transport.test_iam_permissions] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1178,7 +1245,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/resource_policies/transports/base.py b/google/cloud/compute_v1/services/resource_policies/transports/base.py index 9a57a599f..f72efc16b 100644 --- a/google/cloud/compute_v1/services/resource_policies/transports/base.py +++ b/google/cloud/compute_v1/services/resource_policies/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,25 +124,39 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.aggregated_list: gapic_v1.method.wrap_method( - self.aggregated_list, default_timeout=None, client_info=client_info, + self.aggregated_list, + default_timeout=None, + client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.get_iam_policy: gapic_v1.method.wrap_method( - self.get_iam_policy, default_timeout=None, client_info=client_info, + self.get_iam_policy, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.set_iam_policy: gapic_v1.method.wrap_method( - self.set_iam_policy, default_timeout=None, client_info=client_info, + self.set_iam_policy, + default_timeout=None, + client_info=client_info, ), self.test_iam_permissions: gapic_v1.method.wrap_method( self.test_iam_permissions, @@ -152,9 +168,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/routers/client.py b/google/cloud/compute_v1/services/routers/client.py index 74cfadead..bbcad487a 100644 --- a/google/cloud/compute_v1/services/routers/client.py +++ b/google/cloud/compute_v1/services/routers/client.py @@ -51,7 +51,10 @@ class RoutersClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[RoutersTransport]] _transport_registry["rest"] = RoutersRestTransport - def get_transport_class(cls, label: str = None,) -> Type[RoutersTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[RoutersTransport]: """Returns an appropriate transport class. Args: @@ -156,7 +159,9 @@ def transport(self) -> RoutersTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -169,9 +174,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -180,9 +189,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -191,9 +204,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -202,10 +219,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -440,12 +461,20 @@ def aggregated_list( rpc = self._transport._wrapped_methods[self._transport.aggregated_list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.AggregatedListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -540,7 +569,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -623,7 +657,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -710,12 +749,20 @@ def get_nat_mapping_info( rpc = self._transport._wrapped_methods[self._transport.get_nat_mapping_info] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.GetNatMappingInfoPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -795,7 +842,12 @@ def get_router_status( rpc = self._transport._wrapped_methods[self._transport.get_router_status] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -888,7 +940,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -962,12 +1019,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1071,7 +1136,12 @@ def patch_unary( rpc = self._transport._wrapped_methods[self._transport.patch] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1158,7 +1228,12 @@ def preview( rpc = self._transport._wrapped_methods[self._transport.preview] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1265,7 +1340,12 @@ def update_unary( rpc = self._transport._wrapped_methods[self._transport.update] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1286,7 +1366,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/routers/transports/base.py b/google/cloud/compute_v1/services/routers/transports/base.py index 59b1f7faa..e348facb2 100644 --- a/google/cloud/compute_v1/services/routers/transports/base.py +++ b/google/cloud/compute_v1/services/routers/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,13 +124,19 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.aggregated_list: gapic_v1.method.wrap_method( - self.aggregated_list, default_timeout=None, client_info=client_info, + self.aggregated_list, + default_timeout=None, + client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.get_nat_mapping_info: gapic_v1.method.wrap_method( self.get_nat_mapping_info, @@ -136,31 +144,43 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.get_router_status: gapic_v1.method.wrap_method( - self.get_router_status, default_timeout=None, client_info=client_info, + self.get_router_status, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.patch: gapic_v1.method.wrap_method( - self.patch, default_timeout=None, client_info=client_info, + self.patch, + default_timeout=None, + client_info=client_info, ), self.preview: gapic_v1.method.wrap_method( - self.preview, default_timeout=None, client_info=client_info, + self.preview, + default_timeout=None, + client_info=client_info, ), self.update: gapic_v1.method.wrap_method( - self.update, default_timeout=None, client_info=client_info, + self.update, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/routes/client.py b/google/cloud/compute_v1/services/routes/client.py index 1ac55fcee..1ecb7da9f 100644 --- a/google/cloud/compute_v1/services/routes/client.py +++ b/google/cloud/compute_v1/services/routes/client.py @@ -51,7 +51,10 @@ class RoutesClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[RoutesTransport]] _transport_registry["rest"] = RoutesRestTransport - def get_transport_class(cls, label: str = None,) -> Type[RoutesTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[RoutesTransport]: """Returns an appropriate transport class. Args: @@ -156,7 +159,9 @@ def transport(self) -> RoutesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -169,9 +174,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -180,9 +189,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -191,9 +204,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -202,10 +219,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -458,7 +479,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -534,7 +560,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -619,7 +650,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -685,12 +721,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -712,7 +756,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/routes/transports/base.py b/google/cloud/compute_v1/services/routes/transports/base.py index 3159bb4ca..d1bc3a327 100644 --- a/google/cloud/compute_v1/services/routes/transports/base.py +++ b/google/cloud/compute_v1/services/routes/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,25 +124,33 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/security_policies/client.py b/google/cloud/compute_v1/services/security_policies/client.py index 46a1ac71a..4f8246b91 100644 --- a/google/cloud/compute_v1/services/security_policies/client.py +++ b/google/cloud/compute_v1/services/security_policies/client.py @@ -53,7 +53,10 @@ class SecurityPoliciesClientMeta(type): ) # type: Dict[str, Type[SecurityPoliciesTransport]] _transport_registry["rest"] = SecurityPoliciesRestTransport - def get_transport_class(cls, label: str = None,) -> Type[SecurityPoliciesTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[SecurityPoliciesTransport]: """Returns an appropriate transport class. Args: @@ -158,7 +161,9 @@ def transport(self) -> SecurityPoliciesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -171,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -182,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -193,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -204,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -473,7 +494,12 @@ def add_rule_unary( rpc = self._transport._wrapped_methods[self._transport.add_rule] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -560,7 +586,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -637,7 +668,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -713,7 +749,12 @@ def get_rule( rpc = self._transport._wrapped_methods[self._transport.get_rule] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -799,7 +840,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -865,12 +911,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -942,7 +996,12 @@ def list_preconfigured_expression_sets( ] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1040,7 +1099,12 @@ def patch_unary( rpc = self._transport._wrapped_methods[self._transport.patch] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1137,7 +1201,12 @@ def patch_rule_unary( rpc = self._transport._wrapped_methods[self._transport.patch_rule] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1224,7 +1293,12 @@ def remove_rule_unary( rpc = self._transport._wrapped_methods[self._transport.remove_rule] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1245,7 +1319,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/security_policies/transports/base.py b/google/cloud/compute_v1/services/security_policies/transports/base.py index 8142a0eaf..9aab08c50 100644 --- a/google/cloud/compute_v1/services/security_policies/transports/base.py +++ b/google/cloud/compute_v1/services/security_policies/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,22 +124,34 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.add_rule: gapic_v1.method.wrap_method( - self.add_rule, default_timeout=None, client_info=client_info, + self.add_rule, + default_timeout=None, + client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.get_rule: gapic_v1.method.wrap_method( - self.get_rule, default_timeout=None, client_info=client_info, + self.get_rule, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.list_preconfigured_expression_sets: gapic_v1.method.wrap_method( self.list_preconfigured_expression_sets, @@ -145,22 +159,28 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.patch: gapic_v1.method.wrap_method( - self.patch, default_timeout=None, client_info=client_info, + self.patch, + default_timeout=None, + client_info=client_info, ), self.patch_rule: gapic_v1.method.wrap_method( - self.patch_rule, default_timeout=None, client_info=client_info, + self.patch_rule, + default_timeout=None, + client_info=client_info, ), self.remove_rule: gapic_v1.method.wrap_method( - self.remove_rule, default_timeout=None, client_info=client_info, + self.remove_rule, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/security_policies/transports/rest.py b/google/cloud/compute_v1/services/security_policies/transports/rest.py index 654b59cbb..c99d6177e 100644 --- a/google/cloud/compute_v1/services/security_policies/transports/rest.py +++ b/google/cloud/compute_v1/services/security_policies/transports/rest.py @@ -1087,22 +1087,22 @@ def __call__( metadata: Sequence[Tuple[str, str]] = (), ) -> compute.SecurityPoliciesListPreconfiguredExpressionSetsResponse: r"""Call the list preconfigured - expression sets method over HTTP. + expression sets method over HTTP. - Args: - request (~.compute.ListPreconfiguredExpressionSetsSecurityPoliciesRequest): - The request object. A request message for - SecurityPolicies.ListPreconfiguredExpressionSets. - See the method description for details. + Args: + request (~.compute.ListPreconfiguredExpressionSetsSecurityPoliciesRequest): + The request object. A request message for + SecurityPolicies.ListPreconfiguredExpressionSets. + See the method description for details. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. - Returns: - ~.compute.SecurityPoliciesListPreconfiguredExpressionSetsResponse: + Returns: + ~.compute.SecurityPoliciesListPreconfiguredExpressionSetsResponse: """ @@ -1118,8 +1118,10 @@ def __call__( ) = self._interceptor.pre_list_preconfigured_expression_sets( request, metadata ) - request_kwargs = compute.ListPreconfiguredExpressionSetsSecurityPoliciesRequest.to_dict( - request + request_kwargs = ( + compute.ListPreconfiguredExpressionSetsSecurityPoliciesRequest.to_dict( + request + ) ) transcoded_request = path_template.transcode(http_options, **request_kwargs) diff --git a/google/cloud/compute_v1/services/service_attachments/client.py b/google/cloud/compute_v1/services/service_attachments/client.py index 2fcf6c195..bafebdad8 100644 --- a/google/cloud/compute_v1/services/service_attachments/client.py +++ b/google/cloud/compute_v1/services/service_attachments/client.py @@ -54,7 +54,8 @@ class ServiceAttachmentsClientMeta(type): _transport_registry["rest"] = ServiceAttachmentsRestTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[ServiceAttachmentsTransport]: """Returns an appropriate transport class. @@ -160,7 +161,9 @@ def transport(self) -> ServiceAttachmentsTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -173,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -184,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -195,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -206,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -449,12 +468,20 @@ def aggregated_list( rpc = self._transport._wrapped_methods[self._transport.aggregated_list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.AggregatedListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -551,7 +578,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -641,7 +673,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -764,7 +801,12 @@ def get_iam_policy( rpc = self._transport._wrapped_methods[self._transport.get_iam_policy] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -859,7 +901,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -933,12 +980,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1051,7 +1106,12 @@ def patch_unary( rpc = self._transport._wrapped_methods[self._transport.patch] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1186,7 +1246,12 @@ def set_iam_policy( rpc = self._transport._wrapped_methods[self._transport.set_iam_policy] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1281,7 +1346,12 @@ def test_iam_permissions( rpc = self._transport._wrapped_methods[self._transport.test_iam_permissions] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1302,7 +1372,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/service_attachments/transports/base.py b/google/cloud/compute_v1/services/service_attachments/transports/base.py index 88c3098a3..67153633d 100644 --- a/google/cloud/compute_v1/services/service_attachments/transports/base.py +++ b/google/cloud/compute_v1/services/service_attachments/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,28 +124,44 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.aggregated_list: gapic_v1.method.wrap_method( - self.aggregated_list, default_timeout=None, client_info=client_info, + self.aggregated_list, + default_timeout=None, + client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.get_iam_policy: gapic_v1.method.wrap_method( - self.get_iam_policy, default_timeout=None, client_info=client_info, + self.get_iam_policy, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.patch: gapic_v1.method.wrap_method( - self.patch, default_timeout=None, client_info=client_info, + self.patch, + default_timeout=None, + client_info=client_info, ), self.set_iam_policy: gapic_v1.method.wrap_method( - self.set_iam_policy, default_timeout=None, client_info=client_info, + self.set_iam_policy, + default_timeout=None, + client_info=client_info, ), self.test_iam_permissions: gapic_v1.method.wrap_method( self.test_iam_permissions, @@ -155,9 +173,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/snapshots/client.py b/google/cloud/compute_v1/services/snapshots/client.py index 63ba2206f..76786dac3 100644 --- a/google/cloud/compute_v1/services/snapshots/client.py +++ b/google/cloud/compute_v1/services/snapshots/client.py @@ -51,7 +51,10 @@ class SnapshotsClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[SnapshotsTransport]] _transport_registry["rest"] = SnapshotsRestTransport - def get_transport_class(cls, label: str = None,) -> Type[SnapshotsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[SnapshotsTransport]: """Returns an appropriate transport class. Args: @@ -156,7 +159,9 @@ def transport(self) -> SnapshotsTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -169,9 +174,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -180,9 +189,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -191,9 +204,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -202,10 +219,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -467,7 +488,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -544,7 +570,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -657,7 +688,12 @@ def get_iam_policy( rpc = self._transport._wrapped_methods[self._transport.get_iam_policy] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -747,7 +783,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -814,12 +855,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -945,7 +994,12 @@ def set_iam_policy( rpc = self._transport._wrapped_methods[self._transport.set_iam_policy] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1045,7 +1099,12 @@ def set_labels_unary( rpc = self._transport._wrapped_methods[self._transport.set_labels] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1130,7 +1189,12 @@ def test_iam_permissions( rpc = self._transport._wrapped_methods[self._transport.test_iam_permissions] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1151,7 +1215,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/snapshots/transports/base.py b/google/cloud/compute_v1/services/snapshots/transports/base.py index 0dbd0d9a6..8cdddccd1 100644 --- a/google/cloud/compute_v1/services/snapshots/transports/base.py +++ b/google/cloud/compute_v1/services/snapshots/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,25 +124,39 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.get_iam_policy: gapic_v1.method.wrap_method( - self.get_iam_policy, default_timeout=None, client_info=client_info, + self.get_iam_policy, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.set_iam_policy: gapic_v1.method.wrap_method( - self.set_iam_policy, default_timeout=None, client_info=client_info, + self.set_iam_policy, + default_timeout=None, + client_info=client_info, ), self.set_labels: gapic_v1.method.wrap_method( - self.set_labels, default_timeout=None, client_info=client_info, + self.set_labels, + default_timeout=None, + client_info=client_info, ), self.test_iam_permissions: gapic_v1.method.wrap_method( self.test_iam_permissions, @@ -152,9 +168,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/ssl_certificates/client.py b/google/cloud/compute_v1/services/ssl_certificates/client.py index 7e2ad7fe8..c5077cdbc 100644 --- a/google/cloud/compute_v1/services/ssl_certificates/client.py +++ b/google/cloud/compute_v1/services/ssl_certificates/client.py @@ -53,7 +53,10 @@ class SslCertificatesClientMeta(type): ) # type: Dict[str, Type[SslCertificatesTransport]] _transport_registry["rest"] = SslCertificatesRestTransport - def get_transport_class(cls, label: str = None,) -> Type[SslCertificatesTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[SslCertificatesTransport]: """Returns an appropriate transport class. Args: @@ -158,7 +161,9 @@ def transport(self) -> SslCertificatesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -171,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -182,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -193,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -204,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -444,12 +465,20 @@ def aggregated_list( rpc = self._transport._wrapped_methods[self._transport.aggregated_list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.AggregatedListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -537,7 +566,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -627,7 +661,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -713,7 +752,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -781,12 +825,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -808,7 +860,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/ssl_certificates/transports/base.py b/google/cloud/compute_v1/services/ssl_certificates/transports/base.py index 37d16be6e..2115ed647 100644 --- a/google/cloud/compute_v1/services/ssl_certificates/transports/base.py +++ b/google/cloud/compute_v1/services/ssl_certificates/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,28 +124,38 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.aggregated_list: gapic_v1.method.wrap_method( - self.aggregated_list, default_timeout=None, client_info=client_info, + self.aggregated_list, + default_timeout=None, + client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/ssl_policies/client.py b/google/cloud/compute_v1/services/ssl_policies/client.py index 184cc25bc..7584c513d 100644 --- a/google/cloud/compute_v1/services/ssl_policies/client.py +++ b/google/cloud/compute_v1/services/ssl_policies/client.py @@ -51,7 +51,10 @@ class SslPoliciesClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[SslPoliciesTransport]] _transport_registry["rest"] = SslPoliciesRestTransport - def get_transport_class(cls, label: str = None,) -> Type[SslPoliciesTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[SslPoliciesTransport]: """Returns an appropriate transport class. Args: @@ -156,7 +159,9 @@ def transport(self) -> SslPoliciesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -169,9 +174,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -180,9 +189,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -191,9 +204,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -202,10 +219,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -464,7 +485,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -543,7 +569,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -630,7 +661,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -696,12 +732,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -765,7 +809,12 @@ def list_available_features( rpc = self._transport._wrapped_methods[self._transport.list_available_features] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -862,7 +911,12 @@ def patch_unary( rpc = self._transport._wrapped_methods[self._transport.patch] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -883,7 +937,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/ssl_policies/transports/base.py b/google/cloud/compute_v1/services/ssl_policies/transports/base.py index 6795e40f5..4a973176c 100644 --- a/google/cloud/compute_v1/services/ssl_policies/transports/base.py +++ b/google/cloud/compute_v1/services/ssl_policies/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,16 +124,24 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.list_available_features: gapic_v1.method.wrap_method( self.list_available_features, @@ -139,16 +149,18 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.patch: gapic_v1.method.wrap_method( - self.patch, default_timeout=None, client_info=client_info, + self.patch, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/subnetworks/client.py b/google/cloud/compute_v1/services/subnetworks/client.py index eb1114939..6e3456ee3 100644 --- a/google/cloud/compute_v1/services/subnetworks/client.py +++ b/google/cloud/compute_v1/services/subnetworks/client.py @@ -51,7 +51,10 @@ class SubnetworksClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[SubnetworksTransport]] _transport_registry["rest"] = SubnetworksRestTransport - def get_transport_class(cls, label: str = None,) -> Type[SubnetworksTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[SubnetworksTransport]: """Returns an appropriate transport class. Args: @@ -156,7 +159,9 @@ def transport(self) -> SubnetworksTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -169,9 +174,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -180,9 +189,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -191,9 +204,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -202,10 +219,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -439,12 +460,20 @@ def aggregated_list( rpc = self._transport._wrapped_methods[self._transport.aggregated_list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.AggregatedListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -542,7 +571,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -657,7 +691,12 @@ def expand_ip_cidr_range_unary( rpc = self._transport._wrapped_methods[self._transport.expand_ip_cidr_range] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -746,7 +785,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -869,7 +913,12 @@ def get_iam_policy( rpc = self._transport._wrapped_methods[self._transport.get_iam_policy] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -965,7 +1014,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1043,12 +1097,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1115,12 +1177,20 @@ def list_usable( rpc = self._transport._wrapped_methods[self._transport.list_usable] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListUsablePager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1230,7 +1300,12 @@ def patch_unary( rpc = self._transport._wrapped_methods[self._transport.patch] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1365,7 +1440,12 @@ def set_iam_policy( rpc = self._transport._wrapped_methods[self._transport.set_iam_policy] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1481,7 +1561,12 @@ def set_private_ip_google_access_unary( ] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1576,7 +1661,12 @@ def test_iam_permissions( rpc = self._transport._wrapped_methods[self._transport.test_iam_permissions] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1597,7 +1687,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/subnetworks/transports/base.py b/google/cloud/compute_v1/services/subnetworks/transports/base.py index 3a39904b0..444564ff3 100644 --- a/google/cloud/compute_v1/services/subnetworks/transports/base.py +++ b/google/cloud/compute_v1/services/subnetworks/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,10 +124,14 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.aggregated_list: gapic_v1.method.wrap_method( - self.aggregated_list, default_timeout=None, client_info=client_info, + self.aggregated_list, + default_timeout=None, + client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.expand_ip_cidr_range: gapic_v1.method.wrap_method( self.expand_ip_cidr_range, @@ -133,25 +139,39 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.get_iam_policy: gapic_v1.method.wrap_method( - self.get_iam_policy, default_timeout=None, client_info=client_info, + self.get_iam_policy, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.list_usable: gapic_v1.method.wrap_method( - self.list_usable, default_timeout=None, client_info=client_info, + self.list_usable, + default_timeout=None, + client_info=client_info, ), self.patch: gapic_v1.method.wrap_method( - self.patch, default_timeout=None, client_info=client_info, + self.patch, + default_timeout=None, + client_info=client_info, ), self.set_iam_policy: gapic_v1.method.wrap_method( - self.set_iam_policy, default_timeout=None, client_info=client_info, + self.set_iam_policy, + default_timeout=None, + client_info=client_info, ), self.set_private_ip_google_access: gapic_v1.method.wrap_method( self.set_private_ip_google_access, @@ -168,9 +188,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/subnetworks/transports/rest.py b/google/cloud/compute_v1/services/subnetworks/transports/rest.py index c3b8ffe9c..376ae00d9 100644 --- a/google/cloud/compute_v1/services/subnetworks/transports/rest.py +++ b/google/cloud/compute_v1/services/subnetworks/transports/rest.py @@ -1601,37 +1601,37 @@ def __call__( metadata: Sequence[Tuple[str, str]] = (), ) -> compute.Operation: r"""Call the set private ip google - access method over HTTP. - - Args: - request (~.compute.SetPrivateIpGoogleAccessSubnetworkRequest): - The request object. A request message for - Subnetworks.SetPrivateIpGoogleAccess. - See the method description for details. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.compute.Operation: - Represents an Operation resource. Google Compute Engine - has three Operation resources: \* - `Global `__ - \* - `Regional `__ - \* - `Zonal `__ - You can use an operation resource to manage asynchronous - API requests. For more information, read Handling API - responses. Operations can be global, regional or zonal. - - For global operations, use the ``globalOperations`` - resource. - For regional operations, use the - ``regionOperations`` resource. - For zonal operations, - use the ``zonalOperations`` resource. For more - information, read Global, Regional, and Zonal Resources. + access method over HTTP. + + Args: + request (~.compute.SetPrivateIpGoogleAccessSubnetworkRequest): + The request object. A request message for + Subnetworks.SetPrivateIpGoogleAccess. + See the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. """ diff --git a/google/cloud/compute_v1/services/target_grpc_proxies/client.py b/google/cloud/compute_v1/services/target_grpc_proxies/client.py index 8b0f2d056..1e33fe3cb 100644 --- a/google/cloud/compute_v1/services/target_grpc_proxies/client.py +++ b/google/cloud/compute_v1/services/target_grpc_proxies/client.py @@ -54,7 +54,8 @@ class TargetGrpcProxiesClientMeta(type): _transport_registry["rest"] = TargetGrpcProxiesRestTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[TargetGrpcProxiesTransport]: """Returns an appropriate transport class. @@ -160,7 +161,9 @@ def transport(self) -> TargetGrpcProxiesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -173,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -184,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -195,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -206,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -466,7 +485,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -546,7 +570,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -633,7 +662,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -699,12 +733,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -805,7 +847,12 @@ def patch_unary( rpc = self._transport._wrapped_methods[self._transport.patch] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -826,7 +873,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/target_grpc_proxies/transports/base.py b/google/cloud/compute_v1/services/target_grpc_proxies/transports/base.py index b236f7145..75c1964a6 100644 --- a/google/cloud/compute_v1/services/target_grpc_proxies/transports/base.py +++ b/google/cloud/compute_v1/services/target_grpc_proxies/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,28 +124,38 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.patch: gapic_v1.method.wrap_method( - self.patch, default_timeout=None, client_info=client_info, + self.patch, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/target_http_proxies/client.py b/google/cloud/compute_v1/services/target_http_proxies/client.py index 80ae139ca..1c6eb9a0e 100644 --- a/google/cloud/compute_v1/services/target_http_proxies/client.py +++ b/google/cloud/compute_v1/services/target_http_proxies/client.py @@ -54,7 +54,8 @@ class TargetHttpProxiesClientMeta(type): _transport_registry["rest"] = TargetHttpProxiesRestTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[TargetHttpProxiesTransport]: """Returns an appropriate transport class. @@ -160,7 +161,9 @@ def transport(self) -> TargetHttpProxiesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -173,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -184,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -195,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -206,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -446,12 +465,20 @@ def aggregated_list( rpc = self._transport._wrapped_methods[self._transport.aggregated_list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.AggregatedListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -539,7 +566,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -626,7 +658,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -712,7 +749,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -779,12 +821,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -885,7 +935,12 @@ def patch_unary( rpc = self._transport._wrapped_methods[self._transport.patch] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -982,7 +1037,12 @@ def set_url_map_unary( rpc = self._transport._wrapped_methods[self._transport.set_url_map] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1003,7 +1063,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/target_http_proxies/transports/base.py b/google/cloud/compute_v1/services/target_http_proxies/transports/base.py index 1bdca5865..62efc25b6 100644 --- a/google/cloud/compute_v1/services/target_http_proxies/transports/base.py +++ b/google/cloud/compute_v1/services/target_http_proxies/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,34 +124,48 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.aggregated_list: gapic_v1.method.wrap_method( - self.aggregated_list, default_timeout=None, client_info=client_info, + self.aggregated_list, + default_timeout=None, + client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.patch: gapic_v1.method.wrap_method( - self.patch, default_timeout=None, client_info=client_info, + self.patch, + default_timeout=None, + client_info=client_info, ), self.set_url_map: gapic_v1.method.wrap_method( - self.set_url_map, default_timeout=None, client_info=client_info, + self.set_url_map, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/target_https_proxies/client.py b/google/cloud/compute_v1/services/target_https_proxies/client.py index 94525160f..030eda64c 100644 --- a/google/cloud/compute_v1/services/target_https_proxies/client.py +++ b/google/cloud/compute_v1/services/target_https_proxies/client.py @@ -54,7 +54,8 @@ class TargetHttpsProxiesClientMeta(type): _transport_registry["rest"] = TargetHttpsProxiesRestTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[TargetHttpsProxiesTransport]: """Returns an appropriate transport class. @@ -160,7 +161,9 @@ def transport(self) -> TargetHttpsProxiesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -173,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -184,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -195,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -206,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -446,12 +465,20 @@ def aggregated_list( rpc = self._transport._wrapped_methods[self._transport.aggregated_list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.AggregatedListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -539,7 +566,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -625,7 +657,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -711,7 +748,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -779,12 +821,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -885,7 +935,12 @@ def patch_unary( rpc = self._transport._wrapped_methods[self._transport.patch] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -989,7 +1044,12 @@ def set_quic_override_unary( rpc = self._transport._wrapped_methods[self._transport.set_quic_override] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1092,7 +1152,12 @@ def set_ssl_certificates_unary( rpc = self._transport._wrapped_methods[self._transport.set_ssl_certificates] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1195,7 +1260,12 @@ def set_ssl_policy_unary( rpc = self._transport._wrapped_methods[self._transport.set_ssl_policy] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1292,7 +1362,12 @@ def set_url_map_unary( rpc = self._transport._wrapped_methods[self._transport.set_url_map] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1313,7 +1388,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/target_https_proxies/transports/base.py b/google/cloud/compute_v1/services/target_https_proxies/transports/base.py index 206828d51..b5d37e215 100644 --- a/google/cloud/compute_v1/services/target_https_proxies/transports/base.py +++ b/google/cloud/compute_v1/services/target_https_proxies/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,25 +124,39 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.aggregated_list: gapic_v1.method.wrap_method( - self.aggregated_list, default_timeout=None, client_info=client_info, + self.aggregated_list, + default_timeout=None, + client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.patch: gapic_v1.method.wrap_method( - self.patch, default_timeout=None, client_info=client_info, + self.patch, + default_timeout=None, + client_info=client_info, ), self.set_quic_override: gapic_v1.method.wrap_method( - self.set_quic_override, default_timeout=None, client_info=client_info, + self.set_quic_override, + default_timeout=None, + client_info=client_info, ), self.set_ssl_certificates: gapic_v1.method.wrap_method( self.set_ssl_certificates, @@ -148,19 +164,23 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.set_ssl_policy: gapic_v1.method.wrap_method( - self.set_ssl_policy, default_timeout=None, client_info=client_info, + self.set_ssl_policy, + default_timeout=None, + client_info=client_info, ), self.set_url_map: gapic_v1.method.wrap_method( - self.set_url_map, default_timeout=None, client_info=client_info, + self.set_url_map, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/target_instances/client.py b/google/cloud/compute_v1/services/target_instances/client.py index cdf4eda93..3efe2ffc8 100644 --- a/google/cloud/compute_v1/services/target_instances/client.py +++ b/google/cloud/compute_v1/services/target_instances/client.py @@ -53,7 +53,10 @@ class TargetInstancesClientMeta(type): ) # type: Dict[str, Type[TargetInstancesTransport]] _transport_registry["rest"] = TargetInstancesRestTransport - def get_transport_class(cls, label: str = None,) -> Type[TargetInstancesTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[TargetInstancesTransport]: """Returns an appropriate transport class. Args: @@ -158,7 +161,9 @@ def transport(self) -> TargetInstancesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -171,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -182,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -193,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -204,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -441,12 +462,20 @@ def aggregated_list( rpc = self._transport._wrapped_methods[self._transport.aggregated_list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.AggregatedListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -544,7 +573,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -636,7 +670,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -732,7 +771,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -810,12 +854,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -837,7 +889,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/target_instances/transports/base.py b/google/cloud/compute_v1/services/target_instances/transports/base.py index 54195c485..b56422c21 100644 --- a/google/cloud/compute_v1/services/target_instances/transports/base.py +++ b/google/cloud/compute_v1/services/target_instances/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,28 +124,38 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.aggregated_list: gapic_v1.method.wrap_method( - self.aggregated_list, default_timeout=None, client_info=client_info, + self.aggregated_list, + default_timeout=None, + client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/target_pools/client.py b/google/cloud/compute_v1/services/target_pools/client.py index 70d56d409..a57372f8d 100644 --- a/google/cloud/compute_v1/services/target_pools/client.py +++ b/google/cloud/compute_v1/services/target_pools/client.py @@ -51,7 +51,10 @@ class TargetPoolsClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[TargetPoolsTransport]] _transport_registry["rest"] = TargetPoolsRestTransport - def get_transport_class(cls, label: str = None,) -> Type[TargetPoolsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[TargetPoolsTransport]: """Returns an appropriate transport class. Args: @@ -156,7 +159,9 @@ def transport(self) -> TargetPoolsTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -169,9 +174,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -180,9 +189,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -191,9 +204,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -202,10 +219,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -488,7 +509,12 @@ def add_health_check_unary( rpc = self._transport._wrapped_methods[self._transport.add_health_check] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -597,7 +623,12 @@ def add_instance_unary( rpc = self._transport._wrapped_methods[self._transport.add_instance] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -662,12 +693,20 @@ def aggregated_list( rpc = self._transport._wrapped_methods[self._transport.aggregated_list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.AggregatedListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -765,7 +804,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -855,7 +899,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -949,7 +998,12 @@ def get_health( rpc = self._transport._wrapped_methods[self._transport.get_health] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1045,7 +1099,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1123,12 +1182,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1241,7 +1308,12 @@ def remove_health_check_unary( rpc = self._transport._wrapped_methods[self._transport.remove_health_check] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1355,7 +1427,12 @@ def remove_instance_unary( rpc = self._transport._wrapped_methods[self._transport.remove_instance] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1462,7 +1539,12 @@ def set_backup_unary( rpc = self._transport._wrapped_methods[self._transport.set_backup] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1483,7 +1565,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/target_pools/transports/base.py b/google/cloud/compute_v1/services/target_pools/transports/base.py index a73aa29eb..a6b3b24c2 100644 --- a/google/cloud/compute_v1/services/target_pools/transports/base.py +++ b/google/cloud/compute_v1/services/target_pools/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,46 +124,68 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.add_health_check: gapic_v1.method.wrap_method( - self.add_health_check, default_timeout=None, client_info=client_info, + self.add_health_check, + default_timeout=None, + client_info=client_info, ), self.add_instance: gapic_v1.method.wrap_method( - self.add_instance, default_timeout=None, client_info=client_info, + self.add_instance, + default_timeout=None, + client_info=client_info, ), self.aggregated_list: gapic_v1.method.wrap_method( - self.aggregated_list, default_timeout=None, client_info=client_info, + self.aggregated_list, + default_timeout=None, + client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.get_health: gapic_v1.method.wrap_method( - self.get_health, default_timeout=None, client_info=client_info, + self.get_health, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.remove_health_check: gapic_v1.method.wrap_method( - self.remove_health_check, default_timeout=None, client_info=client_info, + self.remove_health_check, + default_timeout=None, + client_info=client_info, ), self.remove_instance: gapic_v1.method.wrap_method( - self.remove_instance, default_timeout=None, client_info=client_info, + self.remove_instance, + default_timeout=None, + client_info=client_info, ), self.set_backup: gapic_v1.method.wrap_method( - self.set_backup, default_timeout=None, client_info=client_info, + self.set_backup, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/target_ssl_proxies/client.py b/google/cloud/compute_v1/services/target_ssl_proxies/client.py index d33860fd9..f219e09cf 100644 --- a/google/cloud/compute_v1/services/target_ssl_proxies/client.py +++ b/google/cloud/compute_v1/services/target_ssl_proxies/client.py @@ -53,7 +53,10 @@ class TargetSslProxiesClientMeta(type): ) # type: Dict[str, Type[TargetSslProxiesTransport]] _transport_registry["rest"] = TargetSslProxiesRestTransport - def get_transport_class(cls, label: str = None,) -> Type[TargetSslProxiesTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[TargetSslProxiesTransport]: """Returns an appropriate transport class. Args: @@ -158,7 +161,9 @@ def transport(self) -> TargetSslProxiesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -171,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -182,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -193,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -204,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -463,7 +484,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -545,7 +571,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -631,7 +662,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -699,12 +735,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -809,7 +853,12 @@ def set_backend_service_unary( rpc = self._transport._wrapped_methods[self._transport.set_backend_service] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -912,7 +961,12 @@ def set_proxy_header_unary( rpc = self._transport._wrapped_methods[self._transport.set_proxy_header] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1016,7 +1070,12 @@ def set_ssl_certificates_unary( rpc = self._transport._wrapped_methods[self._transport.set_ssl_certificates] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1119,7 +1178,12 @@ def set_ssl_policy_unary( rpc = self._transport._wrapped_methods[self._transport.set_ssl_policy] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1140,7 +1204,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/target_ssl_proxies/transports/base.py b/google/cloud/compute_v1/services/target_ssl_proxies/transports/base.py index b5f4e32a3..833ebb44f 100644 --- a/google/cloud/compute_v1/services/target_ssl_proxies/transports/base.py +++ b/google/cloud/compute_v1/services/target_ssl_proxies/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,22 +124,34 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.set_backend_service: gapic_v1.method.wrap_method( - self.set_backend_service, default_timeout=None, client_info=client_info, + self.set_backend_service, + default_timeout=None, + client_info=client_info, ), self.set_proxy_header: gapic_v1.method.wrap_method( - self.set_proxy_header, default_timeout=None, client_info=client_info, + self.set_proxy_header, + default_timeout=None, + client_info=client_info, ), self.set_ssl_certificates: gapic_v1.method.wrap_method( self.set_ssl_certificates, @@ -145,16 +159,18 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.set_ssl_policy: gapic_v1.method.wrap_method( - self.set_ssl_policy, default_timeout=None, client_info=client_info, + self.set_ssl_policy, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/target_tcp_proxies/client.py b/google/cloud/compute_v1/services/target_tcp_proxies/client.py index 71774dafb..744143ed4 100644 --- a/google/cloud/compute_v1/services/target_tcp_proxies/client.py +++ b/google/cloud/compute_v1/services/target_tcp_proxies/client.py @@ -53,7 +53,10 @@ class TargetTcpProxiesClientMeta(type): ) # type: Dict[str, Type[TargetTcpProxiesTransport]] _transport_registry["rest"] = TargetTcpProxiesRestTransport - def get_transport_class(cls, label: str = None,) -> Type[TargetTcpProxiesTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[TargetTcpProxiesTransport]: """Returns an appropriate transport class. Args: @@ -158,7 +161,9 @@ def transport(self) -> TargetTcpProxiesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -171,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -182,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -193,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -204,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -463,7 +484,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -545,7 +571,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -631,7 +662,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -699,12 +735,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -809,7 +853,12 @@ def set_backend_service_unary( rpc = self._transport._wrapped_methods[self._transport.set_backend_service] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -912,7 +961,12 @@ def set_proxy_header_unary( rpc = self._transport._wrapped_methods[self._transport.set_proxy_header] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -933,7 +987,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/target_tcp_proxies/transports/base.py b/google/cloud/compute_v1/services/target_tcp_proxies/transports/base.py index 87d07510e..bb4da930a 100644 --- a/google/cloud/compute_v1/services/target_tcp_proxies/transports/base.py +++ b/google/cloud/compute_v1/services/target_tcp_proxies/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,31 +124,43 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.set_backend_service: gapic_v1.method.wrap_method( - self.set_backend_service, default_timeout=None, client_info=client_info, + self.set_backend_service, + default_timeout=None, + client_info=client_info, ), self.set_proxy_header: gapic_v1.method.wrap_method( - self.set_proxy_header, default_timeout=None, client_info=client_info, + self.set_proxy_header, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/target_vpn_gateways/client.py b/google/cloud/compute_v1/services/target_vpn_gateways/client.py index f3c1d1569..e61506c0f 100644 --- a/google/cloud/compute_v1/services/target_vpn_gateways/client.py +++ b/google/cloud/compute_v1/services/target_vpn_gateways/client.py @@ -54,7 +54,8 @@ class TargetVpnGatewaysClientMeta(type): _transport_registry["rest"] = TargetVpnGatewaysRestTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[TargetVpnGatewaysTransport]: """Returns an appropriate transport class. @@ -160,7 +161,9 @@ def transport(self) -> TargetVpnGatewaysTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -173,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -184,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -195,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -206,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -443,12 +462,20 @@ def aggregated_list( rpc = self._transport._wrapped_methods[self._transport.aggregated_list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.AggregatedListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -544,7 +571,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -631,7 +663,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -725,7 +762,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -801,12 +843,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -828,7 +878,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/target_vpn_gateways/transports/base.py b/google/cloud/compute_v1/services/target_vpn_gateways/transports/base.py index 99f42d319..c85bb77f6 100644 --- a/google/cloud/compute_v1/services/target_vpn_gateways/transports/base.py +++ b/google/cloud/compute_v1/services/target_vpn_gateways/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,28 +124,38 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.aggregated_list: gapic_v1.method.wrap_method( - self.aggregated_list, default_timeout=None, client_info=client_info, + self.aggregated_list, + default_timeout=None, + client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/url_maps/client.py b/google/cloud/compute_v1/services/url_maps/client.py index bd745523f..b7e407d05 100644 --- a/google/cloud/compute_v1/services/url_maps/client.py +++ b/google/cloud/compute_v1/services/url_maps/client.py @@ -51,7 +51,10 @@ class UrlMapsClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[UrlMapsTransport]] _transport_registry["rest"] = UrlMapsRestTransport - def get_transport_class(cls, label: str = None,) -> Type[UrlMapsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[UrlMapsTransport]: """Returns an appropriate transport class. Args: @@ -156,7 +159,9 @@ def transport(self) -> UrlMapsTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -169,9 +174,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -180,9 +189,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -191,9 +204,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -202,10 +219,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -442,12 +463,20 @@ def aggregated_list( rpc = self._transport._wrapped_methods[self._transport.aggregated_list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.AggregatedListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -534,7 +563,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -627,7 +661,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -712,7 +751,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -812,7 +856,12 @@ def invalidate_cache_unary( rpc = self._transport._wrapped_methods[self._transport.invalidate_cache] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -878,12 +927,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -979,7 +1036,12 @@ def patch_unary( rpc = self._transport._wrapped_methods[self._transport.patch] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1074,7 +1136,12 @@ def update_unary( rpc = self._transport._wrapped_methods[self._transport.update] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1160,7 +1227,12 @@ def validate( rpc = self._transport._wrapped_methods[self._transport.validate] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1181,7 +1253,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/url_maps/transports/base.py b/google/cloud/compute_v1/services/url_maps/transports/base.py index f81b54c2a..5836fd0ca 100644 --- a/google/cloud/compute_v1/services/url_maps/transports/base.py +++ b/google/cloud/compute_v1/services/url_maps/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,40 +124,58 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.aggregated_list: gapic_v1.method.wrap_method( - self.aggregated_list, default_timeout=None, client_info=client_info, + self.aggregated_list, + default_timeout=None, + client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.invalidate_cache: gapic_v1.method.wrap_method( - self.invalidate_cache, default_timeout=None, client_info=client_info, + self.invalidate_cache, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.patch: gapic_v1.method.wrap_method( - self.patch, default_timeout=None, client_info=client_info, + self.patch, + default_timeout=None, + client_info=client_info, ), self.update: gapic_v1.method.wrap_method( - self.update, default_timeout=None, client_info=client_info, + self.update, + default_timeout=None, + client_info=client_info, ), self.validate: gapic_v1.method.wrap_method( - self.validate, default_timeout=None, client_info=client_info, + self.validate, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/vpn_gateways/client.py b/google/cloud/compute_v1/services/vpn_gateways/client.py index b9295e92e..194906e3b 100644 --- a/google/cloud/compute_v1/services/vpn_gateways/client.py +++ b/google/cloud/compute_v1/services/vpn_gateways/client.py @@ -51,7 +51,10 @@ class VpnGatewaysClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[VpnGatewaysTransport]] _transport_registry["rest"] = VpnGatewaysRestTransport - def get_transport_class(cls, label: str = None,) -> Type[VpnGatewaysTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[VpnGatewaysTransport]: """Returns an appropriate transport class. Args: @@ -156,7 +159,9 @@ def transport(self) -> VpnGatewaysTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -169,9 +174,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -180,9 +189,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -191,9 +204,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -202,10 +219,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -439,12 +460,20 @@ def aggregated_list( rpc = self._transport._wrapped_methods[self._transport.aggregated_list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.AggregatedListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -538,7 +567,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -625,7 +659,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -703,7 +742,12 @@ def get_status( rpc = self._transport._wrapped_methods[self._transport.get_status] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -797,7 +841,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -873,12 +922,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -987,7 +1044,12 @@ def set_labels_unary( rpc = self._transport._wrapped_methods[self._transport.set_labels] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1082,7 +1144,12 @@ def test_iam_permissions( rpc = self._transport._wrapped_methods[self._transport.test_iam_permissions] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1103,7 +1170,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/vpn_gateways/transports/base.py b/google/cloud/compute_v1/services/vpn_gateways/transports/base.py index 396b3fce7..5427ed05a 100644 --- a/google/cloud/compute_v1/services/vpn_gateways/transports/base.py +++ b/google/cloud/compute_v1/services/vpn_gateways/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,25 +124,39 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.aggregated_list: gapic_v1.method.wrap_method( - self.aggregated_list, default_timeout=None, client_info=client_info, + self.aggregated_list, + default_timeout=None, + client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.get_status: gapic_v1.method.wrap_method( - self.get_status, default_timeout=None, client_info=client_info, + self.get_status, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.set_labels: gapic_v1.method.wrap_method( - self.set_labels, default_timeout=None, client_info=client_info, + self.set_labels, + default_timeout=None, + client_info=client_info, ), self.test_iam_permissions: gapic_v1.method.wrap_method( self.test_iam_permissions, @@ -152,9 +168,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/vpn_tunnels/client.py b/google/cloud/compute_v1/services/vpn_tunnels/client.py index 831203ce0..0f725d1cc 100644 --- a/google/cloud/compute_v1/services/vpn_tunnels/client.py +++ b/google/cloud/compute_v1/services/vpn_tunnels/client.py @@ -51,7 +51,10 @@ class VpnTunnelsClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[VpnTunnelsTransport]] _transport_registry["rest"] = VpnTunnelsRestTransport - def get_transport_class(cls, label: str = None,) -> Type[VpnTunnelsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[VpnTunnelsTransport]: """Returns an appropriate transport class. Args: @@ -156,7 +159,9 @@ def transport(self) -> VpnTunnelsTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -169,9 +174,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -180,9 +189,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -191,9 +204,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -202,10 +219,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -439,12 +460,20 @@ def aggregated_list( rpc = self._transport._wrapped_methods[self._transport.aggregated_list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.AggregatedListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -540,7 +569,12 @@ def delete_unary( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -623,7 +657,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -717,7 +756,12 @@ def insert_unary( rpc = self._transport._wrapped_methods[self._transport.insert] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -792,12 +836,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -819,7 +871,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/vpn_tunnels/transports/base.py b/google/cloud/compute_v1/services/vpn_tunnels/transports/base.py index e256a4256..6766fa1a3 100644 --- a/google/cloud/compute_v1/services/vpn_tunnels/transports/base.py +++ b/google/cloud/compute_v1/services/vpn_tunnels/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,28 +124,38 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.aggregated_list: gapic_v1.method.wrap_method( - self.aggregated_list, default_timeout=None, client_info=client_info, + self.aggregated_list, + default_timeout=None, + client_info=client_info, ), self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.insert: gapic_v1.method.wrap_method( - self.insert, default_timeout=None, client_info=client_info, + self.insert, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/zone_operations/client.py b/google/cloud/compute_v1/services/zone_operations/client.py index 3b0ec01a0..72302655b 100644 --- a/google/cloud/compute_v1/services/zone_operations/client.py +++ b/google/cloud/compute_v1/services/zone_operations/client.py @@ -53,7 +53,10 @@ class ZoneOperationsClientMeta(type): ) # type: Dict[str, Type[ZoneOperationsTransport]] _transport_registry["rest"] = ZoneOperationsRestTransport - def get_transport_class(cls, label: str = None,) -> Type[ZoneOperationsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[ZoneOperationsTransport]: """Returns an appropriate transport class. Args: @@ -158,7 +161,9 @@ def transport(self) -> ZoneOperationsTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -171,9 +176,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -182,9 +191,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -193,9 +206,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -204,10 +221,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -460,7 +481,12 @@ def delete( rpc = self._transport._wrapped_methods[self._transport.delete] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -556,7 +582,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -632,12 +663,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -744,7 +783,12 @@ def wait( rpc = self._transport._wrapped_methods[self._transport.wait] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -765,7 +809,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/zone_operations/transports/base.py b/google/cloud/compute_v1/services/zone_operations/transports/base.py index 67467f117..56a9d7faf 100644 --- a/google/cloud/compute_v1/services/zone_operations/transports/base.py +++ b/google/cloud/compute_v1/services/zone_operations/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,25 +124,33 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.delete: gapic_v1.method.wrap_method( - self.delete, default_timeout=None, client_info=client_info, + self.delete, + default_timeout=None, + client_info=client_info, ), self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), self.wait: gapic_v1.method.wrap_method( - self.wait, default_timeout=None, client_info=client_info, + self.wait, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/zones/client.py b/google/cloud/compute_v1/services/zones/client.py index f0c4b7783..7f446cabb 100644 --- a/google/cloud/compute_v1/services/zones/client.py +++ b/google/cloud/compute_v1/services/zones/client.py @@ -51,7 +51,10 @@ class ZonesClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[ZonesTransport]] _transport_registry["rest"] = ZonesRestTransport - def get_transport_class(cls, label: str = None,) -> Type[ZonesTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[ZonesTransport]: """Returns an appropriate transport class. Args: @@ -156,7 +159,9 @@ def transport(self) -> ZonesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -169,9 +174,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -180,9 +189,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -191,9 +204,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -202,10 +219,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -450,7 +471,12 @@ def get( rpc = self._transport._wrapped_methods[self._transport.get] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -516,12 +542,20 @@ def list( rpc = self._transport._wrapped_methods[self._transport.list] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -543,7 +577,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/compute_v1/services/zones/transports/base.py b/google/cloud/compute_v1/services/zones/transports/base.py index 71d963898..104412238 100644 --- a/google/cloud/compute_v1/services/zones/transports/base.py +++ b/google/cloud/compute_v1/services/zones/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-compute",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -123,19 +125,23 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.get: gapic_v1.method.wrap_method( - self.get, default_timeout=None, client_info=client_info, + self.get, + default_timeout=None, + client_info=client_info, ), self.list: gapic_v1.method.wrap_method( - self.list, default_timeout=None, client_info=client_info, + self.list, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/compute_v1/services/zones/transports/rest.py b/google/cloud/compute_v1/services/zones/transports/rest.py index db8862836..3a8d799cc 100644 --- a/google/cloud/compute_v1/services/zones/transports/rest.py +++ b/google/cloud/compute_v1/services/zones/transports/rest.py @@ -350,7 +350,10 @@ def __call__( """ http_options: List[Dict[str, str]] = [ - {"method": "get", "uri": "/compute/v1/projects/{project}/zones",}, + { + "method": "get", + "uri": "/compute/v1/projects/{project}/zones", + }, ] request, metadata = self._interceptor.pre_list(request, metadata) request_kwargs = compute.ListZonesRequest.to_dict(request) diff --git a/google/cloud/compute_v1/types/compute.py b/google/cloud/compute_v1/types/compute.py index 7021296ec..bd618af4e 100644 --- a/google/cloud/compute_v1/types/compute.py +++ b/google/cloud/compute_v1/types/compute.py @@ -1255,15 +1255,28 @@ class AbandonInstancesInstanceGroupManagerRequest(proto.Message): instance group is located. """ - instance_group_manager = proto.Field(proto.STRING, number=249363395,) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) instance_group_managers_abandon_instances_request_resource = proto.Field( proto.MESSAGE, number=320929016, message="InstanceGroupManagersAbandonInstancesRequest", ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class AbandonInstancesRegionInstanceGroupManagerRequest(proto.Message): @@ -1300,15 +1313,28 @@ class AbandonInstancesRegionInstanceGroupManagerRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - instance_group_manager = proto.Field(proto.STRING, number=249363395,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) region_instance_group_managers_abandon_instances_request_resource = proto.Field( proto.MESSAGE, number=488499491, message="RegionInstanceGroupManagersAbandonInstancesRequest", ) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class AcceleratorConfig(proto.Message): @@ -1334,8 +1360,16 @@ class AcceleratorConfig(proto.Message): This field is a member of `oneof`_ ``_accelerator_type``. """ - accelerator_count = proto.Field(proto.INT32, number=504879675, optional=True,) - accelerator_type = proto.Field(proto.STRING, number=138031246, optional=True,) + accelerator_count = proto.Field( + proto.INT32, + number=504879675, + optional=True, + ) + accelerator_type = proto.Field( + proto.STRING, + number=138031246, + optional=True, + ) class AcceleratorType(proto.Message): @@ -1393,19 +1427,52 @@ class AcceleratorType(proto.Message): This field is a member of `oneof`_ ``_zone``. """ - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) deprecated = proto.Field( - proto.MESSAGE, number=515138995, optional=True, message="DeprecationStatus", + proto.MESSAGE, + number=515138995, + optional=True, + message="DeprecationStatus", + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, ) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) maximum_cards_per_instance = proto.Field( - proto.INT32, number=263814482, optional=True, + proto.INT32, + number=263814482, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + optional=True, ) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - zone = proto.Field(proto.STRING, number=3744684, optional=True,) class AcceleratorTypeAggregatedList(proto.Message): @@ -1451,19 +1518,41 @@ class AcceleratorTypeAggregatedList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.MapField( proto.STRING, proto.MESSAGE, number=100526016, message="AcceleratorTypesScopedList", ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - unreachables = proto.RepeatedField(proto.STRING, number=243372063,) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -1506,15 +1595,36 @@ class AcceleratorTypeList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="AcceleratorType", + proto.MESSAGE, + number=100526016, + message="AcceleratorType", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -1533,10 +1643,15 @@ class AcceleratorTypesScopedList(proto.Message): """ accelerator_types = proto.RepeatedField( - proto.MESSAGE, number=520872357, message="AcceleratorType", + proto.MESSAGE, + number=520872357, + message="AcceleratorType", ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -1556,8 +1671,16 @@ class Accelerators(proto.Message): This field is a member of `oneof`_ ``_guest_accelerator_type``. """ - guest_accelerator_count = proto.Field(proto.INT32, number=479079316, optional=True,) - guest_accelerator_type = proto.Field(proto.STRING, number=293064725, optional=True,) + guest_accelerator_count = proto.Field( + proto.INT32, + number=479079316, + optional=True, + ) + guest_accelerator_type = proto.Field( + proto.STRING, + number=293064725, + optional=True, + ) class AccessConfig(proto.Message): @@ -1663,17 +1786,51 @@ class Type(proto.Enum): DIRECT_IPV6 = 4397213 ONE_TO_ONE_NAT = 84090205 - external_ipv6 = proto.Field(proto.STRING, number=532703707, optional=True,) + external_ipv6 = proto.Field( + proto.STRING, + number=532703707, + optional=True, + ) external_ipv6_prefix_length = proto.Field( - proto.INT32, number=425672143, optional=True, + proto.INT32, + number=425672143, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + nat_i_p = proto.Field( + proto.STRING, + number=117634556, + optional=True, + ) + network_tier = proto.Field( + proto.STRING, + number=517397843, + optional=True, + ) + public_ptr_domain_name = proto.Field( + proto.STRING, + number=316599167, + optional=True, + ) + set_public_ptr = proto.Field( + proto.BOOL, + number=523870229, + optional=True, + ) + type_ = proto.Field( + proto.STRING, + number=3575610, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - nat_i_p = proto.Field(proto.STRING, number=117634556, optional=True,) - network_tier = proto.Field(proto.STRING, number=517397843, optional=True,) - public_ptr_domain_name = proto.Field(proto.STRING, number=316599167, optional=True,) - set_public_ptr = proto.Field(proto.BOOL, number=523870229, optional=True,) - type_ = proto.Field(proto.STRING, number=3575610, optional=True,) class AddAccessConfigInstanceRequest(proto.Message): @@ -1713,13 +1870,31 @@ class AddAccessConfigInstanceRequest(proto.Message): """ access_config_resource = proto.Field( - proto.MESSAGE, number=387825552, message="AccessConfig", + proto.MESSAGE, + number=387825552, + message="AccessConfig", + ) + instance = proto.Field( + proto.STRING, + number=18257045, + ) + network_interface = proto.Field( + proto.STRING, + number=365387880, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - instance = proto.Field(proto.STRING, number=18257045,) - network_interface = proto.Field(proto.STRING, number=365387880,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) class AddAssociationFirewallPolicyRequest(proto.Message): @@ -1759,14 +1934,25 @@ class AddAssociationFirewallPolicyRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - firewall_policy = proto.Field(proto.STRING, number=498173265,) + firewall_policy = proto.Field( + proto.STRING, + number=498173265, + ) firewall_policy_association_resource = proto.Field( - proto.MESSAGE, number=259546170, message="FirewallPolicyAssociation", + proto.MESSAGE, + number=259546170, + message="FirewallPolicyAssociation", ) replace_existing_association = proto.Field( - proto.BOOL, number=209541240, optional=True, + proto.BOOL, + number=209541240, + optional=True, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class AddHealthCheckTargetPoolRequest(proto.Message): @@ -1803,12 +1989,27 @@ class AddHealthCheckTargetPoolRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - target_pool = proto.Field(proto.STRING, number=62796298,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + target_pool = proto.Field( + proto.STRING, + number=62796298, + ) target_pools_add_health_check_request_resource = proto.Field( - proto.MESSAGE, number=269573412, message="TargetPoolsAddHealthCheckRequest", + proto.MESSAGE, + number=269573412, + message="TargetPoolsAddHealthCheckRequest", ) @@ -1846,12 +2047,27 @@ class AddInstanceTargetPoolRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - target_pool = proto.Field(proto.STRING, number=62796298,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + target_pool = proto.Field( + proto.STRING, + number=62796298, + ) target_pools_add_instance_request_resource = proto.Field( - proto.MESSAGE, number=428796404, message="TargetPoolsAddInstanceRequest", + proto.MESSAGE, + number=428796404, + message="TargetPoolsAddInstanceRequest", ) @@ -1890,13 +2106,28 @@ class AddInstancesInstanceGroupRequest(proto.Message): is located. """ - instance_group = proto.Field(proto.STRING, number=81095253,) + instance_group = proto.Field( + proto.STRING, + number=81095253, + ) instance_groups_add_instances_request_resource = proto.Field( - proto.MESSAGE, number=453713246, message="InstanceGroupsAddInstancesRequest", + proto.MESSAGE, + number=453713246, + message="InstanceGroupsAddInstancesRequest", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) class AddNodesNodeGroupRequest(proto.Message): @@ -1932,13 +2163,28 @@ class AddNodesNodeGroupRequest(proto.Message): The name of the zone for this request. """ - node_group = proto.Field(proto.STRING, number=469958146,) + node_group = proto.Field( + proto.STRING, + number=469958146, + ) node_groups_add_nodes_request_resource = proto.Field( - proto.MESSAGE, number=131263288, message="NodeGroupsAddNodesRequest", + proto.MESSAGE, + number=131263288, + message="NodeGroupsAddNodesRequest", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) class AddPeeringNetworkRequest(proto.Message): @@ -1973,12 +2219,24 @@ class AddPeeringNetworkRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - network = proto.Field(proto.STRING, number=232872494,) + network = proto.Field( + proto.STRING, + number=232872494, + ) networks_add_peering_request_resource = proto.Field( - proto.MESSAGE, number=388810421, message="NetworksAddPeeringRequest", + proto.MESSAGE, + number=388810421, + message="NetworksAddPeeringRequest", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class AddResourcePoliciesDiskRequest(proto.Message): @@ -2014,13 +2272,28 @@ class AddResourcePoliciesDiskRequest(proto.Message): The name of the zone for this request. """ - disk = proto.Field(proto.STRING, number=3083677,) + disk = proto.Field( + proto.STRING, + number=3083677, + ) disks_add_resource_policies_request_resource = proto.Field( - proto.MESSAGE, number=496483363, message="DisksAddResourcePoliciesRequest", + proto.MESSAGE, + number=496483363, + message="DisksAddResourcePoliciesRequest", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) class AddResourcePoliciesInstanceRequest(proto.Message): @@ -2056,13 +2329,28 @@ class AddResourcePoliciesInstanceRequest(proto.Message): The name of the zone for this request. """ - instance = proto.Field(proto.STRING, number=18257045,) + instance = proto.Field( + proto.STRING, + number=18257045, + ) instances_add_resource_policies_request_resource = proto.Field( - proto.MESSAGE, number=489351963, message="InstancesAddResourcePoliciesRequest", + proto.MESSAGE, + number=489351963, + message="InstancesAddResourcePoliciesRequest", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) class AddResourcePoliciesRegionDiskRequest(proto.Message): @@ -2098,15 +2386,28 @@ class AddResourcePoliciesRegionDiskRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - disk = proto.Field(proto.STRING, number=3083677,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + disk = proto.Field( + proto.STRING, + number=3083677, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) region_disks_add_resource_policies_request_resource = proto.Field( proto.MESSAGE, number=284196750, message="RegionDisksAddResourcePoliciesRequest", ) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class AddRuleFirewallPolicyRequest(proto.Message): @@ -2138,11 +2439,20 @@ class AddRuleFirewallPolicyRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - firewall_policy = proto.Field(proto.STRING, number=498173265,) + firewall_policy = proto.Field( + proto.STRING, + number=498173265, + ) firewall_policy_rule_resource = proto.Field( - proto.MESSAGE, number=250523523, message="FirewallPolicyRule", + proto.MESSAGE, + number=250523523, + message="FirewallPolicyRule", + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class AddRuleSecurityPolicyRequest(proto.Message): @@ -2158,10 +2468,18 @@ class AddRuleSecurityPolicyRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - security_policy = proto.Field(proto.STRING, number=171082513,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + security_policy = proto.Field( + proto.STRING, + number=171082513, + ) security_policy_rule_resource = proto.Field( - proto.MESSAGE, number=402693443, message="SecurityPolicyRule", + proto.MESSAGE, + number=402693443, + message="SecurityPolicyRule", ) @@ -2198,11 +2516,23 @@ class AddSignedUrlKeyBackendBucketRequest(proto.Message): The body resource for this request """ - backend_bucket = proto.Field(proto.STRING, number=91714037,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + backend_bucket = proto.Field( + proto.STRING, + number=91714037, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) signed_url_key_resource = proto.Field( - proto.MESSAGE, number=457625985, message="SignedUrlKey", + proto.MESSAGE, + number=457625985, + message="SignedUrlKey", ) @@ -2239,11 +2569,23 @@ class AddSignedUrlKeyBackendServiceRequest(proto.Message): The body resource for this request """ - backend_service = proto.Field(proto.STRING, number=306946058,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + backend_service = proto.Field( + proto.STRING, + number=306946058, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) signed_url_key_resource = proto.Field( - proto.MESSAGE, number=457625985, message="SignedUrlKey", + proto.MESSAGE, + number=457625985, + message="SignedUrlKey", ) @@ -2461,23 +2803,90 @@ class Status(proto.Enum): RESERVED = 432241448 RESERVING = 514587225 - address = proto.Field(proto.STRING, number=462920692, optional=True,) - address_type = proto.Field(proto.STRING, number=264307877, optional=True,) - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - ip_version = proto.Field(proto.STRING, number=294959552, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - network = proto.Field(proto.STRING, number=232872494, optional=True,) - network_tier = proto.Field(proto.STRING, number=517397843, optional=True,) - prefix_length = proto.Field(proto.INT32, number=453565747, optional=True,) - purpose = proto.Field(proto.STRING, number=316407070, optional=True,) - region = proto.Field(proto.STRING, number=138946292, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - status = proto.Field(proto.STRING, number=181260274, optional=True,) - subnetwork = proto.Field(proto.STRING, number=307827694, optional=True,) - users = proto.RepeatedField(proto.STRING, number=111578632,) + address = proto.Field( + proto.STRING, + number=462920692, + optional=True, + ) + address_type = proto.Field( + proto.STRING, + number=264307877, + optional=True, + ) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + ip_version = proto.Field( + proto.STRING, + number=294959552, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + network = proto.Field( + proto.STRING, + number=232872494, + optional=True, + ) + network_tier = proto.Field( + proto.STRING, + number=517397843, + optional=True, + ) + prefix_length = proto.Field( + proto.INT32, + number=453565747, + optional=True, + ) + purpose = proto.Field( + proto.STRING, + number=316407070, + optional=True, + ) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + status = proto.Field( + proto.STRING, + number=181260274, + optional=True, + ) + subnetwork = proto.Field( + proto.STRING, + number=307827694, + optional=True, + ) + users = proto.RepeatedField( + proto.STRING, + number=111578632, + ) class AddressAggregatedList(proto.Message): @@ -2522,16 +2931,41 @@ class AddressAggregatedList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.MapField( - proto.STRING, proto.MESSAGE, number=100526016, message="AddressesScopedList", + proto.STRING, + proto.MESSAGE, + number=100526016, + message="AddressesScopedList", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - unreachables = proto.RepeatedField(proto.STRING, number=243372063,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -2574,13 +3008,36 @@ class AddressList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) - items = proto.RepeatedField(proto.MESSAGE, number=100526016, message="Address",) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) + items = proto.RepeatedField( + proto.MESSAGE, + number=100526016, + message="Address", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -2597,9 +3054,16 @@ class AddressesScopedList(proto.Message): This field is a member of `oneof`_ ``_warning``. """ - addresses = proto.RepeatedField(proto.MESSAGE, number=337673122, message="Address",) + addresses = proto.RepeatedField( + proto.MESSAGE, + number=337673122, + message="Address", + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -2633,10 +3097,20 @@ class AdvancedMachineFeatures(proto.Message): """ enable_nested_virtualization = proto.Field( - proto.BOOL, number=16639365, optional=True, + proto.BOOL, + number=16639365, + optional=True, + ) + enable_uefi_networking = proto.Field( + proto.BOOL, + number=334485668, + optional=True, + ) + threads_per_core = proto.Field( + proto.INT32, + number=352611671, + optional=True, ) - enable_uefi_networking = proto.Field(proto.BOOL, number=334485668, optional=True,) - threads_per_core = proto.Field(proto.INT32, number=352611671, optional=True,) class AggregatedListAcceleratorTypesRequest(proto.Message): @@ -2723,13 +3197,40 @@ class AggregatedListAcceleratorTypesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - include_all_scopes = proto.Field(proto.BOOL, number=391327988, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class AggregatedListAddressesRequest(proto.Message): @@ -2816,13 +3317,40 @@ class AggregatedListAddressesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - include_all_scopes = proto.Field(proto.BOOL, number=391327988, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class AggregatedListAutoscalersRequest(proto.Message): @@ -2909,13 +3437,40 @@ class AggregatedListAutoscalersRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - include_all_scopes = proto.Field(proto.BOOL, number=391327988, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class AggregatedListBackendServicesRequest(proto.Message): @@ -3002,13 +3557,40 @@ class AggregatedListBackendServicesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - include_all_scopes = proto.Field(proto.BOOL, number=391327988, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class AggregatedListDiskTypesRequest(proto.Message): @@ -3095,13 +3677,40 @@ class AggregatedListDiskTypesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - include_all_scopes = proto.Field(proto.BOOL, number=391327988, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class AggregatedListDisksRequest(proto.Message): @@ -3188,13 +3797,40 @@ class AggregatedListDisksRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - include_all_scopes = proto.Field(proto.BOOL, number=391327988, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class AggregatedListForwardingRulesRequest(proto.Message): @@ -3281,13 +3917,40 @@ class AggregatedListForwardingRulesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - include_all_scopes = proto.Field(proto.BOOL, number=391327988, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class AggregatedListGlobalOperationsRequest(proto.Message): @@ -3374,13 +4037,40 @@ class AggregatedListGlobalOperationsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - include_all_scopes = proto.Field(proto.BOOL, number=391327988, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class AggregatedListHealthChecksRequest(proto.Message): @@ -3467,13 +4157,40 @@ class AggregatedListHealthChecksRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - include_all_scopes = proto.Field(proto.BOOL, number=391327988, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class AggregatedListInstanceGroupManagersRequest(proto.Message): @@ -3560,13 +4277,40 @@ class AggregatedListInstanceGroupManagersRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - include_all_scopes = proto.Field(proto.BOOL, number=391327988, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class AggregatedListInstanceGroupsRequest(proto.Message): @@ -3653,13 +4397,40 @@ class AggregatedListInstanceGroupsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - include_all_scopes = proto.Field(proto.BOOL, number=391327988, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class AggregatedListInstancesRequest(proto.Message): @@ -3746,13 +4517,40 @@ class AggregatedListInstancesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - include_all_scopes = proto.Field(proto.BOOL, number=391327988, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class AggregatedListInterconnectAttachmentsRequest(proto.Message): @@ -3839,13 +4637,40 @@ class AggregatedListInterconnectAttachmentsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - include_all_scopes = proto.Field(proto.BOOL, number=391327988, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class AggregatedListMachineTypesRequest(proto.Message): @@ -3932,13 +4757,40 @@ class AggregatedListMachineTypesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - include_all_scopes = proto.Field(proto.BOOL, number=391327988, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class AggregatedListNetworkEndpointGroupsRequest(proto.Message): @@ -4025,13 +4877,40 @@ class AggregatedListNetworkEndpointGroupsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - include_all_scopes = proto.Field(proto.BOOL, number=391327988, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class AggregatedListNodeGroupsRequest(proto.Message): @@ -4118,13 +4997,40 @@ class AggregatedListNodeGroupsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - include_all_scopes = proto.Field(proto.BOOL, number=391327988, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class AggregatedListNodeTemplatesRequest(proto.Message): @@ -4211,13 +5117,40 @@ class AggregatedListNodeTemplatesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - include_all_scopes = proto.Field(proto.BOOL, number=391327988, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class AggregatedListNodeTypesRequest(proto.Message): @@ -4304,13 +5237,40 @@ class AggregatedListNodeTypesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - include_all_scopes = proto.Field(proto.BOOL, number=391327988, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class AggregatedListPacketMirroringsRequest(proto.Message): @@ -4397,13 +5357,40 @@ class AggregatedListPacketMirroringsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - include_all_scopes = proto.Field(proto.BOOL, number=391327988, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class AggregatedListPublicDelegatedPrefixesRequest(proto.Message): @@ -4490,13 +5477,40 @@ class AggregatedListPublicDelegatedPrefixesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - include_all_scopes = proto.Field(proto.BOOL, number=391327988, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class AggregatedListRegionCommitmentsRequest(proto.Message): @@ -4583,13 +5597,40 @@ class AggregatedListRegionCommitmentsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - include_all_scopes = proto.Field(proto.BOOL, number=391327988, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class AggregatedListReservationsRequest(proto.Message): @@ -4676,13 +5717,40 @@ class AggregatedListReservationsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - include_all_scopes = proto.Field(proto.BOOL, number=391327988, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class AggregatedListResourcePoliciesRequest(proto.Message): @@ -4769,13 +5837,40 @@ class AggregatedListResourcePoliciesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - include_all_scopes = proto.Field(proto.BOOL, number=391327988, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class AggregatedListRoutersRequest(proto.Message): @@ -4862,13 +5957,40 @@ class AggregatedListRoutersRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - include_all_scopes = proto.Field(proto.BOOL, number=391327988, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class AggregatedListServiceAttachmentsRequest(proto.Message): @@ -4955,13 +6077,40 @@ class AggregatedListServiceAttachmentsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - include_all_scopes = proto.Field(proto.BOOL, number=391327988, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class AggregatedListSslCertificatesRequest(proto.Message): @@ -5048,13 +6197,40 @@ class AggregatedListSslCertificatesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - include_all_scopes = proto.Field(proto.BOOL, number=391327988, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class AggregatedListSubnetworksRequest(proto.Message): @@ -5141,13 +6317,40 @@ class AggregatedListSubnetworksRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - include_all_scopes = proto.Field(proto.BOOL, number=391327988, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class AggregatedListTargetHttpProxiesRequest(proto.Message): @@ -5234,13 +6437,40 @@ class AggregatedListTargetHttpProxiesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - include_all_scopes = proto.Field(proto.BOOL, number=391327988, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class AggregatedListTargetHttpsProxiesRequest(proto.Message): @@ -5327,13 +6557,40 @@ class AggregatedListTargetHttpsProxiesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - include_all_scopes = proto.Field(proto.BOOL, number=391327988, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class AggregatedListTargetInstancesRequest(proto.Message): @@ -5420,13 +6677,40 @@ class AggregatedListTargetInstancesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - include_all_scopes = proto.Field(proto.BOOL, number=391327988, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class AggregatedListTargetPoolsRequest(proto.Message): @@ -5513,13 +6797,40 @@ class AggregatedListTargetPoolsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - include_all_scopes = proto.Field(proto.BOOL, number=391327988, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class AggregatedListTargetVpnGatewaysRequest(proto.Message): @@ -5606,13 +6917,40 @@ class AggregatedListTargetVpnGatewaysRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - include_all_scopes = proto.Field(proto.BOOL, number=391327988, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class AggregatedListUrlMapsRequest(proto.Message): @@ -5699,13 +7037,40 @@ class AggregatedListUrlMapsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - include_all_scopes = proto.Field(proto.BOOL, number=391327988, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class AggregatedListVpnGatewaysRequest(proto.Message): @@ -5792,13 +7157,40 @@ class AggregatedListVpnGatewaysRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - include_all_scopes = proto.Field(proto.BOOL, number=391327988, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class AggregatedListVpnTunnelsRequest(proto.Message): @@ -5885,13 +7277,40 @@ class AggregatedListVpnTunnelsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - include_all_scopes = proto.Field(proto.BOOL, number=391327988, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class AliasIpRange(proto.Message): @@ -5919,8 +7338,16 @@ class AliasIpRange(proto.Message): This field is a member of `oneof`_ ``_subnetwork_range_name``. """ - ip_cidr_range = proto.Field(proto.STRING, number=98117322, optional=True,) - subnetwork_range_name = proto.Field(proto.STRING, number=387995966, optional=True,) + ip_cidr_range = proto.Field( + proto.STRING, + number=98117322, + optional=True, + ) + subnetwork_range_name = proto.Field( + proto.STRING, + number=387995966, + optional=True, + ) class AllocationSpecificSKUAllocationAllocatedInstancePropertiesReservedDisk( @@ -5954,8 +7381,16 @@ class Interface(proto.Enum): NVME = 2408800 SCSI = 2539686 - disk_size_gb = proto.Field(proto.INT64, number=316263735, optional=True,) - interface = proto.Field(proto.STRING, number=502623545, optional=True,) + disk_size_gb = proto.Field( + proto.INT64, + number=316263735, + optional=True, + ) + interface = proto.Field( + proto.STRING, + number=502623545, + optional=True, + ) class AllocationSpecificSKUAllocationReservedInstanceProperties(proto.Message): @@ -5988,16 +7423,30 @@ class AllocationSpecificSKUAllocationReservedInstanceProperties(proto.Message): """ guest_accelerators = proto.RepeatedField( - proto.MESSAGE, number=463595119, message="AcceleratorConfig", + proto.MESSAGE, + number=463595119, + message="AcceleratorConfig", ) local_ssds = proto.RepeatedField( proto.MESSAGE, number=229951299, message="AllocationSpecificSKUAllocationAllocatedInstancePropertiesReservedDisk", ) - location_hint = proto.Field(proto.STRING, number=350519505, optional=True,) - machine_type = proto.Field(proto.STRING, number=227711026, optional=True,) - min_cpu_platform = proto.Field(proto.STRING, number=242912759, optional=True,) + location_hint = proto.Field( + proto.STRING, + number=350519505, + optional=True, + ) + machine_type = proto.Field( + proto.STRING, + number=227711026, + optional=True, + ) + min_cpu_platform = proto.Field( + proto.STRING, + number=242912759, + optional=True, + ) class AllocationSpecificSKUReservation(proto.Message): @@ -6020,8 +7469,16 @@ class AllocationSpecificSKUReservation(proto.Message): This field is a member of `oneof`_ ``_instance_properties``. """ - count = proto.Field(proto.INT64, number=94851343, optional=True,) - in_use_count = proto.Field(proto.INT64, number=493458877, optional=True,) + count = proto.Field( + proto.INT64, + number=94851343, + optional=True, + ) + in_use_count = proto.Field( + proto.INT64, + number=493458877, + optional=True, + ) instance_properties = proto.Field( proto.MESSAGE, number=215355165, @@ -6052,8 +7509,15 @@ class Allowed(proto.Message): ["12345-12349"]. """ - I_p_protocol = proto.Field(proto.STRING, number=488094525, optional=True,) - ports = proto.RepeatedField(proto.STRING, number=106854418,) + I_p_protocol = proto.Field( + proto.STRING, + number=488094525, + optional=True, + ) + ports = proto.RepeatedField( + proto.STRING, + number=106854418, + ) class ApplyUpdatesToInstancesInstanceGroupManagerRequest(proto.Message): @@ -6075,14 +7539,23 @@ class ApplyUpdatesToInstancesInstanceGroupManagerRequest(proto.Message): RFC1035. """ - instance_group_manager = proto.Field(proto.STRING, number=249363395,) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) instance_group_managers_apply_updates_request_resource = proto.Field( proto.MESSAGE, number=259242835, message="InstanceGroupManagersApplyUpdatesRequest", ) - project = proto.Field(proto.STRING, number=227560217,) - zone = proto.Field(proto.STRING, number=3744684,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class ApplyUpdatesToInstancesRegionInstanceGroupManagerRequest(proto.Message): @@ -6103,9 +7576,18 @@ class ApplyUpdatesToInstancesRegionInstanceGroupManagerRequest(proto.Message): The body resource for this request """ - instance_group_manager = proto.Field(proto.STRING, number=249363395,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) region_instance_group_managers_apply_updates_request_resource = proto.Field( proto.MESSAGE, number=76248318, @@ -6154,13 +7636,32 @@ class AttachDiskInstanceRequest(proto.Message): """ attached_disk_resource = proto.Field( - proto.MESSAGE, number=90605845, message="AttachedDisk", + proto.MESSAGE, + number=90605845, + message="AttachedDisk", + ) + force_attach = proto.Field( + proto.BOOL, + number=142758425, + optional=True, + ) + instance = proto.Field( + proto.STRING, + number=18257045, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - force_attach = proto.Field(proto.BOOL, number=142758425, optional=True,) - instance = proto.Field(proto.STRING, number=18257045,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) class AttachNetworkEndpointsGlobalNetworkEndpointGroupRequest(proto.Message): @@ -6202,9 +7703,19 @@ class AttachNetworkEndpointsGlobalNetworkEndpointGroupRequest(proto.Message): number=30691563, message="GlobalNetworkEndpointGroupsAttachEndpointsRequest", ) - network_endpoint_group = proto.Field(proto.STRING, number=433907078,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + network_endpoint_group = proto.Field( + proto.STRING, + number=433907078, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class AttachNetworkEndpointsNetworkEndpointGroupRequest(proto.Message): @@ -6245,15 +7756,28 @@ class AttachNetworkEndpointsNetworkEndpointGroupRequest(proto.Message): RFC1035. """ - network_endpoint_group = proto.Field(proto.STRING, number=433907078,) + network_endpoint_group = proto.Field( + proto.STRING, + number=433907078, + ) network_endpoint_groups_attach_endpoints_request_resource = proto.Field( proto.MESSAGE, number=531079, message="NetworkEndpointGroupsAttachEndpointsRequest", ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class AttachedDisk(proto.Message): @@ -6414,32 +7938,83 @@ class Type(proto.Enum): PERSISTENT = 460683927 SCRATCH = 496778970 - auto_delete = proto.Field(proto.BOOL, number=464761403, optional=True,) - boot = proto.Field(proto.BOOL, number=3029746, optional=True,) - device_name = proto.Field(proto.STRING, number=67541716, optional=True,) + auto_delete = proto.Field( + proto.BOOL, + number=464761403, + optional=True, + ) + boot = proto.Field( + proto.BOOL, + number=3029746, + optional=True, + ) + device_name = proto.Field( + proto.STRING, + number=67541716, + optional=True, + ) disk_encryption_key = proto.Field( - proto.MESSAGE, number=271660677, optional=True, message="CustomerEncryptionKey", + proto.MESSAGE, + number=271660677, + optional=True, + message="CustomerEncryptionKey", + ) + disk_size_gb = proto.Field( + proto.INT64, + number=316263735, + optional=True, ) - disk_size_gb = proto.Field(proto.INT64, number=316263735, optional=True,) guest_os_features = proto.RepeatedField( - proto.MESSAGE, number=79294545, message="GuestOsFeature", + proto.MESSAGE, + number=79294545, + message="GuestOsFeature", + ) + index = proto.Field( + proto.INT32, + number=100346066, + optional=True, ) - index = proto.Field(proto.INT32, number=100346066, optional=True,) initialize_params = proto.Field( proto.MESSAGE, number=17697045, optional=True, message="AttachedDiskInitializeParams", ) - interface = proto.Field(proto.STRING, number=502623545, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - licenses = proto.RepeatedField(proto.STRING, number=337642578,) - mode = proto.Field(proto.STRING, number=3357091, optional=True,) + interface = proto.Field( + proto.STRING, + number=502623545, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + licenses = proto.RepeatedField( + proto.STRING, + number=337642578, + ) + mode = proto.Field( + proto.STRING, + number=3357091, + optional=True, + ) shielded_instance_initial_state = proto.Field( - proto.MESSAGE, number=192356867, optional=True, message="InitialStateConfig", + proto.MESSAGE, + number=192356867, + optional=True, + message="InitialStateConfig", + ) + source = proto.Field( + proto.STRING, + number=177235995, + optional=True, + ) + type_ = proto.Field( + proto.STRING, + number=3575610, + optional=True, ) - source = proto.Field(proto.STRING, number=177235995, optional=True,) - type_ = proto.Field(proto.STRING, number=3575610, optional=True,) class AttachedDiskInitializeParams(proto.Message): @@ -6586,22 +8161,70 @@ class OnUpdateAction(proto.Enum): RECREATE_DISK_IF_SOURCE_CHANGED = 398099712 USE_EXISTING_DISK = 232682233 - description = proto.Field(proto.STRING, number=422937596, optional=True,) - disk_name = proto.Field(proto.STRING, number=92807149, optional=True,) - disk_size_gb = proto.Field(proto.INT64, number=316263735, optional=True,) - disk_type = proto.Field(proto.STRING, number=93009052, optional=True,) - labels = proto.MapField(proto.STRING, proto.STRING, number=500195327,) - licenses = proto.RepeatedField(proto.STRING, number=337642578,) - on_update_action = proto.Field(proto.STRING, number=202451980, optional=True,) - provisioned_iops = proto.Field(proto.INT64, number=186769108, optional=True,) - resource_policies = proto.RepeatedField(proto.STRING, number=22220385,) - source_image = proto.Field(proto.STRING, number=50443319, optional=True,) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + disk_name = proto.Field( + proto.STRING, + number=92807149, + optional=True, + ) + disk_size_gb = proto.Field( + proto.INT64, + number=316263735, + optional=True, + ) + disk_type = proto.Field( + proto.STRING, + number=93009052, + optional=True, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=500195327, + ) + licenses = proto.RepeatedField( + proto.STRING, + number=337642578, + ) + on_update_action = proto.Field( + proto.STRING, + number=202451980, + optional=True, + ) + provisioned_iops = proto.Field( + proto.INT64, + number=186769108, + optional=True, + ) + resource_policies = proto.RepeatedField( + proto.STRING, + number=22220385, + ) + source_image = proto.Field( + proto.STRING, + number=50443319, + optional=True, + ) source_image_encryption_key = proto.Field( - proto.MESSAGE, number=381503659, optional=True, message="CustomerEncryptionKey", + proto.MESSAGE, + number=381503659, + optional=True, + message="CustomerEncryptionKey", + ) + source_snapshot = proto.Field( + proto.STRING, + number=126061928, + optional=True, ) - source_snapshot = proto.Field(proto.STRING, number=126061928, optional=True,) source_snapshot_encryption_key = proto.Field( - proto.MESSAGE, number=303679322, optional=True, message="CustomerEncryptionKey", + proto.MESSAGE, + number=303679322, + optional=True, + message="CustomerEncryptionKey", ) @@ -6642,10 +8265,19 @@ class AuditConfig(proto.Message): """ audit_log_configs = proto.RepeatedField( - proto.MESSAGE, number=488420626, message="AuditLogConfig", + proto.MESSAGE, + number=488420626, + message="AuditLogConfig", + ) + exempted_members = proto.RepeatedField( + proto.STRING, + number=232615576, + ) + service = proto.Field( + proto.STRING, + number=373540533, + optional=True, ) - exempted_members = proto.RepeatedField(proto.STRING, number=232615576,) - service = proto.Field(proto.STRING, number=373540533, optional=True,) class AuditLogConfig(proto.Message): @@ -6681,9 +8313,20 @@ class LogType(proto.Enum): DATA_WRITE = 340181738 LOG_TYPE_UNSPECIFIED = 154527053 - exempted_members = proto.RepeatedField(proto.STRING, number=232615576,) - ignore_child_exemptions = proto.Field(proto.BOOL, number=70141850, optional=True,) - log_type = proto.Field(proto.STRING, number=403115861, optional=True,) + exempted_members = proto.RepeatedField( + proto.STRING, + number=232615576, + ) + ignore_child_exemptions = proto.Field( + proto.BOOL, + number=70141850, + optional=True, + ) + log_type = proto.Field( + proto.STRING, + number=403115861, + optional=True, + ) class AuthorizationLoggingOptions(proto.Message): @@ -6707,7 +8350,11 @@ class PermissionType(proto.Enum): DATA_WRITE = 340181738 PERMISSION_TYPE_UNSPECIFIED = 440313346 - permission_type = proto.Field(proto.STRING, number=525978538, optional=True,) + permission_type = proto.Field( + proto.STRING, + number=525978538, + optional=True, + ) class Autoscaler(proto.Message): @@ -6832,25 +8479,77 @@ class Status(proto.Enum): PENDING = 35394935 autoscaling_policy = proto.Field( - proto.MESSAGE, number=221950041, optional=True, message="AutoscalingPolicy", - ) - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - recommended_size = proto.Field(proto.INT32, number=257915749, optional=True,) - region = proto.Field(proto.STRING, number=138946292, optional=True,) + proto.MESSAGE, + number=221950041, + optional=True, + message="AutoscalingPolicy", + ) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + recommended_size = proto.Field( + proto.INT32, + number=257915749, + optional=True, + ) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) scaling_schedule_status = proto.MapField( - proto.STRING, proto.MESSAGE, number=465950178, message="ScalingScheduleStatus", + proto.STRING, + proto.MESSAGE, + number=465950178, + message="ScalingScheduleStatus", + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + status = proto.Field( + proto.STRING, + number=181260274, + optional=True, ) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - status = proto.Field(proto.STRING, number=181260274, optional=True,) status_details = proto.RepeatedField( - proto.MESSAGE, number=363353845, message="AutoscalerStatusDetails", + proto.MESSAGE, + number=363353845, + message="AutoscalerStatusDetails", + ) + target = proto.Field( + proto.STRING, + number=192835985, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + optional=True, ) - target = proto.Field(proto.STRING, number=192835985, optional=True,) - zone = proto.Field(proto.STRING, number=3744684, optional=True,) class AutoscalerAggregatedList(proto.Message): @@ -6896,16 +8595,41 @@ class AutoscalerAggregatedList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.MapField( - proto.STRING, proto.MESSAGE, number=100526016, message="AutoscalersScopedList", + proto.STRING, + proto.MESSAGE, + number=100526016, + message="AutoscalersScopedList", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - unreachables = proto.RepeatedField(proto.STRING, number=243372063,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -6948,13 +8672,36 @@ class AutoscalerList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) - items = proto.RepeatedField(proto.MESSAGE, number=100526016, message="Autoscaler",) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) + items = proto.RepeatedField( + proto.MESSAGE, + number=100526016, + message="Autoscaler", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -7076,8 +8823,16 @@ class Type(proto.Enum): UNSUPPORTED_MAX_RATE_LOAD_BALANCING_CONFIGURATION = 330845009 ZONE_RESOURCE_STOCKOUT = 210200502 - message = proto.Field(proto.STRING, number=418054151, optional=True,) - type_ = proto.Field(proto.STRING, number=3575610, optional=True,) + message = proto.Field( + proto.STRING, + number=418054151, + optional=True, + ) + type_ = proto.Field( + proto.STRING, + number=3575610, + optional=True, + ) class AutoscalersScopedList(proto.Message): @@ -7094,10 +8849,15 @@ class AutoscalersScopedList(proto.Message): """ autoscalers = proto.RepeatedField( - proto.MESSAGE, number=465771644, message="Autoscaler", + proto.MESSAGE, + number=465771644, + message="Autoscaler", ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -7176,7 +8936,11 @@ class Mode(proto.Enum): ONLY_SCALE_OUT = 152713670 ONLY_UP = 478095374 - cool_down_period_sec = proto.Field(proto.INT32, number=107692954, optional=True,) + cool_down_period_sec = proto.Field( + proto.INT32, + number=107692954, + optional=True, + ) cpu_utilization = proto.Field( proto.MESSAGE, number=381211147, @@ -7194,9 +8958,21 @@ class Mode(proto.Enum): optional=True, message="AutoscalingPolicyLoadBalancingUtilization", ) - max_num_replicas = proto.Field(proto.INT32, number=62327375, optional=True,) - min_num_replicas = proto.Field(proto.INT32, number=535329825, optional=True,) - mode = proto.Field(proto.STRING, number=3357091, optional=True,) + max_num_replicas = proto.Field( + proto.INT32, + number=62327375, + optional=True, + ) + min_num_replicas = proto.Field( + proto.INT32, + number=535329825, + optional=True, + ) + mode = proto.Field( + proto.STRING, + number=3357091, + optional=True, + ) scale_in_control = proto.Field( proto.MESSAGE, number=527670872, @@ -7254,8 +9030,16 @@ class PredictiveMethod(proto.Enum): NONE = 2402104 OPTIMIZE_AVAILABILITY = 11629437 - predictive_method = proto.Field(proto.STRING, number=390220737, optional=True,) - utilization_target = proto.Field(proto.DOUBLE, number=215905870, optional=True,) + predictive_method = proto.Field( + proto.STRING, + number=390220737, + optional=True, + ) + utilization_target = proto.Field( + proto.DOUBLE, + number=215905870, + optional=True, + ) class AutoscalingPolicyCustomMetricUtilization(proto.Message): @@ -7346,14 +9130,30 @@ class UtilizationTargetType(proto.Enum): DELTA_PER_SECOND = 255180029 GAUGE = 67590361 - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - metric = proto.Field(proto.STRING, number=533067184, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + metric = proto.Field( + proto.STRING, + number=533067184, + optional=True, + ) single_instance_assignment = proto.Field( - proto.DOUBLE, number=504768064, optional=True, + proto.DOUBLE, + number=504768064, + optional=True, + ) + utilization_target = proto.Field( + proto.DOUBLE, + number=215905870, + optional=True, ) - utilization_target = proto.Field(proto.DOUBLE, number=215905870, optional=True,) utilization_target_type = proto.Field( - proto.STRING, number=340169355, optional=True, + proto.STRING, + number=340169355, + optional=True, ) @@ -7371,7 +9171,11 @@ class AutoscalingPolicyLoadBalancingUtilization(proto.Message): This field is a member of `oneof`_ ``_utilization_target``. """ - utilization_target = proto.Field(proto.DOUBLE, number=215905870, optional=True,) + utilization_target = proto.Field( + proto.DOUBLE, + number=215905870, + optional=True, + ) class AutoscalingPolicyScaleInControl(proto.Message): @@ -7398,9 +9202,16 @@ class AutoscalingPolicyScaleInControl(proto.Message): """ max_scaled_in_replicas = proto.Field( - proto.MESSAGE, number=180710123, optional=True, message="FixedOrPercent", + proto.MESSAGE, + number=180710123, + optional=True, + message="FixedOrPercent", + ) + time_window_sec = proto.Field( + proto.INT32, + number=36405300, + optional=True, ) - time_window_sec = proto.Field(proto.INT32, number=36405300, optional=True,) class AutoscalingPolicyScalingSchedule(proto.Message): @@ -7458,12 +9269,36 @@ class AutoscalingPolicyScalingSchedule(proto.Message): This field is a member of `oneof`_ ``_time_zone``. """ - description = proto.Field(proto.STRING, number=422937596, optional=True,) - disabled = proto.Field(proto.BOOL, number=270940796, optional=True,) - duration_sec = proto.Field(proto.INT32, number=212356902, optional=True,) - min_required_replicas = proto.Field(proto.INT32, number=365514414, optional=True,) - schedule = proto.Field(proto.STRING, number=375820951, optional=True,) - time_zone = proto.Field(proto.STRING, number=36848094, optional=True,) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + disabled = proto.Field( + proto.BOOL, + number=270940796, + optional=True, + ) + duration_sec = proto.Field( + proto.INT32, + number=212356902, + optional=True, + ) + min_required_replicas = proto.Field( + proto.INT32, + number=365514414, + optional=True, + ) + schedule = proto.Field( + proto.STRING, + number=375820951, + optional=True, + ) + time_zone = proto.Field( + proto.STRING, + number=36848094, + optional=True, + ) class Backend(proto.Message): @@ -7598,22 +9433,66 @@ class BalancingMode(proto.Enum): RATE = 2508000 UTILIZATION = 157008386 - balancing_mode = proto.Field(proto.STRING, number=430286217, optional=True,) - capacity_scaler = proto.Field(proto.FLOAT, number=315958157, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - failover = proto.Field(proto.BOOL, number=138892530, optional=True,) - group = proto.Field(proto.STRING, number=98629247, optional=True,) - max_connections = proto.Field(proto.INT32, number=110652154, optional=True,) + balancing_mode = proto.Field( + proto.STRING, + number=430286217, + optional=True, + ) + capacity_scaler = proto.Field( + proto.FLOAT, + number=315958157, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + failover = proto.Field( + proto.BOOL, + number=138892530, + optional=True, + ) + group = proto.Field( + proto.STRING, + number=98629247, + optional=True, + ) + max_connections = proto.Field( + proto.INT32, + number=110652154, + optional=True, + ) max_connections_per_endpoint = proto.Field( - proto.INT32, number=216904604, optional=True, + proto.INT32, + number=216904604, + optional=True, ) max_connections_per_instance = proto.Field( - proto.INT32, number=104671900, optional=True, + proto.INT32, + number=104671900, + optional=True, + ) + max_rate = proto.Field( + proto.INT32, + number=408035035, + optional=True, + ) + max_rate_per_endpoint = proto.Field( + proto.FLOAT, + number=129832283, + optional=True, + ) + max_rate_per_instance = proto.Field( + proto.FLOAT, + number=17599579, + optional=True, + ) + max_utilization = proto.Field( + proto.FLOAT, + number=148192199, + optional=True, ) - max_rate = proto.Field(proto.INT32, number=408035035, optional=True,) - max_rate_per_endpoint = proto.Field(proto.FLOAT, number=129832283, optional=True,) - max_rate_per_instance = proto.Field(proto.FLOAT, number=17599579, optional=True,) - max_utilization = proto.Field(proto.FLOAT, number=148192199, optional=True,) class BackendBucket(proto.Message): @@ -7680,22 +9559,61 @@ class BackendBucket(proto.Message): This field is a member of `oneof`_ ``_self_link``. """ - bucket_name = proto.Field(proto.STRING, number=283610048, optional=True,) + bucket_name = proto.Field( + proto.STRING, + number=283610048, + optional=True, + ) cdn_policy = proto.Field( proto.MESSAGE, number=213976452, optional=True, message="BackendBucketCdnPolicy", ) - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - custom_response_headers = proto.RepeatedField(proto.STRING, number=387539094,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - edge_security_policy = proto.Field(proto.STRING, number=41036943, optional=True,) - enable_cdn = proto.Field(proto.BOOL, number=282942321, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + custom_response_headers = proto.RepeatedField( + proto.STRING, + number=387539094, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + edge_security_policy = proto.Field( + proto.STRING, + number=41036943, + optional=True, + ) + enable_cdn = proto.Field( + proto.BOOL, + number=282942321, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) class BackendBucketCdnPolicy(proto.Message): @@ -7878,22 +9796,55 @@ class CacheMode(proto.Enum): optional=True, message="BackendBucketCdnPolicyCacheKeyPolicy", ) - cache_mode = proto.Field(proto.STRING, number=28877888, optional=True,) - client_ttl = proto.Field(proto.INT32, number=29034360, optional=True,) - default_ttl = proto.Field(proto.INT32, number=100253422, optional=True,) - max_ttl = proto.Field(proto.INT32, number=307578001, optional=True,) - negative_caching = proto.Field(proto.BOOL, number=336110005, optional=True,) + cache_mode = proto.Field( + proto.STRING, + number=28877888, + optional=True, + ) + client_ttl = proto.Field( + proto.INT32, + number=29034360, + optional=True, + ) + default_ttl = proto.Field( + proto.INT32, + number=100253422, + optional=True, + ) + max_ttl = proto.Field( + proto.INT32, + number=307578001, + optional=True, + ) + negative_caching = proto.Field( + proto.BOOL, + number=336110005, + optional=True, + ) negative_caching_policy = proto.RepeatedField( proto.MESSAGE, number=155359996, message="BackendBucketCdnPolicyNegativeCachingPolicy", ) - request_coalescing = proto.Field(proto.BOOL, number=532808276, optional=True,) - serve_while_stale = proto.Field(proto.INT32, number=236682203, optional=True,) + request_coalescing = proto.Field( + proto.BOOL, + number=532808276, + optional=True, + ) + serve_while_stale = proto.Field( + proto.INT32, + number=236682203, + optional=True, + ) signed_url_cache_max_age_sec = proto.Field( - proto.INT64, number=269374534, optional=True, + proto.INT64, + number=269374534, + optional=True, + ) + signed_url_key_names = proto.RepeatedField( + proto.STRING, + number=371848885, ) - signed_url_key_names = proto.RepeatedField(proto.STRING, number=371848885,) class BackendBucketCdnPolicyBypassCacheOnRequestHeader(proto.Message): @@ -7909,7 +9860,11 @@ class BackendBucketCdnPolicyBypassCacheOnRequestHeader(proto.Message): This field is a member of `oneof`_ ``_header_name``. """ - header_name = proto.Field(proto.STRING, number=110223613, optional=True,) + header_name = proto.Field( + proto.STRING, + number=110223613, + optional=True, + ) class BackendBucketCdnPolicyCacheKeyPolicy(proto.Message): @@ -7927,8 +9882,14 @@ class BackendBucketCdnPolicyCacheKeyPolicy(proto.Message): and not treated as delimiters. """ - include_http_headers = proto.RepeatedField(proto.STRING, number=2489606,) - query_string_whitelist = proto.RepeatedField(proto.STRING, number=52456496,) + include_http_headers = proto.RepeatedField( + proto.STRING, + number=2489606, + ) + query_string_whitelist = proto.RepeatedField( + proto.STRING, + number=52456496, + ) class BackendBucketCdnPolicyNegativeCachingPolicy(proto.Message): @@ -7953,8 +9914,16 @@ class BackendBucketCdnPolicyNegativeCachingPolicy(proto.Message): This field is a member of `oneof`_ ``_ttl``. """ - code = proto.Field(proto.INT32, number=3059181, optional=True,) - ttl = proto.Field(proto.INT32, number=115180, optional=True,) + code = proto.Field( + proto.INT32, + number=3059181, + optional=True, + ) + ttl = proto.Field( + proto.INT32, + number=115180, + optional=True, + ) class BackendBucketList(proto.Message): @@ -7995,15 +9964,36 @@ class BackendBucketList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="BackendBucket", + proto.MESSAGE, + number=100526016, + message="BackendBucket", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -8412,8 +10402,16 @@ class SessionAffinity(proto.Enum): HTTP_COOKIE = 494981627 NONE = 2402104 - affinity_cookie_ttl_sec = proto.Field(proto.INT32, number=369996954, optional=True,) - backends = proto.RepeatedField(proto.MESSAGE, number=510839903, message="Backend",) + affinity_cookie_ttl_sec = proto.Field( + proto.INT32, + number=369996954, + optional=True, + ) + backends = proto.RepeatedField( + proto.MESSAGE, + number=510839903, + message="Backend", + ) cdn_policy = proto.Field( proto.MESSAGE, number=213976452, @@ -8421,10 +10419,16 @@ class SessionAffinity(proto.Enum): message="BackendServiceCdnPolicy", ) circuit_breakers = proto.Field( - proto.MESSAGE, number=421340061, optional=True, message="CircuitBreakers", + proto.MESSAGE, + number=421340061, + optional=True, + message="CircuitBreakers", ) connection_draining = proto.Field( - proto.MESSAGE, number=461096747, optional=True, message="ConnectionDraining", + proto.MESSAGE, + number=461096747, + optional=True, + message="ConnectionDraining", ) connection_tracking_policy = proto.Field( proto.MESSAGE, @@ -8438,27 +10442,75 @@ class SessionAffinity(proto.Enum): optional=True, message="ConsistentHashLoadBalancerSettings", ) - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - custom_request_headers = proto.RepeatedField(proto.STRING, number=27977992,) - custom_response_headers = proto.RepeatedField(proto.STRING, number=387539094,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - edge_security_policy = proto.Field(proto.STRING, number=41036943, optional=True,) - enable_c_d_n = proto.Field(proto.BOOL, number=250733499, optional=True,) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + custom_request_headers = proto.RepeatedField( + proto.STRING, + number=27977992, + ) + custom_response_headers = proto.RepeatedField( + proto.STRING, + number=387539094, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + edge_security_policy = proto.Field( + proto.STRING, + number=41036943, + optional=True, + ) + enable_c_d_n = proto.Field( + proto.BOOL, + number=250733499, + optional=True, + ) failover_policy = proto.Field( proto.MESSAGE, number=105658655, optional=True, message="BackendServiceFailoverPolicy", ) - fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) - health_checks = proto.RepeatedField(proto.STRING, number=448370606,) + fingerprint = proto.Field( + proto.STRING, + number=234678500, + optional=True, + ) + health_checks = proto.RepeatedField( + proto.STRING, + number=448370606, + ) iap = proto.Field( - proto.MESSAGE, number=104024, optional=True, message="BackendServiceIAP", + proto.MESSAGE, + number=104024, + optional=True, + message="BackendServiceIAP", + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + load_balancing_scheme = proto.Field( + proto.STRING, + number=363890244, + optional=True, + ) + locality_lb_policy = proto.Field( + proto.STRING, + number=131431487, + optional=True, ) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - load_balancing_scheme = proto.Field(proto.STRING, number=363890244, optional=True,) - locality_lb_policy = proto.Field(proto.STRING, number=131431487, optional=True,) log_config = proto.Field( proto.MESSAGE, number=351299741, @@ -8466,27 +10518,79 @@ class SessionAffinity(proto.Enum): message="BackendServiceLogConfig", ) max_stream_duration = proto.Field( - proto.MESSAGE, number=61428376, optional=True, message="Duration", + proto.MESSAGE, + number=61428376, + optional=True, + message="Duration", + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + network = proto.Field( + proto.STRING, + number=232872494, + optional=True, ) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - network = proto.Field(proto.STRING, number=232872494, optional=True,) outlier_detection = proto.Field( - proto.MESSAGE, number=354625086, optional=True, message="OutlierDetection", + proto.MESSAGE, + number=354625086, + optional=True, + message="OutlierDetection", + ) + port = proto.Field( + proto.INT32, + number=3446913, + optional=True, + ) + port_name = proto.Field( + proto.STRING, + number=41534345, + optional=True, + ) + protocol = proto.Field( + proto.STRING, + number=84577944, + optional=True, + ) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) + security_policy = proto.Field( + proto.STRING, + number=171082513, + optional=True, ) - port = proto.Field(proto.INT32, number=3446913, optional=True,) - port_name = proto.Field(proto.STRING, number=41534345, optional=True,) - protocol = proto.Field(proto.STRING, number=84577944, optional=True,) - region = proto.Field(proto.STRING, number=138946292, optional=True,) - security_policy = proto.Field(proto.STRING, number=171082513, optional=True,) security_settings = proto.Field( - proto.MESSAGE, number=478649922, optional=True, message="SecuritySettings", + proto.MESSAGE, + number=478649922, + optional=True, + message="SecuritySettings", + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + session_affinity = proto.Field( + proto.STRING, + number=463888561, + optional=True, ) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - session_affinity = proto.Field(proto.STRING, number=463888561, optional=True,) subsetting = proto.Field( - proto.MESSAGE, number=450283536, optional=True, message="Subsetting", + proto.MESSAGE, + number=450283536, + optional=True, + message="Subsetting", + ) + timeout_sec = proto.Field( + proto.INT32, + number=79994995, + optional=True, ) - timeout_sec = proto.Field(proto.INT32, number=79994995, optional=True,) class BackendServiceAggregatedList(proto.Message): @@ -8530,19 +10634,41 @@ class BackendServiceAggregatedList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.MapField( proto.STRING, proto.MESSAGE, number=100526016, message="BackendServicesScopedList", ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - unreachables = proto.RepeatedField(proto.STRING, number=243372063,) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -8721,24 +10847,60 @@ class CacheMode(proto.Enum): message="BackendServiceCdnPolicyBypassCacheOnRequestHeader", ) cache_key_policy = proto.Field( - proto.MESSAGE, number=159263727, optional=True, message="CacheKeyPolicy", + proto.MESSAGE, + number=159263727, + optional=True, + message="CacheKeyPolicy", + ) + cache_mode = proto.Field( + proto.STRING, + number=28877888, + optional=True, + ) + client_ttl = proto.Field( + proto.INT32, + number=29034360, + optional=True, + ) + default_ttl = proto.Field( + proto.INT32, + number=100253422, + optional=True, + ) + max_ttl = proto.Field( + proto.INT32, + number=307578001, + optional=True, + ) + negative_caching = proto.Field( + proto.BOOL, + number=336110005, + optional=True, ) - cache_mode = proto.Field(proto.STRING, number=28877888, optional=True,) - client_ttl = proto.Field(proto.INT32, number=29034360, optional=True,) - default_ttl = proto.Field(proto.INT32, number=100253422, optional=True,) - max_ttl = proto.Field(proto.INT32, number=307578001, optional=True,) - negative_caching = proto.Field(proto.BOOL, number=336110005, optional=True,) negative_caching_policy = proto.RepeatedField( proto.MESSAGE, number=155359996, message="BackendServiceCdnPolicyNegativeCachingPolicy", ) - request_coalescing = proto.Field(proto.BOOL, number=532808276, optional=True,) - serve_while_stale = proto.Field(proto.INT32, number=236682203, optional=True,) + request_coalescing = proto.Field( + proto.BOOL, + number=532808276, + optional=True, + ) + serve_while_stale = proto.Field( + proto.INT32, + number=236682203, + optional=True, + ) signed_url_cache_max_age_sec = proto.Field( - proto.INT64, number=269374534, optional=True, + proto.INT64, + number=269374534, + optional=True, + ) + signed_url_key_names = proto.RepeatedField( + proto.STRING, + number=371848885, ) - signed_url_key_names = proto.RepeatedField(proto.STRING, number=371848885,) class BackendServiceCdnPolicyBypassCacheOnRequestHeader(proto.Message): @@ -8754,7 +10916,11 @@ class BackendServiceCdnPolicyBypassCacheOnRequestHeader(proto.Message): This field is a member of `oneof`_ ``_header_name``. """ - header_name = proto.Field(proto.STRING, number=110223613, optional=True,) + header_name = proto.Field( + proto.STRING, + number=110223613, + optional=True, + ) class BackendServiceCdnPolicyNegativeCachingPolicy(proto.Message): @@ -8779,8 +10945,16 @@ class BackendServiceCdnPolicyNegativeCachingPolicy(proto.Message): This field is a member of `oneof`_ ``_ttl``. """ - code = proto.Field(proto.INT32, number=3059181, optional=True,) - ttl = proto.Field(proto.INT32, number=115180, optional=True,) + code = proto.Field( + proto.INT32, + number=3059181, + optional=True, + ) + ttl = proto.Field( + proto.INT32, + number=115180, + optional=True, + ) class BackendServiceConnectionTrackingPolicy(proto.Message): @@ -8883,10 +11057,20 @@ class TrackingMode(proto.Enum): PER_SESSION = 182099252 connection_persistence_on_unhealthy_backends = proto.Field( - proto.STRING, number=152439033, optional=True, + proto.STRING, + number=152439033, + optional=True, + ) + idle_timeout_sec = proto.Field( + proto.INT32, + number=24977544, + optional=True, + ) + tracking_mode = proto.Field( + proto.STRING, + number=127757867, + optional=True, ) - idle_timeout_sec = proto.Field(proto.INT32, number=24977544, optional=True,) - tracking_mode = proto.Field(proto.STRING, number=127757867, optional=True,) class BackendServiceFailoverPolicy(proto.Message): @@ -8939,12 +11123,20 @@ class BackendServiceFailoverPolicy(proto.Message): """ disable_connection_drain_on_failover = proto.Field( - proto.BOOL, number=182150753, optional=True, + proto.BOOL, + number=182150753, + optional=True, ) drop_traffic_if_unhealthy = proto.Field( - proto.BOOL, number=112289428, optional=True, + proto.BOOL, + number=112289428, + optional=True, + ) + failover_ratio = proto.Field( + proto.FLOAT, + number=212667006, + optional=True, ) - failover_ratio = proto.Field(proto.FLOAT, number=212667006, optional=True,) class BackendServiceGroupHealth(proto.Message): @@ -8967,11 +11159,21 @@ class BackendServiceGroupHealth(proto.Message): This field is a member of `oneof`_ ``_kind``. """ - annotations = proto.MapField(proto.STRING, proto.STRING, number=112032548,) + annotations = proto.MapField( + proto.STRING, + proto.STRING, + number=112032548, + ) health_status = proto.RepeatedField( - proto.MESSAGE, number=380545845, message="HealthStatus", + proto.MESSAGE, + number=380545845, + message="HealthStatus", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) class BackendServiceIAP(proto.Message): @@ -9005,11 +11207,25 @@ class BackendServiceIAP(proto.Message): This field is a member of `oneof`_ ``_oauth2_client_secret_sha256``. """ - enabled = proto.Field(proto.BOOL, number=1018689, optional=True,) - oauth2_client_id = proto.Field(proto.STRING, number=314017611, optional=True,) - oauth2_client_secret = proto.Field(proto.STRING, number=50999520, optional=True,) + enabled = proto.Field( + proto.BOOL, + number=1018689, + optional=True, + ) + oauth2_client_id = proto.Field( + proto.STRING, + number=314017611, + optional=True, + ) + oauth2_client_secret = proto.Field( + proto.STRING, + number=50999520, + optional=True, + ) oauth2_client_secret_sha256 = proto.Field( - proto.STRING, number=112903782, optional=True, + proto.STRING, + number=112903782, + optional=True, ) @@ -9052,15 +11268,36 @@ class BackendServiceList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="BackendService", + proto.MESSAGE, + number=100526016, + message="BackendService", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -9086,8 +11323,16 @@ class BackendServiceLogConfig(proto.Message): This field is a member of `oneof`_ ``_sample_rate``. """ - enable = proto.Field(proto.BOOL, number=311764355, optional=True,) - sample_rate = proto.Field(proto.FLOAT, number=153193045, optional=True,) + enable = proto.Field( + proto.BOOL, + number=311764355, + optional=True, + ) + sample_rate = proto.Field( + proto.FLOAT, + number=153193045, + optional=True, + ) class BackendServiceReference(proto.Message): @@ -9099,7 +11344,11 @@ class BackendServiceReference(proto.Message): This field is a member of `oneof`_ ``_backend_service``. """ - backend_service = proto.Field(proto.STRING, number=306946058, optional=True,) + backend_service = proto.Field( + proto.STRING, + number=306946058, + optional=True, + ) class BackendServicesScopedList(proto.Message): @@ -9117,10 +11366,15 @@ class BackendServicesScopedList(proto.Message): """ backend_services = proto.RepeatedField( - proto.MESSAGE, number=388522409, message="BackendService", + proto.MESSAGE, + number=388522409, + message="BackendService", ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -9255,22 +11509,86 @@ class State(proto.Enum): STATE_UNSPECIFIED = 470755401 UP = 2715 - authentication_present = proto.Field(proto.BOOL, number=105974260, optional=True,) - control_plane_independent = proto.Field(proto.BOOL, number=62363573, optional=True,) - demand = proto.Field(proto.BOOL, number=275180107, optional=True,) - diagnostic = proto.Field(proto.STRING, number=62708647, optional=True,) - final = proto.Field(proto.BOOL, number=97436022, optional=True,) - length = proto.Field(proto.UINT32, number=504249062, optional=True,) - min_echo_rx_interval_ms = proto.Field(proto.UINT32, number=97286868, optional=True,) - min_rx_interval_ms = proto.Field(proto.UINT32, number=463399028, optional=True,) - min_tx_interval_ms = proto.Field(proto.UINT32, number=526023602, optional=True,) - multiplier = proto.Field(proto.UINT32, number=191331777, optional=True,) - multipoint = proto.Field(proto.BOOL, number=191421431, optional=True,) - my_discriminator = proto.Field(proto.UINT32, number=76663113, optional=True,) - poll = proto.Field(proto.BOOL, number=3446719, optional=True,) - state = proto.Field(proto.STRING, number=109757585, optional=True,) - version = proto.Field(proto.UINT32, number=351608024, optional=True,) - your_discriminator = proto.Field(proto.UINT32, number=515634064, optional=True,) + authentication_present = proto.Field( + proto.BOOL, + number=105974260, + optional=True, + ) + control_plane_independent = proto.Field( + proto.BOOL, + number=62363573, + optional=True, + ) + demand = proto.Field( + proto.BOOL, + number=275180107, + optional=True, + ) + diagnostic = proto.Field( + proto.STRING, + number=62708647, + optional=True, + ) + final = proto.Field( + proto.BOOL, + number=97436022, + optional=True, + ) + length = proto.Field( + proto.UINT32, + number=504249062, + optional=True, + ) + min_echo_rx_interval_ms = proto.Field( + proto.UINT32, + number=97286868, + optional=True, + ) + min_rx_interval_ms = proto.Field( + proto.UINT32, + number=463399028, + optional=True, + ) + min_tx_interval_ms = proto.Field( + proto.UINT32, + number=526023602, + optional=True, + ) + multiplier = proto.Field( + proto.UINT32, + number=191331777, + optional=True, + ) + multipoint = proto.Field( + proto.BOOL, + number=191421431, + optional=True, + ) + my_discriminator = proto.Field( + proto.UINT32, + number=76663113, + optional=True, + ) + poll = proto.Field( + proto.BOOL, + number=3446719, + optional=True, + ) + state = proto.Field( + proto.STRING, + number=109757585, + optional=True, + ) + version = proto.Field( + proto.UINT32, + number=351608024, + optional=True, + ) + your_discriminator = proto.Field( + proto.UINT32, + number=515634064, + optional=True, + ) class BfdStatus(proto.Message): @@ -9384,29 +11702,58 @@ class LocalState(proto.Enum): UP = 2715 bfd_session_initialization_mode = proto.Field( - proto.STRING, number=218156954, optional=True, + proto.STRING, + number=218156954, + optional=True, ) config_update_timestamp_micros = proto.Field( - proto.INT64, number=457195569, optional=True, + proto.INT64, + number=457195569, + optional=True, ) control_packet_counts = proto.Field( - proto.MESSAGE, number=132573561, optional=True, message="BfdStatusPacketCounts", + proto.MESSAGE, + number=132573561, + optional=True, + message="BfdStatusPacketCounts", ) control_packet_intervals = proto.RepeatedField( - proto.MESSAGE, number=500806649, message="PacketIntervals", + proto.MESSAGE, + number=500806649, + message="PacketIntervals", + ) + local_diagnostic = proto.Field( + proto.STRING, + number=463737083, + optional=True, + ) + local_state = proto.Field( + proto.STRING, + number=149195453, + optional=True, ) - local_diagnostic = proto.Field(proto.STRING, number=463737083, optional=True,) - local_state = proto.Field(proto.STRING, number=149195453, optional=True,) negotiated_local_control_tx_interval_ms = proto.Field( - proto.UINT32, number=21768340, optional=True, + proto.UINT32, + number=21768340, + optional=True, ) rx_packet = proto.Field( - proto.MESSAGE, number=505069729, optional=True, message="BfdPacket", + proto.MESSAGE, + number=505069729, + optional=True, + message="BfdPacket", ) tx_packet = proto.Field( - proto.MESSAGE, number=111386275, optional=True, message="BfdPacket", + proto.MESSAGE, + number=111386275, + optional=True, + message="BfdPacket", + ) + uptime_ms = proto.Field( + proto.INT64, + number=125398365, + optional=True, ) - uptime_ms = proto.Field(proto.INT64, number=125398365, optional=True,) class BfdStatusPacketCounts(proto.Message): @@ -9437,10 +11784,26 @@ class BfdStatusPacketCounts(proto.Message): This field is a member of `oneof`_ ``_num_tx``. """ - num_rx = proto.Field(proto.UINT32, number=39375263, optional=True,) - num_rx_rejected = proto.Field(proto.UINT32, number=281007902, optional=True,) - num_rx_successful = proto.Field(proto.UINT32, number=455361850, optional=True,) - num_tx = proto.Field(proto.UINT32, number=39375325, optional=True,) + num_rx = proto.Field( + proto.UINT32, + number=39375263, + optional=True, + ) + num_rx_rejected = proto.Field( + proto.UINT32, + number=281007902, + optional=True, + ) + num_rx_successful = proto.Field( + proto.UINT32, + number=455361850, + optional=True, + ) + num_tx = proto.Field( + proto.UINT32, + number=39375325, + optional=True, + ) class Binding(proto.Message): @@ -9509,12 +11872,26 @@ class Binding(proto.Message): This field is a member of `oneof`_ ``_role``. """ - binding_id = proto.Field(proto.STRING, number=441088277, optional=True,) + binding_id = proto.Field( + proto.STRING, + number=441088277, + optional=True, + ) condition = proto.Field( - proto.MESSAGE, number=212430107, optional=True, message="Expr", + proto.MESSAGE, + number=212430107, + optional=True, + message="Expr", + ) + members = proto.RepeatedField( + proto.STRING, + number=412010777, + ) + role = proto.Field( + proto.STRING, + number=3506294, + optional=True, ) - members = proto.RepeatedField(proto.STRING, number=412010777,) - role = proto.Field(proto.STRING, number=3506294, optional=True,) class BulkInsertInstanceRequest(proto.Message): @@ -9549,11 +11926,23 @@ class BulkInsertInstanceRequest(proto.Message): """ bulk_insert_instance_resource_resource = proto.Field( - proto.MESSAGE, number=41427278, message="BulkInsertInstanceResource", + proto.MESSAGE, + number=41427278, + message="BulkInsertInstanceResource", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) class BulkInsertInstanceResource(proto.Message): @@ -9623,15 +12012,33 @@ class BulkInsertInstanceResource(proto.Message): This field is a member of `oneof`_ ``_source_instance_template``. """ - count = proto.Field(proto.INT64, number=94851343, optional=True,) + count = proto.Field( + proto.INT64, + number=94851343, + optional=True, + ) instance_properties = proto.Field( - proto.MESSAGE, number=215355165, optional=True, message="InstanceProperties", + proto.MESSAGE, + number=215355165, + optional=True, + message="InstanceProperties", ) location_policy = proto.Field( - proto.MESSAGE, number=465689852, optional=True, message="LocationPolicy", + proto.MESSAGE, + number=465689852, + optional=True, + message="LocationPolicy", + ) + min_count = proto.Field( + proto.INT64, + number=523228386, + optional=True, + ) + name_pattern = proto.Field( + proto.STRING, + number=413815260, + optional=True, ) - min_count = proto.Field(proto.INT64, number=523228386, optional=True,) - name_pattern = proto.Field(proto.STRING, number=413815260, optional=True,) per_instance_properties = proto.MapField( proto.STRING, proto.MESSAGE, @@ -9639,7 +12046,9 @@ class BulkInsertInstanceResource(proto.Message): message="BulkInsertInstanceResourcePerInstanceProperties", ) source_instance_template = proto.Field( - proto.STRING, number=332423616, optional=True, + proto.STRING, + number=332423616, + optional=True, ) @@ -9655,7 +12064,11 @@ class BulkInsertInstanceResourcePerInstanceProperties(proto.Message): This field is a member of `oneof`_ ``_name``. """ - name = proto.Field(proto.STRING, number=3373707, optional=True,) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) class BulkInsertRegionInstanceRequest(proto.Message): @@ -9690,11 +12103,23 @@ class BulkInsertRegionInstanceRequest(proto.Message): """ bulk_insert_instance_resource_resource = proto.Field( - proto.MESSAGE, number=41427278, message="BulkInsertInstanceResource", + proto.MESSAGE, + number=41427278, + message="BulkInsertInstanceResource", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class CacheInvalidationRule(proto.Message): @@ -9712,8 +12137,16 @@ class CacheInvalidationRule(proto.Message): This field is a member of `oneof`_ ``_path``. """ - host = proto.Field(proto.STRING, number=3208616, optional=True,) - path = proto.Field(proto.STRING, number=3433509, optional=True,) + host = proto.Field( + proto.STRING, + number=3208616, + optional=True, + ) + path = proto.Field( + proto.STRING, + number=3433509, + optional=True, + ) class CacheKeyPolicy(proto.Message): @@ -9760,13 +12193,37 @@ class CacheKeyPolicy(proto.Message): delimiters. """ - include_host = proto.Field(proto.BOOL, number=486867679, optional=True,) - include_http_headers = proto.RepeatedField(proto.STRING, number=2489606,) - include_named_cookies = proto.RepeatedField(proto.STRING, number=87316530,) - include_protocol = proto.Field(proto.BOOL, number=303507535, optional=True,) - include_query_string = proto.Field(proto.BOOL, number=474036639, optional=True,) - query_string_blacklist = proto.RepeatedField(proto.STRING, number=354964742,) - query_string_whitelist = proto.RepeatedField(proto.STRING, number=52456496,) + include_host = proto.Field( + proto.BOOL, + number=486867679, + optional=True, + ) + include_http_headers = proto.RepeatedField( + proto.STRING, + number=2489606, + ) + include_named_cookies = proto.RepeatedField( + proto.STRING, + number=87316530, + ) + include_protocol = proto.Field( + proto.BOOL, + number=303507535, + optional=True, + ) + include_query_string = proto.Field( + proto.BOOL, + number=474036639, + optional=True, + ) + query_string_blacklist = proto.RepeatedField( + proto.STRING, + number=354964742, + ) + query_string_whitelist = proto.RepeatedField( + proto.STRING, + number=52456496, + ) class CircuitBreakers(proto.Message): @@ -9810,13 +12267,31 @@ class CircuitBreakers(proto.Message): This field is a member of `oneof`_ ``_max_retries``. """ - max_connections = proto.Field(proto.INT32, number=110652154, optional=True,) - max_pending_requests = proto.Field(proto.INT32, number=375558887, optional=True,) - max_requests = proto.Field(proto.INT32, number=28097599, optional=True,) + max_connections = proto.Field( + proto.INT32, + number=110652154, + optional=True, + ) + max_pending_requests = proto.Field( + proto.INT32, + number=375558887, + optional=True, + ) + max_requests = proto.Field( + proto.INT32, + number=28097599, + optional=True, + ) max_requests_per_connection = proto.Field( - proto.INT32, number=361630528, optional=True, + proto.INT32, + number=361630528, + optional=True, + ) + max_retries = proto.Field( + proto.INT32, + number=55546219, + optional=True, ) - max_retries = proto.Field(proto.INT32, number=55546219, optional=True,) class CloneRulesFirewallPolicyRequest(proto.Message): @@ -9850,9 +12325,20 @@ class CloneRulesFirewallPolicyRequest(proto.Message): This field is a member of `oneof`_ ``_source_firewall_policy``. """ - firewall_policy = proto.Field(proto.STRING, number=498173265,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - source_firewall_policy = proto.Field(proto.STRING, number=25013549, optional=True,) + firewall_policy = proto.Field( + proto.STRING, + number=498173265, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + source_firewall_policy = proto.Field( + proto.STRING, + number=25013549, + optional=True, + ) class Commitment(proto.Message): @@ -10030,33 +12516,97 @@ class Type(proto.Enum): MEMORY_OPTIMIZED = 281753417 TYPE_UNSPECIFIED = 437714322 - auto_renew = proto.Field(proto.BOOL, number=495520765, optional=True,) - category = proto.Field(proto.STRING, number=50511102, optional=True,) - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - end_timestamp = proto.Field(proto.STRING, number=468096690, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) + auto_renew = proto.Field( + proto.BOOL, + number=495520765, + optional=True, + ) + category = proto.Field( + proto.STRING, + number=50511102, + optional=True, + ) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + end_timestamp = proto.Field( + proto.STRING, + number=468096690, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) license_resource = proto.Field( proto.MESSAGE, number=437955148, optional=True, message="LicenseResourceCommitment", ) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - plan = proto.Field(proto.STRING, number=3443497, optional=True,) - region = proto.Field(proto.STRING, number=138946292, optional=True,) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + plan = proto.Field( + proto.STRING, + number=3443497, + optional=True, + ) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) reservations = proto.RepeatedField( - proto.MESSAGE, number=399717927, message="Reservation", + proto.MESSAGE, + number=399717927, + message="Reservation", ) resources = proto.RepeatedField( - proto.MESSAGE, number=164412965, message="ResourceCommitment", + proto.MESSAGE, + number=164412965, + message="ResourceCommitment", + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + start_timestamp = proto.Field( + proto.STRING, + number=83645817, + optional=True, + ) + status = proto.Field( + proto.STRING, + number=181260274, + optional=True, + ) + status_message = proto.Field( + proto.STRING, + number=297428154, + optional=True, + ) + type_ = proto.Field( + proto.STRING, + number=3575610, + optional=True, ) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - start_timestamp = proto.Field(proto.STRING, number=83645817, optional=True,) - status = proto.Field(proto.STRING, number=181260274, optional=True,) - status_message = proto.Field(proto.STRING, number=297428154, optional=True,) - type_ = proto.Field(proto.STRING, number=3575610, optional=True,) class CommitmentAggregatedList(proto.Message): @@ -10101,16 +12651,41 @@ class CommitmentAggregatedList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.MapField( - proto.STRING, proto.MESSAGE, number=100526016, message="CommitmentsScopedList", + proto.STRING, + proto.MESSAGE, + number=100526016, + message="CommitmentsScopedList", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - unreachables = proto.RepeatedField(proto.STRING, number=243372063,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -10153,13 +12728,36 @@ class CommitmentList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) - items = proto.RepeatedField(proto.MESSAGE, number=100526016, message="Commitment",) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) + items = proto.RepeatedField( + proto.MESSAGE, + number=100526016, + message="Commitment", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -10177,10 +12775,15 @@ class CommitmentsScopedList(proto.Message): """ commitments = proto.RepeatedField( - proto.MESSAGE, number=450664446, message="Commitment", + proto.MESSAGE, + number=450664446, + message="Commitment", ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -10213,11 +12816,30 @@ class Condition(proto.Message): use. """ - iam = proto.Field(proto.STRING, number=104021, optional=True,) - op = proto.Field(proto.STRING, number=3553, optional=True,) - svc = proto.Field(proto.STRING, number=114272, optional=True,) - sys = proto.Field(proto.STRING, number=114381, optional=True,) - values = proto.RepeatedField(proto.STRING, number=249928994,) + iam = proto.Field( + proto.STRING, + number=104021, + optional=True, + ) + op = proto.Field( + proto.STRING, + number=3553, + optional=True, + ) + svc = proto.Field( + proto.STRING, + number=114272, + optional=True, + ) + sys = proto.Field( + proto.STRING, + number=114381, + optional=True, + ) + values = proto.RepeatedField( + proto.STRING, + number=249928994, + ) class ConfidentialInstanceConfig(proto.Message): @@ -10232,7 +12854,9 @@ class ConfidentialInstanceConfig(proto.Message): """ enable_confidential_compute = proto.Field( - proto.BOOL, number=102135228, optional=True, + proto.BOOL, + number=102135228, + optional=True, ) @@ -10249,7 +12873,11 @@ class ConnectionDraining(proto.Message): This field is a member of `oneof`_ ``_draining_timeout_sec``. """ - draining_timeout_sec = proto.Field(proto.INT32, number=225127070, optional=True,) + draining_timeout_sec = proto.Field( + proto.INT32, + number=225127070, + optional=True, + ) class ConsistentHashLoadBalancerSettings(proto.Message): @@ -10291,8 +12919,16 @@ class ConsistentHashLoadBalancerSettings(proto.Message): optional=True, message="ConsistentHashLoadBalancerSettingsHttpCookie", ) - http_header_name = proto.Field(proto.STRING, number=234798022, optional=True,) - minimum_ring_size = proto.Field(proto.INT64, number=234380735, optional=True,) + http_header_name = proto.Field( + proto.STRING, + number=234798022, + optional=True, + ) + minimum_ring_size = proto.Field( + proto.INT64, + number=234380735, + optional=True, + ) class ConsistentHashLoadBalancerSettingsHttpCookie(proto.Message): @@ -10315,9 +12951,22 @@ class ConsistentHashLoadBalancerSettingsHttpCookie(proto.Message): This field is a member of `oneof`_ ``_ttl``. """ - name = proto.Field(proto.STRING, number=3373707, optional=True,) - path = proto.Field(proto.STRING, number=3433509, optional=True,) - ttl = proto.Field(proto.MESSAGE, number=115180, optional=True, message="Duration",) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + path = proto.Field( + proto.STRING, + number=3433509, + optional=True, + ) + ttl = proto.Field( + proto.MESSAGE, + number=115180, + optional=True, + message="Duration", + ) class CorsPolicy(proto.Message): @@ -10371,14 +13020,41 @@ class CorsPolicy(proto.Message): This field is a member of `oneof`_ ``_max_age``. """ - allow_credentials = proto.Field(proto.BOOL, number=481263366, optional=True,) - allow_headers = proto.RepeatedField(proto.STRING, number=45179024,) - allow_methods = proto.RepeatedField(proto.STRING, number=205405372,) - allow_origin_regexes = proto.RepeatedField(proto.STRING, number=215385810,) - allow_origins = proto.RepeatedField(proto.STRING, number=194914071,) - disabled = proto.Field(proto.BOOL, number=270940796, optional=True,) - expose_headers = proto.RepeatedField(proto.STRING, number=247604747,) - max_age = proto.Field(proto.INT32, number=307559332, optional=True,) + allow_credentials = proto.Field( + proto.BOOL, + number=481263366, + optional=True, + ) + allow_headers = proto.RepeatedField( + proto.STRING, + number=45179024, + ) + allow_methods = proto.RepeatedField( + proto.STRING, + number=205405372, + ) + allow_origin_regexes = proto.RepeatedField( + proto.STRING, + number=215385810, + ) + allow_origins = proto.RepeatedField( + proto.STRING, + number=194914071, + ) + disabled = proto.Field( + proto.BOOL, + number=270940796, + optional=True, + ) + expose_headers = proto.RepeatedField( + proto.STRING, + number=247604747, + ) + max_age = proto.Field( + proto.INT32, + number=307559332, + optional=True, + ) class CreateInstancesInstanceGroupManagerRequest(proto.Message): @@ -10416,15 +13092,28 @@ class CreateInstancesInstanceGroupManagerRequest(proto.Message): RFC1035. """ - instance_group_manager = proto.Field(proto.STRING, number=249363395,) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) instance_group_managers_create_instances_request_resource = proto.Field( proto.MESSAGE, number=24558867, message="InstanceGroupManagersCreateInstancesRequest", ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class CreateInstancesRegionInstanceGroupManagerRequest(proto.Message): @@ -10463,15 +13152,28 @@ class CreateInstancesRegionInstanceGroupManagerRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - instance_group_manager = proto.Field(proto.STRING, number=249363395,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) region_instance_group_managers_create_instances_request_resource = proto.Field( proto.MESSAGE, number=359014280, message="RegionInstanceGroupManagersCreateInstancesRequest", ) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class CreateSnapshotDiskRequest(proto.Message): @@ -10514,14 +13216,33 @@ class CreateSnapshotDiskRequest(proto.Message): The name of the zone for this request. """ - disk = proto.Field(proto.STRING, number=3083677,) - guest_flush = proto.Field(proto.BOOL, number=385550813, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + disk = proto.Field( + proto.STRING, + number=3083677, + ) + guest_flush = proto.Field( + proto.BOOL, + number=385550813, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) snapshot_resource = proto.Field( - proto.MESSAGE, number=481319977, message="Snapshot", + proto.MESSAGE, + number=481319977, + message="Snapshot", + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - zone = proto.Field(proto.STRING, number=3744684,) class CreateSnapshotRegionDiskRequest(proto.Message): @@ -10558,12 +13279,27 @@ class CreateSnapshotRegionDiskRequest(proto.Message): The body resource for this request """ - disk = proto.Field(proto.STRING, number=3083677,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + disk = proto.Field( + proto.STRING, + number=3083677, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) snapshot_resource = proto.Field( - proto.MESSAGE, number=481319977, message="Snapshot", + proto.MESSAGE, + number=481319977, + message="Snapshot", ) @@ -10623,13 +13359,31 @@ class CustomerEncryptionKey(proto.Message): This field is a member of `oneof`_ ``_sha256``. """ - kms_key_name = proto.Field(proto.STRING, number=484373913, optional=True,) + kms_key_name = proto.Field( + proto.STRING, + number=484373913, + optional=True, + ) kms_key_service_account = proto.Field( - proto.STRING, number=209986261, optional=True, + proto.STRING, + number=209986261, + optional=True, + ) + raw_key = proto.Field( + proto.STRING, + number=449196488, + optional=True, + ) + rsa_encrypted_key = proto.Field( + proto.STRING, + number=335487397, + optional=True, + ) + sha256 = proto.Field( + proto.STRING, + number=170112551, + optional=True, ) - raw_key = proto.Field(proto.STRING, number=449196488, optional=True,) - rsa_encrypted_key = proto.Field(proto.STRING, number=335487397, optional=True,) - sha256 = proto.Field(proto.STRING, number=170112551, optional=True,) class CustomerEncryptionKeyProtectedDisk(proto.Message): @@ -10651,9 +13405,16 @@ class CustomerEncryptionKeyProtectedDisk(proto.Message): """ disk_encryption_key = proto.Field( - proto.MESSAGE, number=271660677, optional=True, message="CustomerEncryptionKey", + proto.MESSAGE, + number=271660677, + optional=True, + message="CustomerEncryptionKey", + ) + source = proto.Field( + proto.STRING, + number=177235995, + optional=True, ) - source = proto.Field(proto.STRING, number=177235995, optional=True,) class Data(proto.Message): @@ -10678,8 +13439,16 @@ class Data(proto.Message): This field is a member of `oneof`_ ``_value``. """ - key = proto.Field(proto.STRING, number=106079, optional=True,) - value = proto.Field(proto.STRING, number=111972721, optional=True,) + key = proto.Field( + proto.STRING, + number=106079, + optional=True, + ) + value = proto.Field( + proto.STRING, + number=111972721, + optional=True, + ) class DeleteAccessConfigInstanceRequest(proto.Message): @@ -10717,12 +13486,31 @@ class DeleteAccessConfigInstanceRequest(proto.Message): The name of the zone for this request. """ - access_config = proto.Field(proto.STRING, number=72856189,) - instance = proto.Field(proto.STRING, number=18257045,) - network_interface = proto.Field(proto.STRING, number=365387880,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + access_config = proto.Field( + proto.STRING, + number=72856189, + ) + instance = proto.Field( + proto.STRING, + number=18257045, + ) + network_interface = proto.Field( + proto.STRING, + number=365387880, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class DeleteAddressRequest(proto.Message): @@ -10756,10 +13544,23 @@ class DeleteAddressRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - address = proto.Field(proto.STRING, number=462920692,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + address = proto.Field( + proto.STRING, + number=462920692, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class DeleteAutoscalerRequest(proto.Message): @@ -10793,10 +13594,23 @@ class DeleteAutoscalerRequest(proto.Message): Name of the zone for this request. """ - autoscaler = proto.Field(proto.STRING, number=517258967,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + autoscaler = proto.Field( + proto.STRING, + number=517258967, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class DeleteBackendBucketRequest(proto.Message): @@ -10828,9 +13642,19 @@ class DeleteBackendBucketRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - backend_bucket = proto.Field(proto.STRING, number=91714037,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + backend_bucket = proto.Field( + proto.STRING, + number=91714037, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class DeleteBackendServiceRequest(proto.Message): @@ -10863,9 +13687,19 @@ class DeleteBackendServiceRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - backend_service = proto.Field(proto.STRING, number=306946058,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + backend_service = proto.Field( + proto.STRING, + number=306946058, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class DeleteDiskRequest(proto.Message): @@ -10899,10 +13733,23 @@ class DeleteDiskRequest(proto.Message): The name of the zone for this request. """ - disk = proto.Field(proto.STRING, number=3083677,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + disk = proto.Field( + proto.STRING, + number=3083677, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class DeleteExternalVpnGatewayRequest(proto.Message): @@ -10934,9 +13781,19 @@ class DeleteExternalVpnGatewayRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - external_vpn_gateway = proto.Field(proto.STRING, number=109898629,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + external_vpn_gateway = proto.Field( + proto.STRING, + number=109898629, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class DeleteFirewallPolicyRequest(proto.Message): @@ -10966,8 +13823,15 @@ class DeleteFirewallPolicyRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - firewall_policy = proto.Field(proto.STRING, number=498173265,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + firewall_policy = proto.Field( + proto.STRING, + number=498173265, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class DeleteFirewallRequest(proto.Message): @@ -10999,9 +13863,19 @@ class DeleteFirewallRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - firewall = proto.Field(proto.STRING, number=511016192,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + firewall = proto.Field( + proto.STRING, + number=511016192, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class DeleteForwardingRuleRequest(proto.Message): @@ -11036,10 +13910,23 @@ class DeleteForwardingRuleRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - forwarding_rule = proto.Field(proto.STRING, number=269964030,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + forwarding_rule = proto.Field( + proto.STRING, + number=269964030, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class DeleteGlobalAddressRequest(proto.Message): @@ -11071,9 +13958,19 @@ class DeleteGlobalAddressRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - address = proto.Field(proto.STRING, number=462920692,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + address = proto.Field( + proto.STRING, + number=462920692, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class DeleteGlobalForwardingRuleRequest(proto.Message): @@ -11106,9 +14003,19 @@ class DeleteGlobalForwardingRuleRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - forwarding_rule = proto.Field(proto.STRING, number=269964030,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + forwarding_rule = proto.Field( + proto.STRING, + number=269964030, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class DeleteGlobalNetworkEndpointGroupRequest(proto.Message): @@ -11141,9 +14048,19 @@ class DeleteGlobalNetworkEndpointGroupRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - network_endpoint_group = proto.Field(proto.STRING, number=433907078,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + network_endpoint_group = proto.Field( + proto.STRING, + number=433907078, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class DeleteGlobalOperationRequest(proto.Message): @@ -11157,8 +14074,14 @@ class DeleteGlobalOperationRequest(proto.Message): Project ID for this request. """ - operation = proto.Field(proto.STRING, number=52090215,) - project = proto.Field(proto.STRING, number=227560217,) + operation = proto.Field( + proto.STRING, + number=52090215, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) class DeleteGlobalOperationResponse(proto.Message): @@ -11181,8 +14104,15 @@ class DeleteGlobalOrganizationOperationRequest(proto.Message): This field is a member of `oneof`_ ``_parent_id``. """ - operation = proto.Field(proto.STRING, number=52090215,) - parent_id = proto.Field(proto.STRING, number=459714768, optional=True,) + operation = proto.Field( + proto.STRING, + number=52090215, + ) + parent_id = proto.Field( + proto.STRING, + number=459714768, + optional=True, + ) class DeleteGlobalOrganizationOperationResponse(proto.Message): @@ -11222,9 +14152,19 @@ class DeleteGlobalPublicDelegatedPrefixeRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - project = proto.Field(proto.STRING, number=227560217,) - public_delegated_prefix = proto.Field(proto.STRING, number=204238440,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + public_delegated_prefix = proto.Field( + proto.STRING, + number=204238440, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class DeleteHealthCheckRequest(proto.Message): @@ -11256,9 +14196,19 @@ class DeleteHealthCheckRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - health_check = proto.Field(proto.STRING, number=308876645,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + health_check = proto.Field( + proto.STRING, + number=308876645, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class DeleteImageRequest(proto.Message): @@ -11290,9 +14240,19 @@ class DeleteImageRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - image = proto.Field(proto.STRING, number=100313435,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + image = proto.Field( + proto.STRING, + number=100313435, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class DeleteInstanceGroupManagerRequest(proto.Message): @@ -11328,10 +14288,23 @@ class DeleteInstanceGroupManagerRequest(proto.Message): instance group is located. """ - instance_group_manager = proto.Field(proto.STRING, number=249363395,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class DeleteInstanceGroupRequest(proto.Message): @@ -11366,10 +14339,23 @@ class DeleteInstanceGroupRequest(proto.Message): is located. """ - instance_group = proto.Field(proto.STRING, number=81095253,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + instance_group = proto.Field( + proto.STRING, + number=81095253, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class DeleteInstanceRequest(proto.Message): @@ -11403,10 +14389,23 @@ class DeleteInstanceRequest(proto.Message): The name of the zone for this request. """ - instance = proto.Field(proto.STRING, number=18257045,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + instance = proto.Field( + proto.STRING, + number=18257045, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class DeleteInstanceTemplateRequest(proto.Message): @@ -11438,9 +14437,19 @@ class DeleteInstanceTemplateRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - instance_template = proto.Field(proto.STRING, number=309248228,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + instance_template = proto.Field( + proto.STRING, + number=309248228, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class DeleteInstancesInstanceGroupManagerRequest(proto.Message): @@ -11477,15 +14486,28 @@ class DeleteInstancesInstanceGroupManagerRequest(proto.Message): instance group is located. """ - instance_group_manager = proto.Field(proto.STRING, number=249363395,) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) instance_group_managers_delete_instances_request_resource = proto.Field( proto.MESSAGE, number=166421252, message="InstanceGroupManagersDeleteInstancesRequest", ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class DeleteInstancesRegionInstanceGroupManagerRequest(proto.Message): @@ -11522,15 +14544,28 @@ class DeleteInstancesRegionInstanceGroupManagerRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - instance_group_manager = proto.Field(proto.STRING, number=249363395,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) region_instance_group_managers_delete_instances_request_resource = proto.Field( proto.MESSAGE, number=500876665, message="RegionInstanceGroupManagersDeleteInstancesRequest", ) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class DeleteInterconnectAttachmentRequest(proto.Message): @@ -11565,10 +14600,23 @@ class DeleteInterconnectAttachmentRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - interconnect_attachment = proto.Field(proto.STRING, number=308135284,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + interconnect_attachment = proto.Field( + proto.STRING, + number=308135284, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class DeleteInterconnectRequest(proto.Message): @@ -11600,9 +14648,19 @@ class DeleteInterconnectRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - interconnect = proto.Field(proto.STRING, number=224601230,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + interconnect = proto.Field( + proto.STRING, + number=224601230, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class DeleteLicenseRequest(proto.Message): @@ -11634,9 +14692,19 @@ class DeleteLicenseRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - license_ = proto.Field(proto.STRING, number=166757441,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + license_ = proto.Field( + proto.STRING, + number=166757441, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class DeleteMachineImageRequest(proto.Message): @@ -11668,9 +14736,19 @@ class DeleteMachineImageRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - machine_image = proto.Field(proto.STRING, number=69189475,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + machine_image = proto.Field( + proto.STRING, + number=69189475, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class DeleteNetworkEndpointGroupRequest(proto.Message): @@ -11707,10 +14785,23 @@ class DeleteNetworkEndpointGroupRequest(proto.Message): RFC1035. """ - network_endpoint_group = proto.Field(proto.STRING, number=433907078,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + network_endpoint_group = proto.Field( + proto.STRING, + number=433907078, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class DeleteNetworkRequest(proto.Message): @@ -11742,9 +14833,19 @@ class DeleteNetworkRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - network = proto.Field(proto.STRING, number=232872494,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + network = proto.Field( + proto.STRING, + number=232872494, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class DeleteNodeGroupRequest(proto.Message): @@ -11778,10 +14879,23 @@ class DeleteNodeGroupRequest(proto.Message): The name of the zone for this request. """ - node_group = proto.Field(proto.STRING, number=469958146,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + node_group = proto.Field( + proto.STRING, + number=469958146, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class DeleteNodeTemplateRequest(proto.Message): @@ -11815,10 +14929,23 @@ class DeleteNodeTemplateRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - node_template = proto.Field(proto.STRING, number=323154455,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + node_template = proto.Field( + proto.STRING, + number=323154455, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class DeleteNodesNodeGroupRequest(proto.Message): @@ -11855,13 +14982,28 @@ class DeleteNodesNodeGroupRequest(proto.Message): The name of the zone for this request. """ - node_group = proto.Field(proto.STRING, number=469958146,) + node_group = proto.Field( + proto.STRING, + number=469958146, + ) node_groups_delete_nodes_request_resource = proto.Field( - proto.MESSAGE, number=183298962, message="NodeGroupsDeleteNodesRequest", + proto.MESSAGE, + number=183298962, + message="NodeGroupsDeleteNodesRequest", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) class DeletePacketMirroringRequest(proto.Message): @@ -11896,10 +15038,23 @@ class DeletePacketMirroringRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - packet_mirroring = proto.Field(proto.STRING, number=22305996,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + packet_mirroring = proto.Field( + proto.STRING, + number=22305996, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class DeletePerInstanceConfigsInstanceGroupManagerRequest(proto.Message): @@ -11921,14 +15076,23 @@ class DeletePerInstanceConfigsInstanceGroupManagerRequest(proto.Message): RFC1035. """ - instance_group_manager = proto.Field(proto.STRING, number=249363395,) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) instance_group_managers_delete_per_instance_configs_req_resource = proto.Field( proto.MESSAGE, number=362427680, message="InstanceGroupManagersDeletePerInstanceConfigsReq", ) - project = proto.Field(proto.STRING, number=227560217,) - zone = proto.Field(proto.STRING, number=3744684,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class DeletePerInstanceConfigsRegionInstanceGroupManagerRequest(proto.Message): @@ -11949,9 +15113,18 @@ class DeletePerInstanceConfigsRegionInstanceGroupManagerRequest(proto.Message): The body resource for this request """ - instance_group_manager = proto.Field(proto.STRING, number=249363395,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) region_instance_group_manager_delete_instance_config_req_resource = proto.Field( proto.MESSAGE, number=740741, @@ -11989,9 +15162,19 @@ class DeletePublicAdvertisedPrefixeRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - project = proto.Field(proto.STRING, number=227560217,) - public_advertised_prefix = proto.Field(proto.STRING, number=101874590,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + public_advertised_prefix = proto.Field( + proto.STRING, + number=101874590, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class DeletePublicDelegatedPrefixeRequest(proto.Message): @@ -12026,10 +15209,23 @@ class DeletePublicDelegatedPrefixeRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - project = proto.Field(proto.STRING, number=227560217,) - public_delegated_prefix = proto.Field(proto.STRING, number=204238440,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + public_delegated_prefix = proto.Field( + proto.STRING, + number=204238440, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class DeleteRegionAutoscalerRequest(proto.Message): @@ -12063,10 +15259,23 @@ class DeleteRegionAutoscalerRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - autoscaler = proto.Field(proto.STRING, number=517258967,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + autoscaler = proto.Field( + proto.STRING, + number=517258967, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class DeleteRegionBackendServiceRequest(proto.Message): @@ -12101,10 +15310,23 @@ class DeleteRegionBackendServiceRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - backend_service = proto.Field(proto.STRING, number=306946058,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + backend_service = proto.Field( + proto.STRING, + number=306946058, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class DeleteRegionDiskRequest(proto.Message): @@ -12139,10 +15361,23 @@ class DeleteRegionDiskRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - disk = proto.Field(proto.STRING, number=3083677,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + disk = proto.Field( + proto.STRING, + number=3083677, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class DeleteRegionHealthCheckRequest(proto.Message): @@ -12176,10 +15411,23 @@ class DeleteRegionHealthCheckRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - health_check = proto.Field(proto.STRING, number=308876645,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + health_check = proto.Field( + proto.STRING, + number=308876645, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class DeleteRegionHealthCheckServiceRequest(proto.Message): @@ -12215,10 +15463,23 @@ class DeleteRegionHealthCheckServiceRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - health_check_service = proto.Field(proto.STRING, number=408374747,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + health_check_service = proto.Field( + proto.STRING, + number=408374747, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class DeleteRegionInstanceGroupManagerRequest(proto.Message): @@ -12252,10 +15513,23 @@ class DeleteRegionInstanceGroupManagerRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - instance_group_manager = proto.Field(proto.STRING, number=249363395,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class DeleteRegionNetworkEndpointGroupRequest(proto.Message): @@ -12292,10 +15566,23 @@ class DeleteRegionNetworkEndpointGroupRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - network_endpoint_group = proto.Field(proto.STRING, number=433907078,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + network_endpoint_group = proto.Field( + proto.STRING, + number=433907078, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class DeleteRegionNotificationEndpointRequest(proto.Message): @@ -12330,10 +15617,23 @@ class DeleteRegionNotificationEndpointRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - notification_endpoint = proto.Field(proto.STRING, number=376807017,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + notification_endpoint = proto.Field( + proto.STRING, + number=376807017, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class DeleteRegionOperationRequest(proto.Message): @@ -12349,9 +15649,18 @@ class DeleteRegionOperationRequest(proto.Message): Name of the region for this request. """ - operation = proto.Field(proto.STRING, number=52090215,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + operation = proto.Field( + proto.STRING, + number=52090215, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) class DeleteRegionOperationResponse(proto.Message): @@ -12393,10 +15702,23 @@ class DeleteRegionSslCertificateRequest(proto.Message): delete. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - ssl_certificate = proto.Field(proto.STRING, number=46443492,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + ssl_certificate = proto.Field( + proto.STRING, + number=46443492, + ) class DeleteRegionTargetHttpProxyRequest(proto.Message): @@ -12431,10 +15753,23 @@ class DeleteRegionTargetHttpProxyRequest(proto.Message): delete. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - target_http_proxy = proto.Field(proto.STRING, number=206872421,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + target_http_proxy = proto.Field( + proto.STRING, + number=206872421, + ) class DeleteRegionTargetHttpsProxyRequest(proto.Message): @@ -12469,10 +15804,23 @@ class DeleteRegionTargetHttpsProxyRequest(proto.Message): delete. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - target_https_proxy = proto.Field(proto.STRING, number=52336748,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + target_https_proxy = proto.Field( + proto.STRING, + number=52336748, + ) class DeleteRegionUrlMapRequest(proto.Message): @@ -12493,10 +15841,23 @@ class DeleteRegionUrlMapRequest(proto.Message): Name of the UrlMap resource to delete. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - url_map = proto.Field(proto.STRING, number=367020684,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + url_map = proto.Field( + proto.STRING, + number=367020684, + ) class DeleteReservationRequest(proto.Message): @@ -12530,10 +15891,23 @@ class DeleteReservationRequest(proto.Message): Name of the zone for this request. """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - reservation = proto.Field(proto.STRING, number=47530956,) - zone = proto.Field(proto.STRING, number=3744684,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + reservation = proto.Field( + proto.STRING, + number=47530956, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class DeleteResourcePolicyRequest(proto.Message): @@ -12567,10 +15941,23 @@ class DeleteResourcePolicyRequest(proto.Message): Name of the resource policy to delete. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - resource_policy = proto.Field(proto.STRING, number=159240835,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + resource_policy = proto.Field( + proto.STRING, + number=159240835, + ) class DeleteRouteRequest(proto.Message): @@ -12602,9 +15989,19 @@ class DeleteRouteRequest(proto.Message): Name of the Route resource to delete. """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - route = proto.Field(proto.STRING, number=108704329,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + route = proto.Field( + proto.STRING, + number=108704329, + ) class DeleteRouterRequest(proto.Message): @@ -12638,10 +16035,23 @@ class DeleteRouterRequest(proto.Message): Name of the Router resource to delete. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - router = proto.Field(proto.STRING, number=148608841,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + router = proto.Field( + proto.STRING, + number=148608841, + ) class DeleteSecurityPolicyRequest(proto.Message): @@ -12673,9 +16083,19 @@ class DeleteSecurityPolicyRequest(proto.Message): Name of the security policy to delete. """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - security_policy = proto.Field(proto.STRING, number=171082513,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + security_policy = proto.Field( + proto.STRING, + number=171082513, + ) class DeleteServiceAttachmentRequest(proto.Message): @@ -12710,10 +16130,23 @@ class DeleteServiceAttachmentRequest(proto.Message): delete. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - service_attachment = proto.Field(proto.STRING, number=338957549,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + service_attachment = proto.Field( + proto.STRING, + number=338957549, + ) class DeleteSignedUrlKeyBackendBucketRequest(proto.Message): @@ -12749,10 +16182,23 @@ class DeleteSignedUrlKeyBackendBucketRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - backend_bucket = proto.Field(proto.STRING, number=91714037,) - key_name = proto.Field(proto.STRING, number=500938859,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + backend_bucket = proto.Field( + proto.STRING, + number=91714037, + ) + key_name = proto.Field( + proto.STRING, + number=500938859, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class DeleteSignedUrlKeyBackendServiceRequest(proto.Message): @@ -12788,10 +16234,23 @@ class DeleteSignedUrlKeyBackendServiceRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - backend_service = proto.Field(proto.STRING, number=306946058,) - key_name = proto.Field(proto.STRING, number=500938859,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + backend_service = proto.Field( + proto.STRING, + number=306946058, + ) + key_name = proto.Field( + proto.STRING, + number=500938859, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class DeleteSnapshotRequest(proto.Message): @@ -12823,9 +16282,19 @@ class DeleteSnapshotRequest(proto.Message): Name of the Snapshot resource to delete. """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - snapshot = proto.Field(proto.STRING, number=284874180,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + snapshot = proto.Field( + proto.STRING, + number=284874180, + ) class DeleteSslCertificateRequest(proto.Message): @@ -12858,9 +16327,19 @@ class DeleteSslCertificateRequest(proto.Message): delete. """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - ssl_certificate = proto.Field(proto.STRING, number=46443492,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + ssl_certificate = proto.Field( + proto.STRING, + number=46443492, + ) class DeleteSslPolicyRequest(proto.Message): @@ -12894,9 +16373,19 @@ class DeleteSslPolicyRequest(proto.Message): RFC1035. """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - ssl_policy = proto.Field(proto.STRING, number=295190213,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + ssl_policy = proto.Field( + proto.STRING, + number=295190213, + ) class DeleteSubnetworkRequest(proto.Message): @@ -12930,10 +16419,23 @@ class DeleteSubnetworkRequest(proto.Message): Name of the Subnetwork resource to delete. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - subnetwork = proto.Field(proto.STRING, number=307827694,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + subnetwork = proto.Field( + proto.STRING, + number=307827694, + ) class DeleteTargetGrpcProxyRequest(proto.Message): @@ -12966,9 +16468,19 @@ class DeleteTargetGrpcProxyRequest(proto.Message): delete. """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - target_grpc_proxy = proto.Field(proto.STRING, number=5020283,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + target_grpc_proxy = proto.Field( + proto.STRING, + number=5020283, + ) class DeleteTargetHttpProxyRequest(proto.Message): @@ -13001,9 +16513,19 @@ class DeleteTargetHttpProxyRequest(proto.Message): delete. """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - target_http_proxy = proto.Field(proto.STRING, number=206872421,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + target_http_proxy = proto.Field( + proto.STRING, + number=206872421, + ) class DeleteTargetHttpsProxyRequest(proto.Message): @@ -13036,9 +16558,19 @@ class DeleteTargetHttpsProxyRequest(proto.Message): delete. """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - target_https_proxy = proto.Field(proto.STRING, number=52336748,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + target_https_proxy = proto.Field( + proto.STRING, + number=52336748, + ) class DeleteTargetInstanceRequest(proto.Message): @@ -13073,10 +16605,23 @@ class DeleteTargetInstanceRequest(proto.Message): Name of the zone scoping this request. """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - target_instance = proto.Field(proto.STRING, number=289769347,) - zone = proto.Field(proto.STRING, number=3744684,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + target_instance = proto.Field( + proto.STRING, + number=289769347, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class DeleteTargetPoolRequest(proto.Message): @@ -13110,10 +16655,23 @@ class DeleteTargetPoolRequest(proto.Message): Name of the TargetPool resource to delete. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - target_pool = proto.Field(proto.STRING, number=62796298,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + target_pool = proto.Field( + proto.STRING, + number=62796298, + ) class DeleteTargetSslProxyRequest(proto.Message): @@ -13146,9 +16704,19 @@ class DeleteTargetSslProxyRequest(proto.Message): delete. """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - target_ssl_proxy = proto.Field(proto.STRING, number=338795853,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + target_ssl_proxy = proto.Field( + proto.STRING, + number=338795853, + ) class DeleteTargetTcpProxyRequest(proto.Message): @@ -13181,9 +16749,19 @@ class DeleteTargetTcpProxyRequest(proto.Message): delete. """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - target_tcp_proxy = proto.Field(proto.STRING, number=503065442,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + target_tcp_proxy = proto.Field( + proto.STRING, + number=503065442, + ) class DeleteTargetVpnGatewayRequest(proto.Message): @@ -13217,10 +16795,23 @@ class DeleteTargetVpnGatewayRequest(proto.Message): Name of the target VPN gateway to delete. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - target_vpn_gateway = proto.Field(proto.STRING, number=532512843,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + target_vpn_gateway = proto.Field( + proto.STRING, + number=532512843, + ) class DeleteUrlMapRequest(proto.Message): @@ -13252,9 +16843,19 @@ class DeleteUrlMapRequest(proto.Message): Name of the UrlMap resource to delete. """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - url_map = proto.Field(proto.STRING, number=367020684,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + url_map = proto.Field( + proto.STRING, + number=367020684, + ) class DeleteVpnGatewayRequest(proto.Message): @@ -13288,10 +16889,23 @@ class DeleteVpnGatewayRequest(proto.Message): Name of the VPN gateway to delete. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - vpn_gateway = proto.Field(proto.STRING, number=406684153,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + vpn_gateway = proto.Field( + proto.STRING, + number=406684153, + ) class DeleteVpnTunnelRequest(proto.Message): @@ -13325,10 +16939,23 @@ class DeleteVpnTunnelRequest(proto.Message): Name of the VpnTunnel resource to delete. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - vpn_tunnel = proto.Field(proto.STRING, number=143821331,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + vpn_tunnel = proto.Field( + proto.STRING, + number=143821331, + ) class DeleteZoneOperationRequest(proto.Message): @@ -13344,9 +16971,18 @@ class DeleteZoneOperationRequest(proto.Message): Name of the zone for this request. """ - operation = proto.Field(proto.STRING, number=52090215,) - project = proto.Field(proto.STRING, number=227560217,) - zone = proto.Field(proto.STRING, number=3744684,) + operation = proto.Field( + proto.STRING, + number=52090215, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class DeleteZoneOperationResponse(proto.Message): @@ -13378,8 +17014,15 @@ class Denied(proto.Message): ["12345-12349"]. """ - I_p_protocol = proto.Field(proto.STRING, number=488094525, optional=True,) - ports = proto.RepeatedField(proto.STRING, number=106854418,) + I_p_protocol = proto.Field( + proto.STRING, + number=488094525, + optional=True, + ) + ports = proto.RepeatedField( + proto.STRING, + number=106854418, + ) class DeprecateImageRequest(proto.Message): @@ -13414,11 +17057,23 @@ class DeprecateImageRequest(proto.Message): """ deprecation_status_resource = proto.Field( - proto.MESSAGE, number=333006064, message="DeprecationStatus", + proto.MESSAGE, + number=333006064, + message="DeprecationStatus", + ) + image = proto.Field( + proto.STRING, + number=100313435, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - image = proto.Field(proto.STRING, number=100313435,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class DeprecationStatus(proto.Message): @@ -13488,11 +17143,31 @@ class State(proto.Enum): DEPRECATED = 463360435 OBSOLETE = 66532761 - deleted = proto.Field(proto.STRING, number=476721177, optional=True,) - deprecated = proto.Field(proto.STRING, number=515138995, optional=True,) - obsolete = proto.Field(proto.STRING, number=357647769, optional=True,) - replacement = proto.Field(proto.STRING, number=430919186, optional=True,) - state = proto.Field(proto.STRING, number=109757585, optional=True,) + deleted = proto.Field( + proto.STRING, + number=476721177, + optional=True, + ) + deprecated = proto.Field( + proto.STRING, + number=515138995, + optional=True, + ) + obsolete = proto.Field( + proto.STRING, + number=357647769, + optional=True, + ) + replacement = proto.Field( + proto.STRING, + number=430919186, + optional=True, + ) + state = proto.Field( + proto.STRING, + number=109757585, + optional=True, + ) class DetachDiskInstanceRequest(proto.Message): @@ -13530,11 +17205,27 @@ class DetachDiskInstanceRequest(proto.Message): The name of the zone for this request. """ - device_name = proto.Field(proto.STRING, number=67541716,) - instance = proto.Field(proto.STRING, number=18257045,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + device_name = proto.Field( + proto.STRING, + number=67541716, + ) + instance = proto.Field( + proto.STRING, + number=18257045, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class DetachNetworkEndpointsGlobalNetworkEndpointGroupRequest(proto.Message): @@ -13576,9 +17267,19 @@ class DetachNetworkEndpointsGlobalNetworkEndpointGroupRequest(proto.Message): number=8898269, message="GlobalNetworkEndpointGroupsDetachEndpointsRequest", ) - network_endpoint_group = proto.Field(proto.STRING, number=433907078,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + network_endpoint_group = proto.Field( + proto.STRING, + number=433907078, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class DetachNetworkEndpointsNetworkEndpointGroupRequest(proto.Message): @@ -13619,15 +17320,28 @@ class DetachNetworkEndpointsNetworkEndpointGroupRequest(proto.Message): RFC1035. """ - network_endpoint_group = proto.Field(proto.STRING, number=433907078,) + network_endpoint_group = proto.Field( + proto.STRING, + number=433907078, + ) network_endpoint_groups_detach_endpoints_request_resource = proto.Field( proto.MESSAGE, number=515608697, message="NetworkEndpointGroupsDetachEndpointsRequest", ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class DisableXpnHostProjectRequest(proto.Message): @@ -13657,8 +17371,15 @@ class DisableXpnHostProjectRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class DisableXpnResourceProjectRequest(proto.Message): @@ -13690,11 +17411,20 @@ class DisableXpnResourceProjectRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - project = proto.Field(proto.STRING, number=227560217,) + project = proto.Field( + proto.STRING, + number=227560217, + ) projects_disable_xpn_resource_request_resource = proto.Field( - proto.MESSAGE, number=209136170, message="ProjectsDisableXpnResourceRequest", + proto.MESSAGE, + number=209136170, + message="ProjectsDisableXpnResourceRequest", + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class Disk(proto.Message): @@ -14006,52 +17736,184 @@ class Status(proto.Enum): READY = 77848963 RESTORING = 404263851 - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) disk_encryption_key = proto.Field( - proto.MESSAGE, number=271660677, optional=True, message="CustomerEncryptionKey", + proto.MESSAGE, + number=271660677, + optional=True, + message="CustomerEncryptionKey", ) guest_os_features = proto.RepeatedField( - proto.MESSAGE, number=79294545, message="GuestOsFeature", - ) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - label_fingerprint = proto.Field(proto.STRING, number=178124825, optional=True,) - labels = proto.MapField(proto.STRING, proto.STRING, number=500195327,) - last_attach_timestamp = proto.Field(proto.STRING, number=42159653, optional=True,) - last_detach_timestamp = proto.Field(proto.STRING, number=56471027, optional=True,) - license_codes = proto.RepeatedField(proto.INT64, number=45482664,) - licenses = proto.RepeatedField(proto.STRING, number=337642578,) - location_hint = proto.Field(proto.STRING, number=350519505, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - options = proto.Field(proto.STRING, number=361137822, optional=True,) + proto.MESSAGE, + number=79294545, + message="GuestOsFeature", + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + label_fingerprint = proto.Field( + proto.STRING, + number=178124825, + optional=True, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=500195327, + ) + last_attach_timestamp = proto.Field( + proto.STRING, + number=42159653, + optional=True, + ) + last_detach_timestamp = proto.Field( + proto.STRING, + number=56471027, + optional=True, + ) + license_codes = proto.RepeatedField( + proto.INT64, + number=45482664, + ) + licenses = proto.RepeatedField( + proto.STRING, + number=337642578, + ) + location_hint = proto.Field( + proto.STRING, + number=350519505, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + options = proto.Field( + proto.STRING, + number=361137822, + optional=True, + ) physical_block_size_bytes = proto.Field( - proto.INT64, number=420007943, optional=True, - ) - provisioned_iops = proto.Field(proto.INT64, number=186769108, optional=True,) - region = proto.Field(proto.STRING, number=138946292, optional=True,) - replica_zones = proto.RepeatedField(proto.STRING, number=48438272,) - resource_policies = proto.RepeatedField(proto.STRING, number=22220385,) - satisfies_pzs = proto.Field(proto.BOOL, number=480964267, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - size_gb = proto.Field(proto.INT64, number=494929369, optional=True,) - source_disk = proto.Field(proto.STRING, number=451753793, optional=True,) - source_disk_id = proto.Field(proto.STRING, number=454190809, optional=True,) - source_image = proto.Field(proto.STRING, number=50443319, optional=True,) + proto.INT64, + number=420007943, + optional=True, + ) + provisioned_iops = proto.Field( + proto.INT64, + number=186769108, + optional=True, + ) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) + replica_zones = proto.RepeatedField( + proto.STRING, + number=48438272, + ) + resource_policies = proto.RepeatedField( + proto.STRING, + number=22220385, + ) + satisfies_pzs = proto.Field( + proto.BOOL, + number=480964267, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + size_gb = proto.Field( + proto.INT64, + number=494929369, + optional=True, + ) + source_disk = proto.Field( + proto.STRING, + number=451753793, + optional=True, + ) + source_disk_id = proto.Field( + proto.STRING, + number=454190809, + optional=True, + ) + source_image = proto.Field( + proto.STRING, + number=50443319, + optional=True, + ) source_image_encryption_key = proto.Field( - proto.MESSAGE, number=381503659, optional=True, message="CustomerEncryptionKey", + proto.MESSAGE, + number=381503659, + optional=True, + message="CustomerEncryptionKey", + ) + source_image_id = proto.Field( + proto.STRING, + number=55328291, + optional=True, + ) + source_snapshot = proto.Field( + proto.STRING, + number=126061928, + optional=True, ) - source_image_id = proto.Field(proto.STRING, number=55328291, optional=True,) - source_snapshot = proto.Field(proto.STRING, number=126061928, optional=True,) source_snapshot_encryption_key = proto.Field( - proto.MESSAGE, number=303679322, optional=True, message="CustomerEncryptionKey", + proto.MESSAGE, + number=303679322, + optional=True, + message="CustomerEncryptionKey", + ) + source_snapshot_id = proto.Field( + proto.STRING, + number=98962258, + optional=True, + ) + source_storage_object = proto.Field( + proto.STRING, + number=233052711, + optional=True, + ) + status = proto.Field( + proto.STRING, + number=181260274, + optional=True, + ) + type_ = proto.Field( + proto.STRING, + number=3575610, + optional=True, + ) + users = proto.RepeatedField( + proto.STRING, + number=111578632, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + optional=True, ) - source_snapshot_id = proto.Field(proto.STRING, number=98962258, optional=True,) - source_storage_object = proto.Field(proto.STRING, number=233052711, optional=True,) - status = proto.Field(proto.STRING, number=181260274, optional=True,) - type_ = proto.Field(proto.STRING, number=3575610, optional=True,) - users = proto.RepeatedField(proto.STRING, number=111578632,) - zone = proto.Field(proto.STRING, number=3744684, optional=True,) class DiskAggregatedList(proto.Message): @@ -14096,16 +17958,41 @@ class DiskAggregatedList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.MapField( - proto.STRING, proto.MESSAGE, number=100526016, message="DisksScopedList", + proto.STRING, + proto.MESSAGE, + number=100526016, + message="DisksScopedList", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - unreachables = proto.RepeatedField(proto.STRING, number=243372063,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -14180,10 +18067,26 @@ class InstantiateFrom(proto.Enum): SOURCE_IMAGE = 62631959 SOURCE_IMAGE_FAMILY = 76850316 - auto_delete = proto.Field(proto.BOOL, number=464761403, optional=True,) - custom_image = proto.Field(proto.STRING, number=184123149, optional=True,) - device_name = proto.Field(proto.STRING, number=67541716, optional=True,) - instantiate_from = proto.Field(proto.STRING, number=393383903, optional=True,) + auto_delete = proto.Field( + proto.BOOL, + number=464761403, + optional=True, + ) + custom_image = proto.Field( + proto.STRING, + number=184123149, + optional=True, + ) + device_name = proto.Field( + proto.STRING, + number=67541716, + optional=True, + ) + instantiate_from = proto.Field( + proto.STRING, + number=393383903, + optional=True, + ) class DiskList(proto.Message): @@ -14225,13 +18128,36 @@ class DiskList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) - items = proto.RepeatedField(proto.MESSAGE, number=100526016, message="Disk",) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) + items = proto.RepeatedField( + proto.MESSAGE, + number=100526016, + message="Disk", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -14260,8 +18186,16 @@ class DiskMoveRequest(proto.Message): This field is a member of `oneof`_ ``_target_disk``. """ - destination_zone = proto.Field(proto.STRING, number=131854653, optional=True,) - target_disk = proto.Field(proto.STRING, number=62433163, optional=True,) + destination_zone = proto.Field( + proto.STRING, + number=131854653, + optional=True, + ) + target_disk = proto.Field( + proto.STRING, + number=62433163, + optional=True, + ) class DiskType(proto.Message): @@ -14332,19 +18266,62 @@ class DiskType(proto.Message): This field is a member of `oneof`_ ``_zone``. """ - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - default_disk_size_gb = proto.Field(proto.INT64, number=270619253, optional=True,) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + default_disk_size_gb = proto.Field( + proto.INT64, + number=270619253, + optional=True, + ) deprecated = proto.Field( - proto.MESSAGE, number=515138995, optional=True, message="DeprecationStatus", + proto.MESSAGE, + number=515138995, + optional=True, + message="DeprecationStatus", + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + valid_disk_size = proto.Field( + proto.STRING, + number=493962464, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + optional=True, ) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - region = proto.Field(proto.STRING, number=138946292, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - valid_disk_size = proto.Field(proto.STRING, number=493962464, optional=True,) - zone = proto.Field(proto.STRING, number=3744684, optional=True,) class DiskTypeAggregatedList(proto.Message): @@ -14388,16 +18365,41 @@ class DiskTypeAggregatedList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.MapField( - proto.STRING, proto.MESSAGE, number=100526016, message="DiskTypesScopedList", + proto.STRING, + proto.MESSAGE, + number=100526016, + message="DiskTypesScopedList", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - unreachables = proto.RepeatedField(proto.STRING, number=243372063,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -14440,13 +18442,36 @@ class DiskTypeList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) - items = proto.RepeatedField(proto.MESSAGE, number=100526016, message="DiskType",) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) + items = proto.RepeatedField( + proto.MESSAGE, + number=100526016, + message="DiskType", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -14464,10 +18489,15 @@ class DiskTypesScopedList(proto.Message): """ disk_types = proto.RepeatedField( - proto.MESSAGE, number=198926167, message="DiskType", + proto.MESSAGE, + number=198926167, + message="DiskType", ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -14481,7 +18511,10 @@ class DisksAddResourcePoliciesRequest(proto.Message): one resource policy. """ - resource_policies = proto.RepeatedField(proto.STRING, number=22220385,) + resource_policies = proto.RepeatedField( + proto.STRING, + number=22220385, + ) class DisksRemoveResourcePoliciesRequest(proto.Message): @@ -14493,7 +18526,10 @@ class DisksRemoveResourcePoliciesRequest(proto.Message): disk. """ - resource_policies = proto.RepeatedField(proto.STRING, number=22220385,) + resource_policies = proto.RepeatedField( + proto.STRING, + number=22220385, + ) class DisksResizeRequest(proto.Message): @@ -14507,7 +18543,11 @@ class DisksResizeRequest(proto.Message): This field is a member of `oneof`_ ``_size_gb``. """ - size_gb = proto.Field(proto.INT64, number=494929369, optional=True,) + size_gb = proto.Field( + proto.INT64, + number=494929369, + optional=True, + ) class DisksScopedList(proto.Message): @@ -14523,9 +18563,16 @@ class DisksScopedList(proto.Message): This field is a member of `oneof`_ ``_warning``. """ - disks = proto.RepeatedField(proto.MESSAGE, number=95594102, message="Disk",) + disks = proto.RepeatedField( + proto.MESSAGE, + number=95594102, + message="Disk", + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -14540,7 +18587,11 @@ class DisplayDevice(proto.Message): This field is a member of `oneof`_ ``_enable_display``. """ - enable_display = proto.Field(proto.BOOL, number=14266886, optional=True,) + enable_display = proto.Field( + proto.BOOL, + number=14266886, + optional=True, + ) class DistributionPolicy(proto.Message): @@ -14571,9 +18622,15 @@ class TargetShape(proto.Enum): BALANCED = 468409608 EVEN = 2140442 - target_shape = proto.Field(proto.STRING, number=338621299, optional=True,) + target_shape = proto.Field( + proto.STRING, + number=338621299, + optional=True, + ) zones = proto.RepeatedField( - proto.MESSAGE, number=116085319, message="DistributionPolicyZoneConfiguration", + proto.MESSAGE, + number=116085319, + message="DistributionPolicyZoneConfiguration", ) @@ -14589,7 +18646,11 @@ class DistributionPolicyZoneConfiguration(proto.Message): This field is a member of `oneof`_ ``_zone``. """ - zone = proto.Field(proto.STRING, number=3744684, optional=True,) + zone = proto.Field( + proto.STRING, + number=3744684, + optional=True, + ) class Duration(proto.Message): @@ -14615,8 +18676,16 @@ class Duration(proto.Message): This field is a member of `oneof`_ ``_seconds``. """ - nanos = proto.Field(proto.INT32, number=104586303, optional=True,) - seconds = proto.Field(proto.INT64, number=359484031, optional=True,) + nanos = proto.Field( + proto.INT32, + number=104586303, + optional=True, + ) + seconds = proto.Field( + proto.INT64, + number=359484031, + optional=True, + ) class EnableXpnHostProjectRequest(proto.Message): @@ -14646,8 +18715,15 @@ class EnableXpnHostProjectRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class EnableXpnResourceProjectRequest(proto.Message): @@ -14679,11 +18755,20 @@ class EnableXpnResourceProjectRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - project = proto.Field(proto.STRING, number=227560217,) + project = proto.Field( + proto.STRING, + number=227560217, + ) projects_enable_xpn_resource_request_resource = proto.Field( - proto.MESSAGE, number=421980207, message="ProjectsEnableXpnResourceRequest", + proto.MESSAGE, + number=421980207, + message="ProjectsEnableXpnResourceRequest", + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class Error(proto.Message): @@ -14696,7 +18781,11 @@ class Error(proto.Message): processing this operation. """ - errors = proto.RepeatedField(proto.MESSAGE, number=315977579, message="Errors",) + errors = proto.RepeatedField( + proto.MESSAGE, + number=315977579, + message="Errors", + ) class Errors(proto.Message): @@ -14718,9 +18807,21 @@ class Errors(proto.Message): This field is a member of `oneof`_ ``_message``. """ - code = proto.Field(proto.STRING, number=3059181, optional=True,) - location = proto.Field(proto.STRING, number=290430901, optional=True,) - message = proto.Field(proto.STRING, number=418054151, optional=True,) + code = proto.Field( + proto.STRING, + number=3059181, + optional=True, + ) + location = proto.Field( + proto.STRING, + number=290430901, + optional=True, + ) + message = proto.Field( + proto.STRING, + number=418054151, + optional=True, + ) class ExchangedPeeringRoute(proto.Message): @@ -14765,11 +18866,31 @@ class Type(proto.Enum): STATIC_PEERING_ROUTE = 473407545 SUBNET_PEERING_ROUTE = 465782504 - dest_range = proto.Field(proto.STRING, number=381327712, optional=True,) - imported = proto.Field(proto.BOOL, number=114502404, optional=True,) - next_hop_region = proto.Field(proto.STRING, number=122577014, optional=True,) - priority = proto.Field(proto.UINT32, number=445151652, optional=True,) - type_ = proto.Field(proto.STRING, number=3575610, optional=True,) + dest_range = proto.Field( + proto.STRING, + number=381327712, + optional=True, + ) + imported = proto.Field( + proto.BOOL, + number=114502404, + optional=True, + ) + next_hop_region = proto.Field( + proto.STRING, + number=122577014, + optional=True, + ) + priority = proto.Field( + proto.UINT32, + number=445151652, + optional=True, + ) + type_ = proto.Field( + proto.STRING, + number=3575610, + optional=True, + ) class ExchangedPeeringRoutesList(proto.Message): @@ -14812,15 +18933,36 @@ class ExchangedPeeringRoutesList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="ExchangedPeeringRoute", + proto.MESSAGE, + number=100526016, + message="ExchangedPeeringRoute", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -14857,12 +18999,27 @@ class ExpandIpCidrRangeSubnetworkRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - subnetwork = proto.Field(proto.STRING, number=307827694,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + subnetwork = proto.Field( + proto.STRING, + number=307827694, + ) subnetworks_expand_ip_cidr_range_request_resource = proto.Field( - proto.MESSAGE, number=477014110, message="SubnetworksExpandIpCidrRangeRequest", + proto.MESSAGE, + number=477014110, + message="SubnetworksExpandIpCidrRangeRequest", ) @@ -14913,10 +19070,26 @@ class Expr(proto.Message): This field is a member of `oneof`_ ``_title``. """ - description = proto.Field(proto.STRING, number=422937596, optional=True,) - expression = proto.Field(proto.STRING, number=352031384, optional=True,) - location = proto.Field(proto.STRING, number=290430901, optional=True,) - title = proto.Field(proto.STRING, number=110371416, optional=True,) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + expression = proto.Field( + proto.STRING, + number=352031384, + optional=True, + ) + location = proto.Field( + proto.STRING, + number=290430901, + optional=True, + ) + title = proto.Field( + proto.STRING, + number=110371416, + optional=True, + ) class ExternalVpnGateway(proto.Message): @@ -15013,18 +19186,56 @@ class RedundancyType(proto.Enum): SINGLE_IP_INTERNALLY_REDUNDANT = 133914873 TWO_IPS_REDUNDANCY = 367049635 - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) interfaces = proto.RepeatedField( - proto.MESSAGE, number=12073562, message="ExternalVpnGatewayInterface", + proto.MESSAGE, + number=12073562, + message="ExternalVpnGatewayInterface", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + label_fingerprint = proto.Field( + proto.STRING, + number=178124825, + optional=True, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=500195327, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + redundancy_type = proto.Field( + proto.STRING, + number=271443740, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - label_fingerprint = proto.Field(proto.STRING, number=178124825, optional=True,) - labels = proto.MapField(proto.STRING, proto.STRING, number=500195327,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - redundancy_type = proto.Field(proto.STRING, number=271443740, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) class ExternalVpnGatewayInterface(proto.Message): @@ -15049,8 +19260,16 @@ class ExternalVpnGatewayInterface(proto.Message): This field is a member of `oneof`_ ``_ip_address``. """ - id = proto.Field(proto.UINT32, number=3355, optional=True,) - ip_address = proto.Field(proto.STRING, number=406272220, optional=True,) + id = proto.Field( + proto.UINT32, + number=3355, + optional=True, + ) + ip_address = proto.Field( + proto.STRING, + number=406272220, + optional=True, + ) class ExternalVpnGatewayList(proto.Message): @@ -15097,16 +19316,41 @@ class ExternalVpnGatewayList(proto.Message): def raw_page(self): return self - etag = proto.Field(proto.STRING, number=3123477, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + etag = proto.Field( + proto.STRING, + number=3123477, + optional=True, + ) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="ExternalVpnGateway", + proto.MESSAGE, + number=100526016, + message="ExternalVpnGateway", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -15133,8 +19377,16 @@ class FileType(proto.Enum): UNDEFINED = 137851184 X509 = 2674086 - content = proto.Field(proto.STRING, number=414659705, optional=True,) - file_type = proto.Field(proto.STRING, number=294346781, optional=True,) + content = proto.Field( + proto.STRING, + number=414659705, + optional=True, + ) + file_type = proto.Field( + proto.STRING, + number=294346781, + optional=True, + ) class Firewall(proto.Message): @@ -15320,27 +19572,96 @@ class Direction(proto.Enum): EGRESS = 432880501 INGRESS = 516931221 - allowed = proto.RepeatedField(proto.MESSAGE, number=162398632, message="Allowed",) - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - denied = proto.RepeatedField(proto.MESSAGE, number=275217307, message="Denied",) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - destination_ranges = proto.RepeatedField(proto.STRING, number=305699879,) - direction = proto.Field(proto.STRING, number=111150975, optional=True,) - disabled = proto.Field(proto.BOOL, number=270940796, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) + allowed = proto.RepeatedField( + proto.MESSAGE, + number=162398632, + message="Allowed", + ) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + denied = proto.RepeatedField( + proto.MESSAGE, + number=275217307, + message="Denied", + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + destination_ranges = proto.RepeatedField( + proto.STRING, + number=305699879, + ) + direction = proto.Field( + proto.STRING, + number=111150975, + optional=True, + ) + disabled = proto.Field( + proto.BOOL, + number=270940796, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) log_config = proto.Field( - proto.MESSAGE, number=351299741, optional=True, message="FirewallLogConfig", + proto.MESSAGE, + number=351299741, + optional=True, + message="FirewallLogConfig", + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + network = proto.Field( + proto.STRING, + number=232872494, + optional=True, + ) + priority = proto.Field( + proto.INT32, + number=445151652, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + source_ranges = proto.RepeatedField( + proto.STRING, + number=200097658, + ) + source_service_accounts = proto.RepeatedField( + proto.STRING, + number=105100756, + ) + source_tags = proto.RepeatedField( + proto.STRING, + number=452222397, + ) + target_service_accounts = proto.RepeatedField( + proto.STRING, + number=457639710, + ) + target_tags = proto.RepeatedField( + proto.STRING, + number=62901767, ) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - network = proto.Field(proto.STRING, number=232872494, optional=True,) - priority = proto.Field(proto.INT32, number=445151652, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - source_ranges = proto.RepeatedField(proto.STRING, number=200097658,) - source_service_accounts = proto.RepeatedField(proto.STRING, number=105100756,) - source_tags = proto.RepeatedField(proto.STRING, number=452222397,) - target_service_accounts = proto.RepeatedField(proto.STRING, number=457639710,) - target_tags = proto.RepeatedField(proto.STRING, number=62901767,) class FirewallList(proto.Message): @@ -15382,13 +19703,36 @@ class FirewallList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) - items = proto.RepeatedField(proto.MESSAGE, number=100526016, message="Firewall",) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) + items = proto.RepeatedField( + proto.MESSAGE, + number=100526016, + message="Firewall", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -15421,8 +19765,16 @@ class Metadata(proto.Enum): EXCLUDE_ALL_METADATA = 334519954 INCLUDE_ALL_METADATA = 164619908 - enable = proto.Field(proto.BOOL, number=311764355, optional=True,) - metadata = proto.Field(proto.STRING, number=86866735, optional=True,) + enable = proto.Field( + proto.BOOL, + number=311764355, + optional=True, + ) + metadata = proto.Field( + proto.STRING, + number=86866735, + optional=True, + ) class FirewallPoliciesListAssociationsResponse(proto.Message): @@ -15440,9 +19792,15 @@ class FirewallPoliciesListAssociationsResponse(proto.Message): """ associations = proto.RepeatedField( - proto.MESSAGE, number=508736530, message="FirewallPolicyAssociation", + proto.MESSAGE, + number=508736530, + message="FirewallPolicyAssociation", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) class FirewallPolicy(proto.Message): @@ -15547,23 +19905,75 @@ class FirewallPolicy(proto.Message): """ associations = proto.RepeatedField( - proto.MESSAGE, number=508736530, message="FirewallPolicyAssociation", - ) - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - display_name = proto.Field(proto.STRING, number=4473832, optional=True,) - fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - parent = proto.Field(proto.STRING, number=78317738, optional=True,) - rule_tuple_count = proto.Field(proto.INT32, number=388342037, optional=True,) + proto.MESSAGE, + number=508736530, + message="FirewallPolicyAssociation", + ) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + display_name = proto.Field( + proto.STRING, + number=4473832, + optional=True, + ) + fingerprint = proto.Field( + proto.STRING, + number=234678500, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + parent = proto.Field( + proto.STRING, + number=78317738, + optional=True, + ) + rule_tuple_count = proto.Field( + proto.INT32, + number=388342037, + optional=True, + ) rules = proto.RepeatedField( - proto.MESSAGE, number=108873975, message="FirewallPolicyRule", + proto.MESSAGE, + number=108873975, + message="FirewallPolicyRule", + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + self_link_with_id = proto.Field( + proto.STRING, + number=44520962, + optional=True, + ) + short_name = proto.Field( + proto.STRING, + number=492051566, + optional=True, ) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - self_link_with_id = proto.Field(proto.STRING, number=44520962, optional=True,) - short_name = proto.Field(proto.STRING, number=492051566, optional=True,) class FirewallPolicyAssociation(proto.Message): @@ -15595,11 +20005,31 @@ class FirewallPolicyAssociation(proto.Message): This field is a member of `oneof`_ ``_short_name``. """ - attachment_target = proto.Field(proto.STRING, number=175773741, optional=True,) - display_name = proto.Field(proto.STRING, number=4473832, optional=True,) - firewall_policy_id = proto.Field(proto.STRING, number=357211849, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - short_name = proto.Field(proto.STRING, number=492051566, optional=True,) + attachment_target = proto.Field( + proto.STRING, + number=175773741, + optional=True, + ) + display_name = proto.Field( + proto.STRING, + number=4473832, + optional=True, + ) + firewall_policy_id = proto.Field( + proto.STRING, + number=357211849, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + short_name = proto.Field( + proto.STRING, + number=492051566, + optional=True, + ) class FirewallPolicyList(proto.Message): @@ -15637,14 +20067,31 @@ class FirewallPolicyList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="FirewallPolicy", + proto.MESSAGE, + number=100526016, + message="FirewallPolicy", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -15730,22 +20177,60 @@ class Direction(proto.Enum): EGRESS = 432880501 INGRESS = 516931221 - action = proto.Field(proto.STRING, number=187661878, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - direction = proto.Field(proto.STRING, number=111150975, optional=True,) - disabled = proto.Field(proto.BOOL, number=270940796, optional=True,) - enable_logging = proto.Field(proto.BOOL, number=295396515, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) + action = proto.Field( + proto.STRING, + number=187661878, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + direction = proto.Field( + proto.STRING, + number=111150975, + optional=True, + ) + disabled = proto.Field( + proto.BOOL, + number=270940796, + optional=True, + ) + enable_logging = proto.Field( + proto.BOOL, + number=295396515, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) match = proto.Field( proto.MESSAGE, number=103668165, optional=True, message="FirewallPolicyRuleMatcher", ) - priority = proto.Field(proto.INT32, number=445151652, optional=True,) - rule_tuple_count = proto.Field(proto.INT32, number=388342037, optional=True,) - target_resources = proto.RepeatedField(proto.STRING, number=528230647,) - target_service_accounts = proto.RepeatedField(proto.STRING, number=457639710,) + priority = proto.Field( + proto.INT32, + number=445151652, + optional=True, + ) + rule_tuple_count = proto.Field( + proto.INT32, + number=388342037, + optional=True, + ) + target_resources = proto.RepeatedField( + proto.STRING, + number=528230647, + ) + target_service_accounts = proto.RepeatedField( + proto.STRING, + number=457639710, + ) class FirewallPolicyRuleMatcher(proto.Message): @@ -15764,13 +20249,19 @@ class FirewallPolicyRuleMatcher(proto.Message): source CIDR IP ranges allowed is 5000. """ - dest_ip_ranges = proto.RepeatedField(proto.STRING, number=337357713,) + dest_ip_ranges = proto.RepeatedField( + proto.STRING, + number=337357713, + ) layer4_configs = proto.RepeatedField( proto.MESSAGE, number=373534261, message="FirewallPolicyRuleMatcherLayer4Config", ) - src_ip_ranges = proto.RepeatedField(proto.STRING, number=432128083,) + src_ip_ranges = proto.RepeatedField( + proto.STRING, + number=432128083, + ) class FirewallPolicyRuleMatcherLayer4Config(proto.Message): @@ -15794,8 +20285,15 @@ class FirewallPolicyRuleMatcherLayer4Config(proto.Message): include: ["22"], ["80","443"], and ["12345-12349"]. """ - ip_protocol = proto.Field(proto.STRING, number=475958960, optional=True,) - ports = proto.RepeatedField(proto.STRING, number=106854418,) + ip_protocol = proto.Field( + proto.STRING, + number=475958960, + optional=True, + ) + ports = proto.RepeatedField( + proto.STRING, + number=106854418, + ) class FixedOrPercent(proto.Message): @@ -15827,9 +20325,21 @@ class FixedOrPercent(proto.Message): This field is a member of `oneof`_ ``_percent``. """ - calculated = proto.Field(proto.INT32, number=472082878, optional=True,) - fixed = proto.Field(proto.INT32, number=97445748, optional=True,) - percent = proto.Field(proto.INT32, number=394814533, optional=True,) + calculated = proto.Field( + proto.INT32, + number=472082878, + optional=True, + ) + fixed = proto.Field( + proto.INT32, + number=97445748, + optional=True, + ) + percent = proto.Field( + proto.INT32, + number=394814533, + optional=True, + ) class ForwardingRule(proto.Message): @@ -16195,42 +20705,155 @@ class PscConnectionStatus(proto.Enum): REJECTED = 174130302 STATUS_UNSPECIFIED = 42133066 - I_p_address = proto.Field(proto.STRING, number=42976943, optional=True,) - I_p_protocol = proto.Field(proto.STRING, number=488094525, optional=True,) - all_ports = proto.Field(proto.BOOL, number=445175796, optional=True,) - allow_global_access = proto.Field(proto.BOOL, number=499409674, optional=True,) - backend_service = proto.Field(proto.STRING, number=306946058, optional=True,) - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - ip_version = proto.Field(proto.STRING, number=294959552, optional=True,) - is_mirroring_collector = proto.Field(proto.BOOL, number=119255164, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - label_fingerprint = proto.Field(proto.STRING, number=178124825, optional=True,) - labels = proto.MapField(proto.STRING, proto.STRING, number=500195327,) - load_balancing_scheme = proto.Field(proto.STRING, number=363890244, optional=True,) + I_p_address = proto.Field( + proto.STRING, + number=42976943, + optional=True, + ) + I_p_protocol = proto.Field( + proto.STRING, + number=488094525, + optional=True, + ) + all_ports = proto.Field( + proto.BOOL, + number=445175796, + optional=True, + ) + allow_global_access = proto.Field( + proto.BOOL, + number=499409674, + optional=True, + ) + backend_service = proto.Field( + proto.STRING, + number=306946058, + optional=True, + ) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + fingerprint = proto.Field( + proto.STRING, + number=234678500, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + ip_version = proto.Field( + proto.STRING, + number=294959552, + optional=True, + ) + is_mirroring_collector = proto.Field( + proto.BOOL, + number=119255164, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + label_fingerprint = proto.Field( + proto.STRING, + number=178124825, + optional=True, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=500195327, + ) + load_balancing_scheme = proto.Field( + proto.STRING, + number=363890244, + optional=True, + ) metadata_filters = proto.RepeatedField( - proto.MESSAGE, number=464725739, message="MetadataFilter", - ) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - network = proto.Field(proto.STRING, number=232872494, optional=True,) - network_tier = proto.Field(proto.STRING, number=517397843, optional=True,) - port_range = proto.Field(proto.STRING, number=217518079, optional=True,) - ports = proto.RepeatedField(proto.STRING, number=106854418,) - psc_connection_id = proto.Field(proto.UINT64, number=292082397, optional=True,) - psc_connection_status = proto.Field(proto.STRING, number=184149172, optional=True,) - region = proto.Field(proto.STRING, number=138946292, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + proto.MESSAGE, + number=464725739, + message="MetadataFilter", + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + network = proto.Field( + proto.STRING, + number=232872494, + optional=True, + ) + network_tier = proto.Field( + proto.STRING, + number=517397843, + optional=True, + ) + port_range = proto.Field( + proto.STRING, + number=217518079, + optional=True, + ) + ports = proto.RepeatedField( + proto.STRING, + number=106854418, + ) + psc_connection_id = proto.Field( + proto.UINT64, + number=292082397, + optional=True, + ) + psc_connection_status = proto.Field( + proto.STRING, + number=184149172, + optional=True, + ) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) service_directory_registrations = proto.RepeatedField( proto.MESSAGE, number=223549694, message="ForwardingRuleServiceDirectoryRegistration", ) - service_label = proto.Field(proto.STRING, number=417008874, optional=True,) - service_name = proto.Field(proto.STRING, number=359880149, optional=True,) - subnetwork = proto.Field(proto.STRING, number=307827694, optional=True,) - target = proto.Field(proto.STRING, number=192835985, optional=True,) + service_label = proto.Field( + proto.STRING, + number=417008874, + optional=True, + ) + service_name = proto.Field( + proto.STRING, + number=359880149, + optional=True, + ) + subnetwork = proto.Field( + proto.STRING, + number=307827694, + optional=True, + ) + target = proto.Field( + proto.STRING, + number=192835985, + optional=True, + ) class ForwardingRuleAggregatedList(proto.Message): @@ -16276,19 +20899,41 @@ class ForwardingRuleAggregatedList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.MapField( proto.STRING, proto.MESSAGE, number=100526016, message="ForwardingRulesScopedList", ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - unreachables = proto.RepeatedField(proto.STRING, number=243372063,) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -16330,15 +20975,36 @@ class ForwardingRuleList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="ForwardingRule", + proto.MESSAGE, + number=100526016, + message="ForwardingRule", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -16351,7 +21017,11 @@ class ForwardingRuleReference(proto.Message): This field is a member of `oneof`_ ``_forwarding_rule``. """ - forwarding_rule = proto.Field(proto.STRING, number=269964030, optional=True,) + forwarding_rule = proto.Field( + proto.STRING, + number=269964030, + optional=True, + ) class ForwardingRuleServiceDirectoryRegistration(proto.Message): @@ -16381,10 +21051,20 @@ class ForwardingRuleServiceDirectoryRegistration(proto.Message): This field is a member of `oneof`_ ``_service_directory_region``. """ - namespace = proto.Field(proto.STRING, number=178476379, optional=True,) - service = proto.Field(proto.STRING, number=373540533, optional=True,) + namespace = proto.Field( + proto.STRING, + number=178476379, + optional=True, + ) + service = proto.Field( + proto.STRING, + number=373540533, + optional=True, + ) service_directory_region = proto.Field( - proto.STRING, number=74030416, optional=True, + proto.STRING, + number=74030416, + optional=True, ) @@ -16403,10 +21083,15 @@ class ForwardingRulesScopedList(proto.Message): """ forwarding_rules = proto.RepeatedField( - proto.MESSAGE, number=315821365, message="ForwardingRule", + proto.MESSAGE, + number=315821365, + message="ForwardingRule", ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -16468,10 +21153,26 @@ class PortSpecification(proto.Enum): USE_NAMED_PORT = 349300671 USE_SERVING_PORT = 362637516 - grpc_service_name = proto.Field(proto.STRING, number=136533078, optional=True,) - port = proto.Field(proto.INT32, number=3446913, optional=True,) - port_name = proto.Field(proto.STRING, number=41534345, optional=True,) - port_specification = proto.Field(proto.STRING, number=51590597, optional=True,) + grpc_service_name = proto.Field( + proto.STRING, + number=136533078, + optional=True, + ) + port = proto.Field( + proto.INT32, + number=3446913, + optional=True, + ) + port_name = proto.Field( + proto.STRING, + number=41534345, + optional=True, + ) + port_specification = proto.Field( + proto.STRING, + number=51590597, + optional=True, + ) class GetAcceleratorTypeRequest(proto.Message): @@ -16487,9 +21188,18 @@ class GetAcceleratorTypeRequest(proto.Message): The name of the zone for this request. """ - accelerator_type = proto.Field(proto.STRING, number=138031246,) - project = proto.Field(proto.STRING, number=227560217,) - zone = proto.Field(proto.STRING, number=3744684,) + accelerator_type = proto.Field( + proto.STRING, + number=138031246, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class GetAddressRequest(proto.Message): @@ -16505,9 +21215,18 @@ class GetAddressRequest(proto.Message): Name of the region for this request. """ - address = proto.Field(proto.STRING, number=462920692,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + address = proto.Field( + proto.STRING, + number=462920692, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) class GetAssociationFirewallPolicyRequest(proto.Message): @@ -16525,8 +21244,15 @@ class GetAssociationFirewallPolicyRequest(proto.Message): This field is a member of `oneof`_ ``_name``. """ - firewall_policy = proto.Field(proto.STRING, number=498173265,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) + firewall_policy = proto.Field( + proto.STRING, + number=498173265, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) class GetAutoscalerRequest(proto.Message): @@ -16542,9 +21268,18 @@ class GetAutoscalerRequest(proto.Message): Name of the zone for this request. """ - autoscaler = proto.Field(proto.STRING, number=517258967,) - project = proto.Field(proto.STRING, number=227560217,) - zone = proto.Field(proto.STRING, number=3744684,) + autoscaler = proto.Field( + proto.STRING, + number=517258967, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class GetBackendBucketRequest(proto.Message): @@ -16558,8 +21293,14 @@ class GetBackendBucketRequest(proto.Message): Project ID for this request. """ - backend_bucket = proto.Field(proto.STRING, number=91714037,) - project = proto.Field(proto.STRING, number=227560217,) + backend_bucket = proto.Field( + proto.STRING, + number=91714037, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) class GetBackendServiceRequest(proto.Message): @@ -16574,8 +21315,14 @@ class GetBackendServiceRequest(proto.Message): Project ID for this request. """ - backend_service = proto.Field(proto.STRING, number=306946058,) - project = proto.Field(proto.STRING, number=227560217,) + backend_service = proto.Field( + proto.STRING, + number=306946058, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) class GetDiagnosticsInterconnectRequest(proto.Message): @@ -16589,8 +21336,14 @@ class GetDiagnosticsInterconnectRequest(proto.Message): Project ID for this request. """ - interconnect = proto.Field(proto.STRING, number=224601230,) - project = proto.Field(proto.STRING, number=227560217,) + interconnect = proto.Field( + proto.STRING, + number=224601230, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) class GetDiskRequest(proto.Message): @@ -16606,9 +21359,18 @@ class GetDiskRequest(proto.Message): The name of the zone for this request. """ - disk = proto.Field(proto.STRING, number=3083677,) - project = proto.Field(proto.STRING, number=227560217,) - zone = proto.Field(proto.STRING, number=3744684,) + disk = proto.Field( + proto.STRING, + number=3083677, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class GetDiskTypeRequest(proto.Message): @@ -16624,9 +21386,18 @@ class GetDiskTypeRequest(proto.Message): The name of the zone for this request. """ - disk_type = proto.Field(proto.STRING, number=93009052,) - project = proto.Field(proto.STRING, number=227560217,) - zone = proto.Field(proto.STRING, number=3744684,) + disk_type = proto.Field( + proto.STRING, + number=93009052, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class GetEffectiveFirewallsInstanceRequest(proto.Message): @@ -16645,10 +21416,22 @@ class GetEffectiveFirewallsInstanceRequest(proto.Message): The name of the zone for this request. """ - instance = proto.Field(proto.STRING, number=18257045,) - network_interface = proto.Field(proto.STRING, number=365387880,) - project = proto.Field(proto.STRING, number=227560217,) - zone = proto.Field(proto.STRING, number=3744684,) + instance = proto.Field( + proto.STRING, + number=18257045, + ) + network_interface = proto.Field( + proto.STRING, + number=365387880, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class GetEffectiveFirewallsNetworkRequest(proto.Message): @@ -16662,8 +21445,14 @@ class GetEffectiveFirewallsNetworkRequest(proto.Message): Project ID for this request. """ - network = proto.Field(proto.STRING, number=232872494,) - project = proto.Field(proto.STRING, number=227560217,) + network = proto.Field( + proto.STRING, + number=232872494, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) class GetExternalVpnGatewayRequest(proto.Message): @@ -16677,8 +21466,14 @@ class GetExternalVpnGatewayRequest(proto.Message): Project ID for this request. """ - external_vpn_gateway = proto.Field(proto.STRING, number=109898629,) - project = proto.Field(proto.STRING, number=227560217,) + external_vpn_gateway = proto.Field( + proto.STRING, + number=109898629, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) class GetFirewallPolicyRequest(proto.Message): @@ -16690,7 +21485,10 @@ class GetFirewallPolicyRequest(proto.Message): Name of the firewall policy to get. """ - firewall_policy = proto.Field(proto.STRING, number=498173265,) + firewall_policy = proto.Field( + proto.STRING, + number=498173265, + ) class GetFirewallRequest(proto.Message): @@ -16704,8 +21502,14 @@ class GetFirewallRequest(proto.Message): Project ID for this request. """ - firewall = proto.Field(proto.STRING, number=511016192,) - project = proto.Field(proto.STRING, number=227560217,) + firewall = proto.Field( + proto.STRING, + number=511016192, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) class GetForwardingRuleRequest(proto.Message): @@ -16722,9 +21526,18 @@ class GetForwardingRuleRequest(proto.Message): Name of the region scoping this request. """ - forwarding_rule = proto.Field(proto.STRING, number=269964030,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + forwarding_rule = proto.Field( + proto.STRING, + number=269964030, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) class GetFromFamilyImageRequest(proto.Message): @@ -16738,8 +21551,14 @@ class GetFromFamilyImageRequest(proto.Message): Project ID for this request. """ - family = proto.Field(proto.STRING, number=328751972,) - project = proto.Field(proto.STRING, number=227560217,) + family = proto.Field( + proto.STRING, + number=328751972, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) class GetGlobalAddressRequest(proto.Message): @@ -16753,8 +21572,14 @@ class GetGlobalAddressRequest(proto.Message): Project ID for this request. """ - address = proto.Field(proto.STRING, number=462920692,) - project = proto.Field(proto.STRING, number=227560217,) + address = proto.Field( + proto.STRING, + number=462920692, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) class GetGlobalForwardingRuleRequest(proto.Message): @@ -16769,8 +21594,14 @@ class GetGlobalForwardingRuleRequest(proto.Message): Project ID for this request. """ - forwarding_rule = proto.Field(proto.STRING, number=269964030,) - project = proto.Field(proto.STRING, number=227560217,) + forwarding_rule = proto.Field( + proto.STRING, + number=269964030, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) class GetGlobalNetworkEndpointGroupRequest(proto.Message): @@ -16785,8 +21616,14 @@ class GetGlobalNetworkEndpointGroupRequest(proto.Message): Project ID for this request. """ - network_endpoint_group = proto.Field(proto.STRING, number=433907078,) - project = proto.Field(proto.STRING, number=227560217,) + network_endpoint_group = proto.Field( + proto.STRING, + number=433907078, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) class GetGlobalOperationRequest(proto.Message): @@ -16800,8 +21637,14 @@ class GetGlobalOperationRequest(proto.Message): Project ID for this request. """ - operation = proto.Field(proto.STRING, number=52090215,) - project = proto.Field(proto.STRING, number=227560217,) + operation = proto.Field( + proto.STRING, + number=52090215, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) class GetGlobalOrganizationOperationRequest(proto.Message): @@ -16817,8 +21660,15 @@ class GetGlobalOrganizationOperationRequest(proto.Message): This field is a member of `oneof`_ ``_parent_id``. """ - operation = proto.Field(proto.STRING, number=52090215,) - parent_id = proto.Field(proto.STRING, number=459714768, optional=True,) + operation = proto.Field( + proto.STRING, + number=52090215, + ) + parent_id = proto.Field( + proto.STRING, + number=459714768, + optional=True, + ) class GetGlobalPublicDelegatedPrefixeRequest(proto.Message): @@ -16833,8 +21683,14 @@ class GetGlobalPublicDelegatedPrefixeRequest(proto.Message): return. """ - project = proto.Field(proto.STRING, number=227560217,) - public_delegated_prefix = proto.Field(proto.STRING, number=204238440,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + public_delegated_prefix = proto.Field( + proto.STRING, + number=204238440, + ) class GetGuestAttributesInstanceRequest(proto.Message): @@ -16860,11 +21716,28 @@ class GetGuestAttributesInstanceRequest(proto.Message): The name of the zone for this request. """ - instance = proto.Field(proto.STRING, number=18257045,) - project = proto.Field(proto.STRING, number=227560217,) - query_path = proto.Field(proto.STRING, number=368591164, optional=True,) - variable_key = proto.Field(proto.STRING, number=164364828, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + instance = proto.Field( + proto.STRING, + number=18257045, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + query_path = proto.Field( + proto.STRING, + number=368591164, + optional=True, + ) + variable_key = proto.Field( + proto.STRING, + number=164364828, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class GetHealthBackendServiceRequest(proto.Message): @@ -16881,10 +21754,18 @@ class GetHealthBackendServiceRequest(proto.Message): The body resource for this request """ - backend_service = proto.Field(proto.STRING, number=306946058,) - project = proto.Field(proto.STRING, number=227560217,) + backend_service = proto.Field( + proto.STRING, + number=306946058, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) resource_group_reference_resource = proto.Field( - proto.MESSAGE, number=112951123, message="ResourceGroupReference", + proto.MESSAGE, + number=112951123, + message="ResourceGroupReference", ) @@ -16899,8 +21780,14 @@ class GetHealthCheckRequest(proto.Message): Project ID for this request. """ - health_check = proto.Field(proto.STRING, number=308876645,) - project = proto.Field(proto.STRING, number=227560217,) + health_check = proto.Field( + proto.STRING, + number=308876645, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) class GetHealthRegionBackendServiceRequest(proto.Message): @@ -16919,11 +21806,22 @@ class GetHealthRegionBackendServiceRequest(proto.Message): The body resource for this request """ - backend_service = proto.Field(proto.STRING, number=306946058,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + backend_service = proto.Field( + proto.STRING, + number=306946058, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) resource_group_reference_resource = proto.Field( - proto.MESSAGE, number=112951123, message="ResourceGroupReference", + proto.MESSAGE, + number=112951123, + message="ResourceGroupReference", ) @@ -16944,11 +21842,22 @@ class GetHealthTargetPoolRequest(proto.Message): """ instance_reference_resource = proto.Field( - proto.MESSAGE, number=292926060, message="InstanceReference", + proto.MESSAGE, + number=292926060, + message="InstanceReference", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + target_pool = proto.Field( + proto.STRING, + number=62796298, ) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - target_pool = proto.Field(proto.STRING, number=62796298,) class GetIamPolicyDiskRequest(proto.Message): @@ -16969,11 +21878,22 @@ class GetIamPolicyDiskRequest(proto.Message): """ options_requested_policy_version = proto.Field( - proto.INT32, number=499220029, optional=True, + proto.INT32, + number=499220029, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - project = proto.Field(proto.STRING, number=227560217,) - resource = proto.Field(proto.STRING, number=195806222,) - zone = proto.Field(proto.STRING, number=3744684,) class GetIamPolicyFirewallPolicyRequest(proto.Message): @@ -16990,9 +21910,14 @@ class GetIamPolicyFirewallPolicyRequest(proto.Message): """ options_requested_policy_version = proto.Field( - proto.INT32, number=499220029, optional=True, + proto.INT32, + number=499220029, + optional=True, + ) + resource = proto.Field( + proto.STRING, + number=195806222, ) - resource = proto.Field(proto.STRING, number=195806222,) class GetIamPolicyImageRequest(proto.Message): @@ -17011,10 +21936,18 @@ class GetIamPolicyImageRequest(proto.Message): """ options_requested_policy_version = proto.Field( - proto.INT32, number=499220029, optional=True, + proto.INT32, + number=499220029, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, ) - project = proto.Field(proto.STRING, number=227560217,) - resource = proto.Field(proto.STRING, number=195806222,) class GetIamPolicyInstanceRequest(proto.Message): @@ -17035,11 +21968,22 @@ class GetIamPolicyInstanceRequest(proto.Message): """ options_requested_policy_version = proto.Field( - proto.INT32, number=499220029, optional=True, + proto.INT32, + number=499220029, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - project = proto.Field(proto.STRING, number=227560217,) - resource = proto.Field(proto.STRING, number=195806222,) - zone = proto.Field(proto.STRING, number=3744684,) class GetIamPolicyInstanceTemplateRequest(proto.Message): @@ -17058,10 +22002,18 @@ class GetIamPolicyInstanceTemplateRequest(proto.Message): """ options_requested_policy_version = proto.Field( - proto.INT32, number=499220029, optional=True, + proto.INT32, + number=499220029, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, ) - project = proto.Field(proto.STRING, number=227560217,) - resource = proto.Field(proto.STRING, number=195806222,) class GetIamPolicyLicenseRequest(proto.Message): @@ -17080,10 +22032,18 @@ class GetIamPolicyLicenseRequest(proto.Message): """ options_requested_policy_version = proto.Field( - proto.INT32, number=499220029, optional=True, + proto.INT32, + number=499220029, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, ) - project = proto.Field(proto.STRING, number=227560217,) - resource = proto.Field(proto.STRING, number=195806222,) class GetIamPolicyMachineImageRequest(proto.Message): @@ -17102,10 +22062,18 @@ class GetIamPolicyMachineImageRequest(proto.Message): """ options_requested_policy_version = proto.Field( - proto.INT32, number=499220029, optional=True, + proto.INT32, + number=499220029, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, ) - project = proto.Field(proto.STRING, number=227560217,) - resource = proto.Field(proto.STRING, number=195806222,) class GetIamPolicyNodeGroupRequest(proto.Message): @@ -17126,11 +22094,22 @@ class GetIamPolicyNodeGroupRequest(proto.Message): """ options_requested_policy_version = proto.Field( - proto.INT32, number=499220029, optional=True, + proto.INT32, + number=499220029, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - project = proto.Field(proto.STRING, number=227560217,) - resource = proto.Field(proto.STRING, number=195806222,) - zone = proto.Field(proto.STRING, number=3744684,) class GetIamPolicyNodeTemplateRequest(proto.Message): @@ -17151,11 +22130,22 @@ class GetIamPolicyNodeTemplateRequest(proto.Message): """ options_requested_policy_version = proto.Field( - proto.INT32, number=499220029, optional=True, + proto.INT32, + number=499220029, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + resource = proto.Field( + proto.STRING, + number=195806222, ) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - resource = proto.Field(proto.STRING, number=195806222,) class GetIamPolicyRegionDiskRequest(proto.Message): @@ -17176,11 +22166,22 @@ class GetIamPolicyRegionDiskRequest(proto.Message): """ options_requested_policy_version = proto.Field( - proto.INT32, number=499220029, optional=True, + proto.INT32, + number=499220029, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + resource = proto.Field( + proto.STRING, + number=195806222, ) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - resource = proto.Field(proto.STRING, number=195806222,) class GetIamPolicyReservationRequest(proto.Message): @@ -17201,11 +22202,22 @@ class GetIamPolicyReservationRequest(proto.Message): """ options_requested_policy_version = proto.Field( - proto.INT32, number=499220029, optional=True, + proto.INT32, + number=499220029, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - project = proto.Field(proto.STRING, number=227560217,) - resource = proto.Field(proto.STRING, number=195806222,) - zone = proto.Field(proto.STRING, number=3744684,) class GetIamPolicyResourcePolicyRequest(proto.Message): @@ -17226,11 +22238,22 @@ class GetIamPolicyResourcePolicyRequest(proto.Message): """ options_requested_policy_version = proto.Field( - proto.INT32, number=499220029, optional=True, + proto.INT32, + number=499220029, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + resource = proto.Field( + proto.STRING, + number=195806222, ) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - resource = proto.Field(proto.STRING, number=195806222,) class GetIamPolicyServiceAttachmentRequest(proto.Message): @@ -17251,11 +22274,22 @@ class GetIamPolicyServiceAttachmentRequest(proto.Message): """ options_requested_policy_version = proto.Field( - proto.INT32, number=499220029, optional=True, + proto.INT32, + number=499220029, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + resource = proto.Field( + proto.STRING, + number=195806222, ) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - resource = proto.Field(proto.STRING, number=195806222,) class GetIamPolicySnapshotRequest(proto.Message): @@ -17274,10 +22308,18 @@ class GetIamPolicySnapshotRequest(proto.Message): """ options_requested_policy_version = proto.Field( - proto.INT32, number=499220029, optional=True, + proto.INT32, + number=499220029, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, ) - project = proto.Field(proto.STRING, number=227560217,) - resource = proto.Field(proto.STRING, number=195806222,) class GetIamPolicySubnetworkRequest(proto.Message): @@ -17298,11 +22340,22 @@ class GetIamPolicySubnetworkRequest(proto.Message): """ options_requested_policy_version = proto.Field( - proto.INT32, number=499220029, optional=True, + proto.INT32, + number=499220029, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + resource = proto.Field( + proto.STRING, + number=195806222, ) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - resource = proto.Field(proto.STRING, number=195806222,) class GetImageFamilyViewRequest(proto.Message): @@ -17318,9 +22371,18 @@ class GetImageFamilyViewRequest(proto.Message): The name of the zone for this request. """ - family = proto.Field(proto.STRING, number=328751972,) - project = proto.Field(proto.STRING, number=227560217,) - zone = proto.Field(proto.STRING, number=3744684,) + family = proto.Field( + proto.STRING, + number=328751972, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class GetImageRequest(proto.Message): @@ -17334,8 +22396,14 @@ class GetImageRequest(proto.Message): Project ID for this request. """ - image = proto.Field(proto.STRING, number=100313435,) - project = proto.Field(proto.STRING, number=227560217,) + image = proto.Field( + proto.STRING, + number=100313435, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) class GetInstanceGroupManagerRequest(proto.Message): @@ -17352,9 +22420,18 @@ class GetInstanceGroupManagerRequest(proto.Message): instance group is located. """ - instance_group_manager = proto.Field(proto.STRING, number=249363395,) - project = proto.Field(proto.STRING, number=227560217,) - zone = proto.Field(proto.STRING, number=3744684,) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class GetInstanceGroupRequest(proto.Message): @@ -17371,9 +22448,18 @@ class GetInstanceGroupRequest(proto.Message): is located. """ - instance_group = proto.Field(proto.STRING, number=81095253,) - project = proto.Field(proto.STRING, number=227560217,) - zone = proto.Field(proto.STRING, number=3744684,) + instance_group = proto.Field( + proto.STRING, + number=81095253, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class GetInstanceRequest(proto.Message): @@ -17389,9 +22475,18 @@ class GetInstanceRequest(proto.Message): The name of the zone for this request. """ - instance = proto.Field(proto.STRING, number=18257045,) - project = proto.Field(proto.STRING, number=227560217,) - zone = proto.Field(proto.STRING, number=3744684,) + instance = proto.Field( + proto.STRING, + number=18257045, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class GetInstanceTemplateRequest(proto.Message): @@ -17405,8 +22500,14 @@ class GetInstanceTemplateRequest(proto.Message): Project ID for this request. """ - instance_template = proto.Field(proto.STRING, number=309248228,) - project = proto.Field(proto.STRING, number=227560217,) + instance_template = proto.Field( + proto.STRING, + number=309248228, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) class GetInterconnectAttachmentRequest(proto.Message): @@ -17423,9 +22524,18 @@ class GetInterconnectAttachmentRequest(proto.Message): Name of the region for this request. """ - interconnect_attachment = proto.Field(proto.STRING, number=308135284,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + interconnect_attachment = proto.Field( + proto.STRING, + number=308135284, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) class GetInterconnectLocationRequest(proto.Message): @@ -17439,8 +22549,14 @@ class GetInterconnectLocationRequest(proto.Message): Project ID for this request. """ - interconnect_location = proto.Field(proto.STRING, number=492235846,) - project = proto.Field(proto.STRING, number=227560217,) + interconnect_location = proto.Field( + proto.STRING, + number=492235846, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) class GetInterconnectRequest(proto.Message): @@ -17454,8 +22570,14 @@ class GetInterconnectRequest(proto.Message): Project ID for this request. """ - interconnect = proto.Field(proto.STRING, number=224601230,) - project = proto.Field(proto.STRING, number=227560217,) + interconnect = proto.Field( + proto.STRING, + number=224601230, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) class GetLicenseCodeRequest(proto.Message): @@ -17470,8 +22592,14 @@ class GetLicenseCodeRequest(proto.Message): Project ID for this request. """ - license_code = proto.Field(proto.STRING, number=1467179,) - project = proto.Field(proto.STRING, number=227560217,) + license_code = proto.Field( + proto.STRING, + number=1467179, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) class GetLicenseRequest(proto.Message): @@ -17485,8 +22613,14 @@ class GetLicenseRequest(proto.Message): Project ID for this request. """ - license_ = proto.Field(proto.STRING, number=166757441,) - project = proto.Field(proto.STRING, number=227560217,) + license_ = proto.Field( + proto.STRING, + number=166757441, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) class GetMachineImageRequest(proto.Message): @@ -17500,8 +22634,14 @@ class GetMachineImageRequest(proto.Message): Project ID for this request. """ - machine_image = proto.Field(proto.STRING, number=69189475,) - project = proto.Field(proto.STRING, number=227560217,) + machine_image = proto.Field( + proto.STRING, + number=69189475, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) class GetMachineTypeRequest(proto.Message): @@ -17517,9 +22657,18 @@ class GetMachineTypeRequest(proto.Message): The name of the zone for this request. """ - machine_type = proto.Field(proto.STRING, number=227711026,) - project = proto.Field(proto.STRING, number=227560217,) - zone = proto.Field(proto.STRING, number=3744684,) + machine_type = proto.Field( + proto.STRING, + number=227711026, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class GetNatMappingInfoRoutersRequest(proto.Message): @@ -17598,14 +22747,43 @@ class GetNatMappingInfoRoutersRequest(proto.Message): Mapping information of VM endpoints. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) - router = proto.Field(proto.STRING, number=148608841,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) + router = proto.Field( + proto.STRING, + number=148608841, + ) class GetNetworkEndpointGroupRequest(proto.Message): @@ -17624,9 +22802,18 @@ class GetNetworkEndpointGroupRequest(proto.Message): RFC1035. """ - network_endpoint_group = proto.Field(proto.STRING, number=433907078,) - project = proto.Field(proto.STRING, number=227560217,) - zone = proto.Field(proto.STRING, number=3744684,) + network_endpoint_group = proto.Field( + proto.STRING, + number=433907078, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class GetNetworkRequest(proto.Message): @@ -17640,8 +22827,14 @@ class GetNetworkRequest(proto.Message): Project ID for this request. """ - network = proto.Field(proto.STRING, number=232872494,) - project = proto.Field(proto.STRING, number=227560217,) + network = proto.Field( + proto.STRING, + number=232872494, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) class GetNodeGroupRequest(proto.Message): @@ -17657,9 +22850,18 @@ class GetNodeGroupRequest(proto.Message): The name of the zone for this request. """ - node_group = proto.Field(proto.STRING, number=469958146,) - project = proto.Field(proto.STRING, number=227560217,) - zone = proto.Field(proto.STRING, number=3744684,) + node_group = proto.Field( + proto.STRING, + number=469958146, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class GetNodeTemplateRequest(proto.Message): @@ -17675,9 +22877,18 @@ class GetNodeTemplateRequest(proto.Message): The name of the region for this request. """ - node_template = proto.Field(proto.STRING, number=323154455,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + node_template = proto.Field( + proto.STRING, + number=323154455, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) class GetNodeTypeRequest(proto.Message): @@ -17693,9 +22904,18 @@ class GetNodeTypeRequest(proto.Message): The name of the zone for this request. """ - node_type = proto.Field(proto.STRING, number=465832791,) - project = proto.Field(proto.STRING, number=227560217,) - zone = proto.Field(proto.STRING, number=3744684,) + node_type = proto.Field( + proto.STRING, + number=465832791, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class GetPacketMirroringRequest(proto.Message): @@ -17712,9 +22932,18 @@ class GetPacketMirroringRequest(proto.Message): Name of the region for this request. """ - packet_mirroring = proto.Field(proto.STRING, number=22305996,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + packet_mirroring = proto.Field( + proto.STRING, + number=22305996, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) class GetProjectRequest(proto.Message): @@ -17726,7 +22955,10 @@ class GetProjectRequest(proto.Message): Project ID for this request. """ - project = proto.Field(proto.STRING, number=227560217,) + project = proto.Field( + proto.STRING, + number=227560217, + ) class GetPublicAdvertisedPrefixeRequest(proto.Message): @@ -17741,8 +22973,14 @@ class GetPublicAdvertisedPrefixeRequest(proto.Message): to return. """ - project = proto.Field(proto.STRING, number=227560217,) - public_advertised_prefix = proto.Field(proto.STRING, number=101874590,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + public_advertised_prefix = proto.Field( + proto.STRING, + number=101874590, + ) class GetPublicDelegatedPrefixeRequest(proto.Message): @@ -17759,9 +22997,18 @@ class GetPublicDelegatedPrefixeRequest(proto.Message): Name of the region of this request. """ - project = proto.Field(proto.STRING, number=227560217,) - public_delegated_prefix = proto.Field(proto.STRING, number=204238440,) - region = proto.Field(proto.STRING, number=138946292,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + public_delegated_prefix = proto.Field( + proto.STRING, + number=204238440, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) class GetRegionAutoscalerRequest(proto.Message): @@ -17777,9 +23024,18 @@ class GetRegionAutoscalerRequest(proto.Message): Name of the region scoping this request. """ - autoscaler = proto.Field(proto.STRING, number=517258967,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + autoscaler = proto.Field( + proto.STRING, + number=517258967, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) class GetRegionBackendServiceRequest(proto.Message): @@ -17796,9 +23052,18 @@ class GetRegionBackendServiceRequest(proto.Message): Name of the region scoping this request. """ - backend_service = proto.Field(proto.STRING, number=306946058,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + backend_service = proto.Field( + proto.STRING, + number=306946058, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) class GetRegionCommitmentRequest(proto.Message): @@ -17814,9 +23079,18 @@ class GetRegionCommitmentRequest(proto.Message): Name of the region for this request. """ - commitment = proto.Field(proto.STRING, number=482134805,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + commitment = proto.Field( + proto.STRING, + number=482134805, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) class GetRegionDiskRequest(proto.Message): @@ -17833,9 +23107,18 @@ class GetRegionDiskRequest(proto.Message): Name of the region for this request. """ - disk = proto.Field(proto.STRING, number=3083677,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + disk = proto.Field( + proto.STRING, + number=3083677, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) class GetRegionDiskTypeRequest(proto.Message): @@ -17851,9 +23134,18 @@ class GetRegionDiskTypeRequest(proto.Message): The name of the region for this request. """ - disk_type = proto.Field(proto.STRING, number=93009052,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + disk_type = proto.Field( + proto.STRING, + number=93009052, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) class GetRegionHealthCheckRequest(proto.Message): @@ -17869,9 +23161,18 @@ class GetRegionHealthCheckRequest(proto.Message): Name of the region scoping this request. """ - health_check = proto.Field(proto.STRING, number=308876645,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + health_check = proto.Field( + proto.STRING, + number=308876645, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) class GetRegionHealthCheckServiceRequest(proto.Message): @@ -17889,9 +23190,18 @@ class GetRegionHealthCheckServiceRequest(proto.Message): Name of the region scoping this request. """ - health_check_service = proto.Field(proto.STRING, number=408374747,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + health_check_service = proto.Field( + proto.STRING, + number=408374747, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) class GetRegionInstanceGroupManagerRequest(proto.Message): @@ -17907,9 +23217,18 @@ class GetRegionInstanceGroupManagerRequest(proto.Message): Name of the region scoping this request. """ - instance_group_manager = proto.Field(proto.STRING, number=249363395,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) class GetRegionInstanceGroupRequest(proto.Message): @@ -17926,9 +23245,18 @@ class GetRegionInstanceGroupRequest(proto.Message): Name of the region scoping this request. """ - instance_group = proto.Field(proto.STRING, number=81095253,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + instance_group = proto.Field( + proto.STRING, + number=81095253, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) class GetRegionNetworkEndpointGroupRequest(proto.Message): @@ -17947,9 +23275,18 @@ class GetRegionNetworkEndpointGroupRequest(proto.Message): RFC1035. """ - network_endpoint_group = proto.Field(proto.STRING, number=433907078,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + network_endpoint_group = proto.Field( + proto.STRING, + number=433907078, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) class GetRegionNotificationEndpointRequest(proto.Message): @@ -17966,9 +23303,18 @@ class GetRegionNotificationEndpointRequest(proto.Message): Name of the region scoping this request. """ - notification_endpoint = proto.Field(proto.STRING, number=376807017,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + notification_endpoint = proto.Field( + proto.STRING, + number=376807017, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) class GetRegionOperationRequest(proto.Message): @@ -17984,9 +23330,18 @@ class GetRegionOperationRequest(proto.Message): Name of the region for this request. """ - operation = proto.Field(proto.STRING, number=52090215,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + operation = proto.Field( + proto.STRING, + number=52090215, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) class GetRegionRequest(proto.Message): @@ -18000,8 +23355,14 @@ class GetRegionRequest(proto.Message): Name of the region resource to return. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) class GetRegionSslCertificateRequest(proto.Message): @@ -18018,9 +23379,18 @@ class GetRegionSslCertificateRequest(proto.Message): return. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - ssl_certificate = proto.Field(proto.STRING, number=46443492,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + ssl_certificate = proto.Field( + proto.STRING, + number=46443492, + ) class GetRegionTargetHttpProxyRequest(proto.Message): @@ -18037,9 +23407,18 @@ class GetRegionTargetHttpProxyRequest(proto.Message): return. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - target_http_proxy = proto.Field(proto.STRING, number=206872421,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + target_http_proxy = proto.Field( + proto.STRING, + number=206872421, + ) class GetRegionTargetHttpsProxyRequest(proto.Message): @@ -18056,9 +23435,18 @@ class GetRegionTargetHttpsProxyRequest(proto.Message): return. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - target_https_proxy = proto.Field(proto.STRING, number=52336748,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + target_https_proxy = proto.Field( + proto.STRING, + number=52336748, + ) class GetRegionUrlMapRequest(proto.Message): @@ -18074,9 +23462,18 @@ class GetRegionUrlMapRequest(proto.Message): Name of the UrlMap resource to return. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - url_map = proto.Field(proto.STRING, number=367020684,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + url_map = proto.Field( + proto.STRING, + number=367020684, + ) class GetReservationRequest(proto.Message): @@ -18092,9 +23489,18 @@ class GetReservationRequest(proto.Message): Name of the zone for this request. """ - project = proto.Field(proto.STRING, number=227560217,) - reservation = proto.Field(proto.STRING, number=47530956,) - zone = proto.Field(proto.STRING, number=3744684,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + reservation = proto.Field( + proto.STRING, + number=47530956, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class GetResourcePolicyRequest(proto.Message): @@ -18110,9 +23516,18 @@ class GetResourcePolicyRequest(proto.Message): Name of the resource policy to retrieve. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - resource_policy = proto.Field(proto.STRING, number=159240835,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + resource_policy = proto.Field( + proto.STRING, + number=159240835, + ) class GetRouteRequest(proto.Message): @@ -18126,8 +23541,14 @@ class GetRouteRequest(proto.Message): Name of the Route resource to return. """ - project = proto.Field(proto.STRING, number=227560217,) - route = proto.Field(proto.STRING, number=108704329,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + route = proto.Field( + proto.STRING, + number=108704329, + ) class GetRouterRequest(proto.Message): @@ -18143,9 +23564,18 @@ class GetRouterRequest(proto.Message): Name of the Router resource to return. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - router = proto.Field(proto.STRING, number=148608841,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + router = proto.Field( + proto.STRING, + number=148608841, + ) class GetRouterStatusRouterRequest(proto.Message): @@ -18161,9 +23591,18 @@ class GetRouterStatusRouterRequest(proto.Message): Name of the Router resource to query. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - router = proto.Field(proto.STRING, number=148608841,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + router = proto.Field( + proto.STRING, + number=148608841, + ) class GetRuleFirewallPolicyRequest(proto.Message): @@ -18181,8 +23620,15 @@ class GetRuleFirewallPolicyRequest(proto.Message): This field is a member of `oneof`_ ``_priority``. """ - firewall_policy = proto.Field(proto.STRING, number=498173265,) - priority = proto.Field(proto.INT32, number=445151652, optional=True,) + firewall_policy = proto.Field( + proto.STRING, + number=498173265, + ) + priority = proto.Field( + proto.INT32, + number=445151652, + optional=True, + ) class GetRuleSecurityPolicyRequest(proto.Message): @@ -18202,9 +23648,19 @@ class GetRuleSecurityPolicyRequest(proto.Message): queried rule belongs. """ - priority = proto.Field(proto.INT32, number=445151652, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - security_policy = proto.Field(proto.STRING, number=171082513,) + priority = proto.Field( + proto.INT32, + number=445151652, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + security_policy = proto.Field( + proto.STRING, + number=171082513, + ) class GetScreenshotInstanceRequest(proto.Message): @@ -18220,9 +23676,18 @@ class GetScreenshotInstanceRequest(proto.Message): The name of the zone for this request. """ - instance = proto.Field(proto.STRING, number=18257045,) - project = proto.Field(proto.STRING, number=227560217,) - zone = proto.Field(proto.STRING, number=3744684,) + instance = proto.Field( + proto.STRING, + number=18257045, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class GetSecurityPolicyRequest(proto.Message): @@ -18236,8 +23701,14 @@ class GetSecurityPolicyRequest(proto.Message): Name of the security policy to get. """ - project = proto.Field(proto.STRING, number=227560217,) - security_policy = proto.Field(proto.STRING, number=171082513,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + security_policy = proto.Field( + proto.STRING, + number=171082513, + ) class GetSerialPortOutputInstanceRequest(proto.Message): @@ -18276,11 +23747,28 @@ class GetSerialPortOutputInstanceRequest(proto.Message): The name of the zone for this request. """ - instance = proto.Field(proto.STRING, number=18257045,) - port = proto.Field(proto.INT32, number=3446913, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - start = proto.Field(proto.INT64, number=109757538, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + instance = proto.Field( + proto.STRING, + number=18257045, + ) + port = proto.Field( + proto.INT32, + number=3446913, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + start = proto.Field( + proto.INT64, + number=109757538, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class GetServiceAttachmentRequest(proto.Message): @@ -18297,9 +23785,18 @@ class GetServiceAttachmentRequest(proto.Message): return. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - service_attachment = proto.Field(proto.STRING, number=338957549,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + service_attachment = proto.Field( + proto.STRING, + number=338957549, + ) class GetShieldedInstanceIdentityInstanceRequest(proto.Message): @@ -18316,9 +23813,18 @@ class GetShieldedInstanceIdentityInstanceRequest(proto.Message): The name of the zone for this request. """ - instance = proto.Field(proto.STRING, number=18257045,) - project = proto.Field(proto.STRING, number=227560217,) - zone = proto.Field(proto.STRING, number=3744684,) + instance = proto.Field( + proto.STRING, + number=18257045, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class GetSnapshotRequest(proto.Message): @@ -18332,8 +23838,14 @@ class GetSnapshotRequest(proto.Message): Name of the Snapshot resource to return. """ - project = proto.Field(proto.STRING, number=227560217,) - snapshot = proto.Field(proto.STRING, number=284874180,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + snapshot = proto.Field( + proto.STRING, + number=284874180, + ) class GetSslCertificateRequest(proto.Message): @@ -18348,8 +23860,14 @@ class GetSslCertificateRequest(proto.Message): return. """ - project = proto.Field(proto.STRING, number=227560217,) - ssl_certificate = proto.Field(proto.STRING, number=46443492,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + ssl_certificate = proto.Field( + proto.STRING, + number=46443492, + ) class GetSslPolicyRequest(proto.Message): @@ -18365,8 +23883,14 @@ class GetSslPolicyRequest(proto.Message): RFC1035. """ - project = proto.Field(proto.STRING, number=227560217,) - ssl_policy = proto.Field(proto.STRING, number=295190213,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + ssl_policy = proto.Field( + proto.STRING, + number=295190213, + ) class GetStatusVpnGatewayRequest(proto.Message): @@ -18382,9 +23906,18 @@ class GetStatusVpnGatewayRequest(proto.Message): Name of the VPN gateway to return. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - vpn_gateway = proto.Field(proto.STRING, number=406684153,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + vpn_gateway = proto.Field( + proto.STRING, + number=406684153, + ) class GetSubnetworkRequest(proto.Message): @@ -18400,9 +23933,18 @@ class GetSubnetworkRequest(proto.Message): Name of the Subnetwork resource to return. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - subnetwork = proto.Field(proto.STRING, number=307827694,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + subnetwork = proto.Field( + proto.STRING, + number=307827694, + ) class GetTargetGrpcProxyRequest(proto.Message): @@ -18417,8 +23959,14 @@ class GetTargetGrpcProxyRequest(proto.Message): return. """ - project = proto.Field(proto.STRING, number=227560217,) - target_grpc_proxy = proto.Field(proto.STRING, number=5020283,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + target_grpc_proxy = proto.Field( + proto.STRING, + number=5020283, + ) class GetTargetHttpProxyRequest(proto.Message): @@ -18433,8 +23981,14 @@ class GetTargetHttpProxyRequest(proto.Message): return. """ - project = proto.Field(proto.STRING, number=227560217,) - target_http_proxy = proto.Field(proto.STRING, number=206872421,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + target_http_proxy = proto.Field( + proto.STRING, + number=206872421, + ) class GetTargetHttpsProxyRequest(proto.Message): @@ -18449,8 +24003,14 @@ class GetTargetHttpsProxyRequest(proto.Message): return. """ - project = proto.Field(proto.STRING, number=227560217,) - target_https_proxy = proto.Field(proto.STRING, number=52336748,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + target_https_proxy = proto.Field( + proto.STRING, + number=52336748, + ) class GetTargetInstanceRequest(proto.Message): @@ -18467,9 +24027,18 @@ class GetTargetInstanceRequest(proto.Message): Name of the zone scoping this request. """ - project = proto.Field(proto.STRING, number=227560217,) - target_instance = proto.Field(proto.STRING, number=289769347,) - zone = proto.Field(proto.STRING, number=3744684,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + target_instance = proto.Field( + proto.STRING, + number=289769347, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class GetTargetPoolRequest(proto.Message): @@ -18485,9 +24054,18 @@ class GetTargetPoolRequest(proto.Message): Name of the TargetPool resource to return. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - target_pool = proto.Field(proto.STRING, number=62796298,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + target_pool = proto.Field( + proto.STRING, + number=62796298, + ) class GetTargetSslProxyRequest(proto.Message): @@ -18502,8 +24080,14 @@ class GetTargetSslProxyRequest(proto.Message): return. """ - project = proto.Field(proto.STRING, number=227560217,) - target_ssl_proxy = proto.Field(proto.STRING, number=338795853,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + target_ssl_proxy = proto.Field( + proto.STRING, + number=338795853, + ) class GetTargetTcpProxyRequest(proto.Message): @@ -18518,8 +24102,14 @@ class GetTargetTcpProxyRequest(proto.Message): return. """ - project = proto.Field(proto.STRING, number=227560217,) - target_tcp_proxy = proto.Field(proto.STRING, number=503065442,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + target_tcp_proxy = proto.Field( + proto.STRING, + number=503065442, + ) class GetTargetVpnGatewayRequest(proto.Message): @@ -18535,9 +24125,18 @@ class GetTargetVpnGatewayRequest(proto.Message): Name of the target VPN gateway to return. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - target_vpn_gateway = proto.Field(proto.STRING, number=532512843,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + target_vpn_gateway = proto.Field( + proto.STRING, + number=532512843, + ) class GetUrlMapRequest(proto.Message): @@ -18551,8 +24150,14 @@ class GetUrlMapRequest(proto.Message): Name of the UrlMap resource to return. """ - project = proto.Field(proto.STRING, number=227560217,) - url_map = proto.Field(proto.STRING, number=367020684,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + url_map = proto.Field( + proto.STRING, + number=367020684, + ) class GetVpnGatewayRequest(proto.Message): @@ -18568,9 +24173,18 @@ class GetVpnGatewayRequest(proto.Message): Name of the VPN gateway to return. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - vpn_gateway = proto.Field(proto.STRING, number=406684153,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + vpn_gateway = proto.Field( + proto.STRING, + number=406684153, + ) class GetVpnTunnelRequest(proto.Message): @@ -18586,9 +24200,18 @@ class GetVpnTunnelRequest(proto.Message): Name of the VpnTunnel resource to return. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - vpn_tunnel = proto.Field(proto.STRING, number=143821331,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + vpn_tunnel = proto.Field( + proto.STRING, + number=143821331, + ) class GetXpnHostProjectRequest(proto.Message): @@ -18600,7 +24223,10 @@ class GetXpnHostProjectRequest(proto.Message): Project ID for this request. """ - project = proto.Field(proto.STRING, number=227560217,) + project = proto.Field( + proto.STRING, + number=227560217, + ) class GetXpnResourcesProjectsRequest(proto.Message): @@ -18674,12 +24300,35 @@ class GetXpnResourcesProjectsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class GetZoneOperationRequest(proto.Message): @@ -18695,9 +24344,18 @@ class GetZoneOperationRequest(proto.Message): Name of the zone for this request. """ - operation = proto.Field(proto.STRING, number=52090215,) - project = proto.Field(proto.STRING, number=227560217,) - zone = proto.Field(proto.STRING, number=3744684,) + operation = proto.Field( + proto.STRING, + number=52090215, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class GetZoneRequest(proto.Message): @@ -18711,8 +24369,14 @@ class GetZoneRequest(proto.Message): Name of the zone resource to return. """ - project = proto.Field(proto.STRING, number=227560217,) - zone = proto.Field(proto.STRING, number=3744684,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class GlobalNetworkEndpointGroupsAttachEndpointsRequest(proto.Message): @@ -18724,7 +24388,9 @@ class GlobalNetworkEndpointGroupsAttachEndpointsRequest(proto.Message): """ network_endpoints = proto.RepeatedField( - proto.MESSAGE, number=149850285, message="NetworkEndpoint", + proto.MESSAGE, + number=149850285, + message="NetworkEndpoint", ) @@ -18737,7 +24403,9 @@ class GlobalNetworkEndpointGroupsDetachEndpointsRequest(proto.Message): """ network_endpoints = proto.RepeatedField( - proto.MESSAGE, number=149850285, message="NetworkEndpoint", + proto.MESSAGE, + number=149850285, + message="NetworkEndpoint", ) @@ -18765,10 +24433,21 @@ class GlobalOrganizationSetPolicyRequest(proto.Message): This field is a member of `oneof`_ ``_policy``. """ - bindings = proto.RepeatedField(proto.MESSAGE, number=403251854, message="Binding",) - etag = proto.Field(proto.STRING, number=3123477, optional=True,) + bindings = proto.RepeatedField( + proto.MESSAGE, + number=403251854, + message="Binding", + ) + etag = proto.Field( + proto.STRING, + number=3123477, + optional=True, + ) policy = proto.Field( - proto.MESSAGE, number=91071794, optional=True, message="Policy", + proto.MESSAGE, + number=91071794, + optional=True, + message="Policy", ) @@ -18801,8 +24480,16 @@ class GlobalSetLabelsRequest(proto.Message): can also be empty (e.g. "my-label": ""). """ - label_fingerprint = proto.Field(proto.STRING, number=178124825, optional=True,) - labels = proto.MapField(proto.STRING, proto.STRING, number=500195327,) + label_fingerprint = proto.Field( + proto.STRING, + number=178124825, + optional=True, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=500195327, + ) class GlobalSetPolicyRequest(proto.Message): @@ -18829,10 +24516,21 @@ class GlobalSetPolicyRequest(proto.Message): This field is a member of `oneof`_ ``_policy``. """ - bindings = proto.RepeatedField(proto.MESSAGE, number=403251854, message="Binding",) - etag = proto.Field(proto.STRING, number=3123477, optional=True,) + bindings = proto.RepeatedField( + proto.MESSAGE, + number=403251854, + message="Binding", + ) + etag = proto.Field( + proto.STRING, + number=3123477, + optional=True, + ) policy = proto.Field( - proto.MESSAGE, number=91071794, optional=True, message="Policy", + proto.MESSAGE, + number=91071794, + optional=True, + message="Policy", ) @@ -18869,14 +24567,37 @@ class GuestAttributes(proto.Message): This field is a member of `oneof`_ ``_variable_value``. """ - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - query_path = proto.Field(proto.STRING, number=368591164, optional=True,) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + query_path = proto.Field( + proto.STRING, + number=368591164, + optional=True, + ) query_value = proto.Field( - proto.MESSAGE, number=157570874, optional=True, message="GuestAttributesValue", + proto.MESSAGE, + number=157570874, + optional=True, + message="GuestAttributesValue", + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + variable_key = proto.Field( + proto.STRING, + number=164364828, + optional=True, + ) + variable_value = proto.Field( + proto.STRING, + number=124582382, + optional=True, ) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - variable_key = proto.Field(proto.STRING, number=164364828, optional=True,) - variable_value = proto.Field(proto.STRING, number=124582382, optional=True,) class GuestAttributesEntry(proto.Message): @@ -18897,9 +24618,21 @@ class GuestAttributesEntry(proto.Message): This field is a member of `oneof`_ ``_value``. """ - key = proto.Field(proto.STRING, number=106079, optional=True,) - namespace = proto.Field(proto.STRING, number=178476379, optional=True,) - value = proto.Field(proto.STRING, number=111972721, optional=True,) + key = proto.Field( + proto.STRING, + number=106079, + optional=True, + ) + namespace = proto.Field( + proto.STRING, + number=178476379, + optional=True, + ) + value = proto.Field( + proto.STRING, + number=111972721, + optional=True, + ) class GuestAttributesValue(proto.Message): @@ -18911,7 +24644,9 @@ class GuestAttributesValue(proto.Message): """ items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="GuestAttributesEntry", + proto.MESSAGE, + number=100526016, + message="GuestAttributesEntry", ) @@ -18948,7 +24683,11 @@ class Type(proto.Enum): VIRTIO_SCSI_MULTIQUEUE = 201597069 WINDOWS = 456863331 - type_ = proto.Field(proto.STRING, number=3575610, optional=True,) + type_ = proto.Field( + proto.STRING, + number=3575610, + optional=True, + ) class HTTP2HealthCheck(proto.Message): @@ -19031,13 +24770,41 @@ class ProxyHeader(proto.Enum): NONE = 2402104 PROXY_V1 = 334352940 - host = proto.Field(proto.STRING, number=3208616, optional=True,) - port = proto.Field(proto.INT32, number=3446913, optional=True,) - port_name = proto.Field(proto.STRING, number=41534345, optional=True,) - port_specification = proto.Field(proto.STRING, number=51590597, optional=True,) - proxy_header = proto.Field(proto.STRING, number=160374142, optional=True,) - request_path = proto.Field(proto.STRING, number=229403605, optional=True,) - response = proto.Field(proto.STRING, number=196547649, optional=True,) + host = proto.Field( + proto.STRING, + number=3208616, + optional=True, + ) + port = proto.Field( + proto.INT32, + number=3446913, + optional=True, + ) + port_name = proto.Field( + proto.STRING, + number=41534345, + optional=True, + ) + port_specification = proto.Field( + proto.STRING, + number=51590597, + optional=True, + ) + proxy_header = proto.Field( + proto.STRING, + number=160374142, + optional=True, + ) + request_path = proto.Field( + proto.STRING, + number=229403605, + optional=True, + ) + response = proto.Field( + proto.STRING, + number=196547649, + optional=True, + ) class HTTPHealthCheck(proto.Message): @@ -19120,13 +24887,41 @@ class ProxyHeader(proto.Enum): NONE = 2402104 PROXY_V1 = 334352940 - host = proto.Field(proto.STRING, number=3208616, optional=True,) - port = proto.Field(proto.INT32, number=3446913, optional=True,) - port_name = proto.Field(proto.STRING, number=41534345, optional=True,) - port_specification = proto.Field(proto.STRING, number=51590597, optional=True,) - proxy_header = proto.Field(proto.STRING, number=160374142, optional=True,) - request_path = proto.Field(proto.STRING, number=229403605, optional=True,) - response = proto.Field(proto.STRING, number=196547649, optional=True,) + host = proto.Field( + proto.STRING, + number=3208616, + optional=True, + ) + port = proto.Field( + proto.INT32, + number=3446913, + optional=True, + ) + port_name = proto.Field( + proto.STRING, + number=41534345, + optional=True, + ) + port_specification = proto.Field( + proto.STRING, + number=51590597, + optional=True, + ) + proxy_header = proto.Field( + proto.STRING, + number=160374142, + optional=True, + ) + request_path = proto.Field( + proto.STRING, + number=229403605, + optional=True, + ) + response = proto.Field( + proto.STRING, + number=196547649, + optional=True, + ) class HTTPSHealthCheck(proto.Message): @@ -19209,13 +25004,41 @@ class ProxyHeader(proto.Enum): NONE = 2402104 PROXY_V1 = 334352940 - host = proto.Field(proto.STRING, number=3208616, optional=True,) - port = proto.Field(proto.INT32, number=3446913, optional=True,) - port_name = proto.Field(proto.STRING, number=41534345, optional=True,) - port_specification = proto.Field(proto.STRING, number=51590597, optional=True,) - proxy_header = proto.Field(proto.STRING, number=160374142, optional=True,) - request_path = proto.Field(proto.STRING, number=229403605, optional=True,) - response = proto.Field(proto.STRING, number=196547649, optional=True,) + host = proto.Field( + proto.STRING, + number=3208616, + optional=True, + ) + port = proto.Field( + proto.INT32, + number=3446913, + optional=True, + ) + port_name = proto.Field( + proto.STRING, + number=41534345, + optional=True, + ) + port_specification = proto.Field( + proto.STRING, + number=51590597, + optional=True, + ) + proxy_header = proto.Field( + proto.STRING, + number=160374142, + optional=True, + ) + request_path = proto.Field( + proto.STRING, + number=229403605, + optional=True, + ) + response = proto.Field( + proto.STRING, + number=196547649, + optional=True, + ) class HealthCheck(proto.Message): @@ -19348,39 +25171,108 @@ class Type(proto.Enum): SSL = 82412 TCP = 82881 - check_interval_sec = proto.Field(proto.INT32, number=345561006, optional=True,) - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) + check_interval_sec = proto.Field( + proto.INT32, + number=345561006, + optional=True, + ) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) grpc_health_check = proto.Field( - proto.MESSAGE, number=85529574, optional=True, message="GRPCHealthCheck", + proto.MESSAGE, + number=85529574, + optional=True, + message="GRPCHealthCheck", + ) + healthy_threshold = proto.Field( + proto.INT32, + number=403212361, + optional=True, ) - healthy_threshold = proto.Field(proto.INT32, number=403212361, optional=True,) http2_health_check = proto.Field( - proto.MESSAGE, number=11360986, optional=True, message="HTTP2HealthCheck", + proto.MESSAGE, + number=11360986, + optional=True, + message="HTTP2HealthCheck", ) http_health_check = proto.Field( - proto.MESSAGE, number=412586940, optional=True, message="HTTPHealthCheck", + proto.MESSAGE, + number=412586940, + optional=True, + message="HTTPHealthCheck", ) https_health_check = proto.Field( - proto.MESSAGE, number=436046905, optional=True, message="HTTPSHealthCheck", + proto.MESSAGE, + number=436046905, + optional=True, + message="HTTPSHealthCheck", + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, ) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) log_config = proto.Field( - proto.MESSAGE, number=351299741, optional=True, message="HealthCheckLogConfig", + proto.MESSAGE, + number=351299741, + optional=True, + message="HealthCheckLogConfig", + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - region = proto.Field(proto.STRING, number=138946292, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) ssl_health_check = proto.Field( - proto.MESSAGE, number=280032440, optional=True, message="SSLHealthCheck", + proto.MESSAGE, + number=280032440, + optional=True, + message="SSLHealthCheck", ) tcp_health_check = proto.Field( - proto.MESSAGE, number=469980419, optional=True, message="TCPHealthCheck", + proto.MESSAGE, + number=469980419, + optional=True, + message="TCPHealthCheck", + ) + timeout_sec = proto.Field( + proto.INT32, + number=79994995, + optional=True, + ) + type_ = proto.Field( + proto.STRING, + number=3575610, + optional=True, + ) + unhealthy_threshold = proto.Field( + proto.INT32, + number=227958480, + optional=True, ) - timeout_sec = proto.Field(proto.INT32, number=79994995, optional=True,) - type_ = proto.Field(proto.STRING, number=3575610, optional=True,) - unhealthy_threshold = proto.Field(proto.INT32, number=227958480, optional=True,) class HealthCheckList(proto.Message): @@ -19421,13 +25313,36 @@ class HealthCheckList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) - items = proto.RepeatedField(proto.MESSAGE, number=100526016, message="HealthCheck",) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) + items = proto.RepeatedField( + proto.MESSAGE, + number=100526016, + message="HealthCheck", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -19444,7 +25359,11 @@ class HealthCheckLogConfig(proto.Message): This field is a member of `oneof`_ ``_enable``. """ - enable = proto.Field(proto.BOOL, number=311764355, optional=True,) + enable = proto.Field( + proto.BOOL, + number=311764355, + optional=True, + ) class HealthCheckReference(proto.Message): @@ -19460,7 +25379,11 @@ class HealthCheckReference(proto.Message): This field is a member of `oneof`_ ``_health_check``. """ - health_check = proto.Field(proto.STRING, number=308876645, optional=True,) + health_check = proto.Field( + proto.STRING, + number=308876645, + optional=True, + ) class HealthCheckService(proto.Message): @@ -19575,20 +25498,63 @@ class HealthStatusAggregationPolicy(proto.Enum): AND = 64951 NO_AGGREGATION = 426445124 - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) - health_checks = proto.RepeatedField(proto.STRING, number=448370606,) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + fingerprint = proto.Field( + proto.STRING, + number=234678500, + optional=True, + ) + health_checks = proto.RepeatedField( + proto.STRING, + number=448370606, + ) health_status_aggregation_policy = proto.Field( - proto.STRING, number=253163129, optional=True, + proto.STRING, + number=253163129, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + network_endpoint_groups = proto.RepeatedField( + proto.STRING, + number=29346733, + ) + notification_endpoints = proto.RepeatedField( + proto.STRING, + number=406728490, + ) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - network_endpoint_groups = proto.RepeatedField(proto.STRING, number=29346733,) - notification_endpoints = proto.RepeatedField(proto.STRING, number=406728490,) - region = proto.Field(proto.STRING, number=138946292, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) class HealthCheckServiceReference(proto.Message): @@ -19605,7 +25571,11 @@ class HealthCheckServiceReference(proto.Message): This field is a member of `oneof`_ ``_health_check_service``. """ - health_check_service = proto.Field(proto.STRING, number=408374747, optional=True,) + health_check_service = proto.Field( + proto.STRING, + number=408374747, + optional=True, + ) class HealthCheckServicesList(proto.Message): @@ -19648,15 +25618,36 @@ class HealthCheckServicesList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="HealthCheckService", + proto.MESSAGE, + number=100526016, + message="HealthCheckService", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -19700,16 +25691,41 @@ class HealthChecksAggregatedList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.MapField( - proto.STRING, proto.MESSAGE, number=100526016, message="HealthChecksScopedList", + proto.STRING, + proto.MESSAGE, + number=100526016, + message="HealthChecksScopedList", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - unreachables = proto.RepeatedField(proto.STRING, number=243372063,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -19728,10 +25744,15 @@ class HealthChecksScopedList(proto.Message): """ health_checks = proto.RepeatedField( - proto.MESSAGE, number=448370606, message="HealthCheck", + proto.MESSAGE, + number=448370606, + message="HealthCheck", ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -19799,15 +25820,51 @@ class WeightError(proto.Enum): UNAVAILABLE_WEIGHT = 439464295 WEIGHT_NONE = 502428831 - annotations = proto.MapField(proto.STRING, proto.STRING, number=112032548,) - forwarding_rule = proto.Field(proto.STRING, number=269964030, optional=True,) - forwarding_rule_ip = proto.Field(proto.STRING, number=172250632, optional=True,) - health_state = proto.Field(proto.STRING, number=324007150, optional=True,) - instance = proto.Field(proto.STRING, number=18257045, optional=True,) - ip_address = proto.Field(proto.STRING, number=406272220, optional=True,) - port = proto.Field(proto.INT32, number=3446913, optional=True,) - weight = proto.Field(proto.STRING, number=282149496, optional=True,) - weight_error = proto.Field(proto.STRING, number=522501505, optional=True,) + annotations = proto.MapField( + proto.STRING, + proto.STRING, + number=112032548, + ) + forwarding_rule = proto.Field( + proto.STRING, + number=269964030, + optional=True, + ) + forwarding_rule_ip = proto.Field( + proto.STRING, + number=172250632, + optional=True, + ) + health_state = proto.Field( + proto.STRING, + number=324007150, + optional=True, + ) + instance = proto.Field( + proto.STRING, + number=18257045, + optional=True, + ) + ip_address = proto.Field( + proto.STRING, + number=406272220, + optional=True, + ) + port = proto.Field( + proto.INT32, + number=3446913, + optional=True, + ) + weight = proto.Field( + proto.STRING, + number=282149496, + optional=True, + ) + weight_error = proto.Field( + proto.STRING, + number=522501505, + optional=True, + ) class HealthStatusForNetworkEndpoint(proto.Message): @@ -19866,7 +25923,10 @@ class HealthState(proto.Enum): message="ForwardingRuleReference", ) health_check = proto.Field( - proto.MESSAGE, number=308876645, optional=True, message="HealthCheckReference", + proto.MESSAGE, + number=308876645, + optional=True, + message="HealthCheckReference", ) health_check_service = proto.Field( proto.MESSAGE, @@ -19874,7 +25934,11 @@ class HealthState(proto.Enum): optional=True, message="HealthCheckServiceReference", ) - health_state = proto.Field(proto.STRING, number=324007150, optional=True,) + health_state = proto.Field( + proto.STRING, + number=324007150, + optional=True, + ) class HostRule(proto.Message): @@ -19904,9 +25968,20 @@ class HostRule(proto.Message): This field is a member of `oneof`_ ``_path_matcher``. """ - description = proto.Field(proto.STRING, number=422937596, optional=True,) - hosts = proto.RepeatedField(proto.STRING, number=99467211,) - path_matcher = proto.Field(proto.STRING, number=337813272, optional=True,) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + hosts = proto.RepeatedField( + proto.STRING, + number=99467211, + ) + path_matcher = proto.Field( + proto.STRING, + number=337813272, + optional=True, + ) class HttpFaultAbort(proto.Message): @@ -19933,8 +26008,16 @@ class HttpFaultAbort(proto.Message): This field is a member of `oneof`_ ``_percentage``. """ - http_status = proto.Field(proto.UINT32, number=468949897, optional=True,) - percentage = proto.Field(proto.DOUBLE, number=151909018, optional=True,) + http_status = proto.Field( + proto.UINT32, + number=468949897, + optional=True, + ) + percentage = proto.Field( + proto.DOUBLE, + number=151909018, + optional=True, + ) class HttpFaultDelay(proto.Message): @@ -19958,9 +26041,16 @@ class HttpFaultDelay(proto.Message): """ fixed_delay = proto.Field( - proto.MESSAGE, number=317037816, optional=True, message="Duration", + proto.MESSAGE, + number=317037816, + optional=True, + message="Duration", + ) + percentage = proto.Field( + proto.DOUBLE, + number=151909018, + optional=True, ) - percentage = proto.Field(proto.DOUBLE, number=151909018, optional=True,) class HttpFaultInjection(proto.Message): @@ -19987,10 +26077,16 @@ class HttpFaultInjection(proto.Message): """ abort = proto.Field( - proto.MESSAGE, number=92611376, optional=True, message="HttpFaultAbort", + proto.MESSAGE, + number=92611376, + optional=True, + message="HttpFaultAbort", ) delay = proto.Field( - proto.MESSAGE, number=95467907, optional=True, message="HttpFaultDelay", + proto.MESSAGE, + number=95467907, + optional=True, + message="HttpFaultDelay", ) @@ -20017,13 +26113,23 @@ class HttpHeaderAction(proto.Message): """ request_headers_to_add = proto.RepeatedField( - proto.MESSAGE, number=72111974, message="HttpHeaderOption", + proto.MESSAGE, + number=72111974, + message="HttpHeaderOption", + ) + request_headers_to_remove = proto.RepeatedField( + proto.STRING, + number=218425247, ) - request_headers_to_remove = proto.RepeatedField(proto.STRING, number=218425247,) response_headers_to_add = proto.RepeatedField( - proto.MESSAGE, number=32136052, message="HttpHeaderOption", + proto.MESSAGE, + number=32136052, + message="HttpHeaderOption", + ) + response_headers_to_remove = proto.RepeatedField( + proto.STRING, + number=75415761, ) - response_headers_to_remove = proto.RepeatedField(proto.STRING, number=75415761,) class HttpHeaderMatch(proto.Message): @@ -20112,16 +26218,47 @@ class HttpHeaderMatch(proto.Message): This field is a member of `oneof`_ ``_suffix_match``. """ - exact_match = proto.Field(proto.STRING, number=457641093, optional=True,) - header_name = proto.Field(proto.STRING, number=110223613, optional=True,) - invert_match = proto.Field(proto.BOOL, number=501130268, optional=True,) - prefix_match = proto.Field(proto.STRING, number=257898968, optional=True,) - present_match = proto.Field(proto.BOOL, number=67435841, optional=True,) + exact_match = proto.Field( + proto.STRING, + number=457641093, + optional=True, + ) + header_name = proto.Field( + proto.STRING, + number=110223613, + optional=True, + ) + invert_match = proto.Field( + proto.BOOL, + number=501130268, + optional=True, + ) + prefix_match = proto.Field( + proto.STRING, + number=257898968, + optional=True, + ) + present_match = proto.Field( + proto.BOOL, + number=67435841, + optional=True, + ) range_match = proto.Field( - proto.MESSAGE, number=97244227, optional=True, message="Int64RangeMatch", + proto.MESSAGE, + number=97244227, + optional=True, + message="Int64RangeMatch", + ) + regex_match = proto.Field( + proto.STRING, + number=107387853, + optional=True, + ) + suffix_match = proto.Field( + proto.STRING, + number=426488663, + optional=True, ) - regex_match = proto.Field(proto.STRING, number=107387853, optional=True,) - suffix_match = proto.Field(proto.STRING, number=426488663, optional=True,) class HttpHeaderOption(proto.Message): @@ -20147,9 +26284,21 @@ class HttpHeaderOption(proto.Message): This field is a member of `oneof`_ ``_replace``. """ - header_name = proto.Field(proto.STRING, number=110223613, optional=True,) - header_value = proto.Field(proto.STRING, number=203094335, optional=True,) - replace = proto.Field(proto.BOOL, number=20755124, optional=True,) + header_name = proto.Field( + proto.STRING, + number=110223613, + optional=True, + ) + header_value = proto.Field( + proto.STRING, + number=203094335, + optional=True, + ) + replace = proto.Field( + proto.BOOL, + number=20755124, + optional=True, + ) class HttpQueryParameterMatch(proto.Message): @@ -20188,10 +26337,26 @@ class HttpQueryParameterMatch(proto.Message): This field is a member of `oneof`_ ``_regex_match``. """ - exact_match = proto.Field(proto.STRING, number=457641093, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - present_match = proto.Field(proto.BOOL, number=67435841, optional=True,) - regex_match = proto.Field(proto.STRING, number=107387853, optional=True,) + exact_match = proto.Field( + proto.STRING, + number=457641093, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + present_match = proto.Field( + proto.BOOL, + number=67435841, + optional=True, + ) + regex_match = proto.Field( + proto.STRING, + number=107387853, + optional=True, + ) class HttpRedirectAction(proto.Message): @@ -20276,12 +26441,36 @@ class RedirectResponseCode(proto.Enum): SEE_OTHER = 445380580 TEMPORARY_REDIRECT = 489550378 - host_redirect = proto.Field(proto.STRING, number=107417747, optional=True,) - https_redirect = proto.Field(proto.BOOL, number=170260656, optional=True,) - path_redirect = proto.Field(proto.STRING, number=272342710, optional=True,) - prefix_redirect = proto.Field(proto.STRING, number=446184169, optional=True,) - redirect_response_code = proto.Field(proto.STRING, number=436710408, optional=True,) - strip_query = proto.Field(proto.BOOL, number=52284641, optional=True,) + host_redirect = proto.Field( + proto.STRING, + number=107417747, + optional=True, + ) + https_redirect = proto.Field( + proto.BOOL, + number=170260656, + optional=True, + ) + path_redirect = proto.Field( + proto.STRING, + number=272342710, + optional=True, + ) + prefix_redirect = proto.Field( + proto.STRING, + number=446184169, + optional=True, + ) + redirect_response_code = proto.Field( + proto.STRING, + number=436710408, + optional=True, + ) + strip_query = proto.Field( + proto.BOOL, + number=52284641, + optional=True, + ) class HttpRetryPolicy(proto.Message): @@ -20338,11 +26527,21 @@ class HttpRetryPolicy(proto.Message): resource-exhausted - unavailable """ - num_retries = proto.Field(proto.UINT32, number=251680141, optional=True,) + num_retries = proto.Field( + proto.UINT32, + number=251680141, + optional=True, + ) per_try_timeout = proto.Field( - proto.MESSAGE, number=280041147, optional=True, message="Duration", + proto.MESSAGE, + number=280041147, + optional=True, + message="Duration", + ) + retry_conditions = proto.RepeatedField( + proto.STRING, + number=28815535, ) - retry_conditions = proto.RepeatedField(proto.STRING, number=28815535,) class HttpRouteAction(proto.Message): @@ -20441,28 +26640,51 @@ class HttpRouteAction(proto.Message): """ cors_policy = proto.Field( - proto.MESSAGE, number=398943748, optional=True, message="CorsPolicy", + proto.MESSAGE, + number=398943748, + optional=True, + message="CorsPolicy", ) fault_injection_policy = proto.Field( - proto.MESSAGE, number=412781079, optional=True, message="HttpFaultInjection", + proto.MESSAGE, + number=412781079, + optional=True, + message="HttpFaultInjection", ) max_stream_duration = proto.Field( - proto.MESSAGE, number=61428376, optional=True, message="Duration", + proto.MESSAGE, + number=61428376, + optional=True, + message="Duration", ) request_mirror_policy = proto.Field( - proto.MESSAGE, number=220196866, optional=True, message="RequestMirrorPolicy", + proto.MESSAGE, + number=220196866, + optional=True, + message="RequestMirrorPolicy", ) retry_policy = proto.Field( - proto.MESSAGE, number=56799913, optional=True, message="HttpRetryPolicy", + proto.MESSAGE, + number=56799913, + optional=True, + message="HttpRetryPolicy", ) timeout = proto.Field( - proto.MESSAGE, number=296701281, optional=True, message="Duration", + proto.MESSAGE, + number=296701281, + optional=True, + message="Duration", ) url_rewrite = proto.Field( - proto.MESSAGE, number=273333948, optional=True, message="UrlRewrite", + proto.MESSAGE, + number=273333948, + optional=True, + message="UrlRewrite", ) weighted_backend_services = proto.RepeatedField( - proto.MESSAGE, number=337028049, message="WeightedBackendService", + proto.MESSAGE, + number=337028049, + message="WeightedBackendService", ) @@ -20560,20 +26782,43 @@ class HttpRouteRule(proto.Message): This field is a member of `oneof`_ ``_url_redirect``. """ - description = proto.Field(proto.STRING, number=422937596, optional=True,) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) header_action = proto.Field( - proto.MESSAGE, number=328077352, optional=True, message="HttpHeaderAction", + proto.MESSAGE, + number=328077352, + optional=True, + message="HttpHeaderAction", ) match_rules = proto.RepeatedField( - proto.MESSAGE, number=376200701, message="HttpRouteRuleMatch", + proto.MESSAGE, + number=376200701, + message="HttpRouteRuleMatch", + ) + priority = proto.Field( + proto.INT32, + number=445151652, + optional=True, ) - priority = proto.Field(proto.INT32, number=445151652, optional=True,) route_action = proto.Field( - proto.MESSAGE, number=424563948, optional=True, message="HttpRouteAction", + proto.MESSAGE, + number=424563948, + optional=True, + message="HttpRouteAction", + ) + service = proto.Field( + proto.STRING, + number=373540533, + optional=True, ) - service = proto.Field(proto.STRING, number=373540533, optional=True,) url_redirect = proto.Field( - proto.MESSAGE, number=405147820, optional=True, message="HttpRedirectAction", + proto.MESSAGE, + number=405147820, + optional=True, + message="HttpRedirectAction", ) @@ -20654,19 +26899,41 @@ class HttpRouteRuleMatch(proto.Message): This field is a member of `oneof`_ ``_regex_match``. """ - full_path_match = proto.Field(proto.STRING, number=214598875, optional=True,) + full_path_match = proto.Field( + proto.STRING, + number=214598875, + optional=True, + ) header_matches = proto.RepeatedField( - proto.MESSAGE, number=361903489, message="HttpHeaderMatch", + proto.MESSAGE, + number=361903489, + message="HttpHeaderMatch", + ) + ignore_case = proto.Field( + proto.BOOL, + number=464324989, + optional=True, ) - ignore_case = proto.Field(proto.BOOL, number=464324989, optional=True,) metadata_filters = proto.RepeatedField( - proto.MESSAGE, number=464725739, message="MetadataFilter", + proto.MESSAGE, + number=464725739, + message="MetadataFilter", + ) + prefix_match = proto.Field( + proto.STRING, + number=257898968, + optional=True, ) - prefix_match = proto.Field(proto.STRING, number=257898968, optional=True,) query_parameter_matches = proto.RepeatedField( - proto.MESSAGE, number=286231270, message="HttpQueryParameterMatch", + proto.MESSAGE, + number=286231270, + message="HttpQueryParameterMatch", + ) + regex_match = proto.Field( + proto.STRING, + number=107387853, + optional=True, ) - regex_match = proto.Field(proto.STRING, number=107387853, optional=True,) class Image(proto.Message): @@ -20904,53 +27171,165 @@ class Status(proto.Enum): PENDING = 35394935 READY = 77848963 - archive_size_bytes = proto.Field(proto.INT64, number=381093450, optional=True,) - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) + archive_size_bytes = proto.Field( + proto.INT64, + number=381093450, + optional=True, + ) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) deprecated = proto.Field( - proto.MESSAGE, number=515138995, optional=True, message="DeprecationStatus", + proto.MESSAGE, + number=515138995, + optional=True, + message="DeprecationStatus", + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + disk_size_gb = proto.Field( + proto.INT64, + number=316263735, + optional=True, + ) + family = proto.Field( + proto.STRING, + number=328751972, + optional=True, ) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - disk_size_gb = proto.Field(proto.INT64, number=316263735, optional=True,) - family = proto.Field(proto.STRING, number=328751972, optional=True,) guest_os_features = proto.RepeatedField( - proto.MESSAGE, number=79294545, message="GuestOsFeature", + proto.MESSAGE, + number=79294545, + message="GuestOsFeature", + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, ) - id = proto.Field(proto.UINT64, number=3355, optional=True,) image_encryption_key = proto.Field( - proto.MESSAGE, number=379512583, optional=True, message="CustomerEncryptionKey", - ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - label_fingerprint = proto.Field(proto.STRING, number=178124825, optional=True,) - labels = proto.MapField(proto.STRING, proto.STRING, number=500195327,) - license_codes = proto.RepeatedField(proto.INT64, number=45482664,) - licenses = proto.RepeatedField(proto.STRING, number=337642578,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) + proto.MESSAGE, + number=379512583, + optional=True, + message="CustomerEncryptionKey", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + label_fingerprint = proto.Field( + proto.STRING, + number=178124825, + optional=True, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=500195327, + ) + license_codes = proto.RepeatedField( + proto.INT64, + number=45482664, + ) + licenses = proto.RepeatedField( + proto.STRING, + number=337642578, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) raw_disk = proto.Field( - proto.MESSAGE, number=503113556, optional=True, message="RawDisk", + proto.MESSAGE, + number=503113556, + optional=True, + message="RawDisk", + ) + satisfies_pzs = proto.Field( + proto.BOOL, + number=480964267, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - satisfies_pzs = proto.Field(proto.BOOL, number=480964267, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) shielded_instance_initial_state = proto.Field( - proto.MESSAGE, number=192356867, optional=True, message="InitialStateConfig", + proto.MESSAGE, + number=192356867, + optional=True, + message="InitialStateConfig", + ) + source_disk = proto.Field( + proto.STRING, + number=451753793, + optional=True, ) - source_disk = proto.Field(proto.STRING, number=451753793, optional=True,) source_disk_encryption_key = proto.Field( - proto.MESSAGE, number=531501153, optional=True, message="CustomerEncryptionKey", + proto.MESSAGE, + number=531501153, + optional=True, + message="CustomerEncryptionKey", + ) + source_disk_id = proto.Field( + proto.STRING, + number=454190809, + optional=True, + ) + source_image = proto.Field( + proto.STRING, + number=50443319, + optional=True, ) - source_disk_id = proto.Field(proto.STRING, number=454190809, optional=True,) - source_image = proto.Field(proto.STRING, number=50443319, optional=True,) source_image_encryption_key = proto.Field( - proto.MESSAGE, number=381503659, optional=True, message="CustomerEncryptionKey", + proto.MESSAGE, + number=381503659, + optional=True, + message="CustomerEncryptionKey", + ) + source_image_id = proto.Field( + proto.STRING, + number=55328291, + optional=True, + ) + source_snapshot = proto.Field( + proto.STRING, + number=126061928, + optional=True, ) - source_image_id = proto.Field(proto.STRING, number=55328291, optional=True,) - source_snapshot = proto.Field(proto.STRING, number=126061928, optional=True,) source_snapshot_encryption_key = proto.Field( - proto.MESSAGE, number=303679322, optional=True, message="CustomerEncryptionKey", + proto.MESSAGE, + number=303679322, + optional=True, + message="CustomerEncryptionKey", + ) + source_snapshot_id = proto.Field( + proto.STRING, + number=98962258, + optional=True, + ) + source_type = proto.Field( + proto.STRING, + number=452245726, + optional=True, + ) + status = proto.Field( + proto.STRING, + number=181260274, + optional=True, + ) + storage_locations = proto.RepeatedField( + proto.STRING, + number=328005274, ) - source_snapshot_id = proto.Field(proto.STRING, number=98962258, optional=True,) - source_type = proto.Field(proto.STRING, number=452245726, optional=True,) - status = proto.Field(proto.STRING, number=181260274, optional=True,) - storage_locations = proto.RepeatedField(proto.STRING, number=328005274,) class ImageFamilyView(proto.Message): @@ -20966,7 +27345,10 @@ class ImageFamilyView(proto.Message): """ image = proto.Field( - proto.MESSAGE, number=100313435, optional=True, message="Image", + proto.MESSAGE, + number=100313435, + optional=True, + message="Image", ) @@ -21008,13 +27390,36 @@ class ImageList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) - items = proto.RepeatedField(proto.MESSAGE, number=100526016, message="Image",) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) + items = proto.RepeatedField( + proto.MESSAGE, + number=100526016, + message="Image", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -21035,15 +27440,26 @@ class InitialStateConfig(proto.Message): This field is a member of `oneof`_ ``_pk``. """ - dbs = proto.RepeatedField(proto.MESSAGE, number=99253, message="FileContentBuffer",) + dbs = proto.RepeatedField( + proto.MESSAGE, + number=99253, + message="FileContentBuffer", + ) dbxs = proto.RepeatedField( - proto.MESSAGE, number=3077113, message="FileContentBuffer", + proto.MESSAGE, + number=3077113, + message="FileContentBuffer", ) keks = proto.RepeatedField( - proto.MESSAGE, number=3288130, message="FileContentBuffer", + proto.MESSAGE, + number=3288130, + message="FileContentBuffer", ) pk = proto.Field( - proto.MESSAGE, number=3579, optional=True, message="FileContentBuffer", + proto.MESSAGE, + number=3579, + optional=True, + message="FileContentBuffer", ) @@ -21078,10 +27494,24 @@ class InsertAddressRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - address_resource = proto.Field(proto.MESSAGE, number=483888121, message="Address",) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + address_resource = proto.Field( + proto.MESSAGE, + number=483888121, + message="Address", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class InsertAutoscalerRequest(proto.Message): @@ -21116,11 +27546,23 @@ class InsertAutoscalerRequest(proto.Message): """ autoscaler_resource = proto.Field( - proto.MESSAGE, number=207616118, message="Autoscaler", + proto.MESSAGE, + number=207616118, + message="Autoscaler", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) class InsertBackendBucketRequest(proto.Message): @@ -21153,10 +27595,19 @@ class InsertBackendBucketRequest(proto.Message): """ backend_bucket_resource = proto.Field( - proto.MESSAGE, number=380757784, message="BackendBucket", + proto.MESSAGE, + number=380757784, + message="BackendBucket", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class InsertBackendServiceRequest(proto.Message): @@ -21189,10 +27640,19 @@ class InsertBackendServiceRequest(proto.Message): """ backend_service_resource = proto.Field( - proto.MESSAGE, number=347586723, message="BackendService", + proto.MESSAGE, + number=347586723, + message="BackendService", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class InsertDiskRequest(proto.Message): @@ -21231,11 +27691,29 @@ class InsertDiskRequest(proto.Message): The name of the zone for this request. """ - disk_resource = proto.Field(proto.MESSAGE, number=25880688, message="Disk",) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - source_image = proto.Field(proto.STRING, number=50443319, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + disk_resource = proto.Field( + proto.MESSAGE, + number=25880688, + message="Disk", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + source_image = proto.Field( + proto.STRING, + number=50443319, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class InsertExternalVpnGatewayRequest(proto.Message): @@ -21268,10 +27746,19 @@ class InsertExternalVpnGatewayRequest(proto.Message): """ external_vpn_gateway_resource = proto.Field( - proto.MESSAGE, number=486813576, message="ExternalVpnGateway", + proto.MESSAGE, + number=486813576, + message="ExternalVpnGateway", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class InsertFirewallPolicyRequest(proto.Message): @@ -21309,10 +27796,20 @@ class InsertFirewallPolicyRequest(proto.Message): """ firewall_policy_resource = proto.Field( - proto.MESSAGE, number=495049532, message="FirewallPolicy", + proto.MESSAGE, + number=495049532, + message="FirewallPolicy", + ) + parent_id = proto.Field( + proto.STRING, + number=459714768, + optional=True, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - parent_id = proto.Field(proto.STRING, number=459714768, optional=True,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class InsertFirewallRequest(proto.Message): @@ -21344,9 +27841,20 @@ class InsertFirewallRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - firewall_resource = proto.Field(proto.MESSAGE, number=41425005, message="Firewall",) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + firewall_resource = proto.Field( + proto.MESSAGE, + number=41425005, + message="Firewall", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class InsertForwardingRuleRequest(proto.Message): @@ -21381,11 +27889,23 @@ class InsertForwardingRuleRequest(proto.Message): """ forwarding_rule_resource = proto.Field( - proto.MESSAGE, number=301211695, message="ForwardingRule", + proto.MESSAGE, + number=301211695, + message="ForwardingRule", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class InsertGlobalAddressRequest(proto.Message): @@ -21417,9 +27937,20 @@ class InsertGlobalAddressRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - address_resource = proto.Field(proto.MESSAGE, number=483888121, message="Address",) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + address_resource = proto.Field( + proto.MESSAGE, + number=483888121, + message="Address", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class InsertGlobalForwardingRuleRequest(proto.Message): @@ -21452,10 +27983,19 @@ class InsertGlobalForwardingRuleRequest(proto.Message): """ forwarding_rule_resource = proto.Field( - proto.MESSAGE, number=301211695, message="ForwardingRule", + proto.MESSAGE, + number=301211695, + message="ForwardingRule", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class InsertGlobalNetworkEndpointGroupRequest(proto.Message): @@ -21488,10 +28028,19 @@ class InsertGlobalNetworkEndpointGroupRequest(proto.Message): """ network_endpoint_group_resource = proto.Field( - proto.MESSAGE, number=525788839, message="NetworkEndpointGroup", + proto.MESSAGE, + number=525788839, + message="NetworkEndpointGroup", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class InsertGlobalPublicDelegatedPrefixeRequest(proto.Message): @@ -21523,11 +28072,20 @@ class InsertGlobalPublicDelegatedPrefixeRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - project = proto.Field(proto.STRING, number=227560217,) + project = proto.Field( + proto.STRING, + number=227560217, + ) public_delegated_prefix_resource = proto.Field( - proto.MESSAGE, number=47594501, message="PublicDelegatedPrefix", + proto.MESSAGE, + number=47594501, + message="PublicDelegatedPrefix", + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class InsertHealthCheckRequest(proto.Message): @@ -21560,10 +28118,19 @@ class InsertHealthCheckRequest(proto.Message): """ health_check_resource = proto.Field( - proto.MESSAGE, number=201925032, message="HealthCheck", + proto.MESSAGE, + number=201925032, + message="HealthCheck", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class InsertImageRequest(proto.Message): @@ -21599,10 +28166,25 @@ class InsertImageRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - force_create = proto.Field(proto.BOOL, number=197723344, optional=True,) - image_resource = proto.Field(proto.MESSAGE, number=371171954, message="Image",) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + force_create = proto.Field( + proto.BOOL, + number=197723344, + optional=True, + ) + image_resource = proto.Field( + proto.MESSAGE, + number=371171954, + message="Image", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class InsertInstanceGroupManagerRequest(proto.Message): @@ -21638,11 +28220,23 @@ class InsertInstanceGroupManagerRequest(proto.Message): """ instance_group_manager_resource = proto.Field( - proto.MESSAGE, number=261063946, message="InstanceGroupManager", + proto.MESSAGE, + number=261063946, + message="InstanceGroupManager", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) class InsertInstanceGroupRequest(proto.Message): @@ -21678,11 +28272,23 @@ class InsertInstanceGroupRequest(proto.Message): """ instance_group_resource = proto.Field( - proto.MESSAGE, number=286612152, message="InstanceGroup", + proto.MESSAGE, + number=286612152, + message="InstanceGroup", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) class InsertInstanceRequest(proto.Message): @@ -21740,15 +28346,33 @@ class InsertInstanceRequest(proto.Message): """ instance_resource = proto.Field( - proto.MESSAGE, number=215988344, message="Instance", + proto.MESSAGE, + number=215988344, + message="Instance", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) source_instance_template = proto.Field( - proto.STRING, number=332423616, optional=True, + proto.STRING, + number=332423616, + optional=True, + ) + source_machine_image = proto.Field( + proto.STRING, + number=21769791, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - source_machine_image = proto.Field(proto.STRING, number=21769791, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) class InsertInstanceTemplateRequest(proto.Message): @@ -21781,10 +28405,19 @@ class InsertInstanceTemplateRequest(proto.Message): """ instance_template_resource = proto.Field( - proto.MESSAGE, number=10679561, message="InstanceTemplate", + proto.MESSAGE, + number=10679561, + message="InstanceTemplate", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class InsertInterconnectAttachmentRequest(proto.Message): @@ -21823,12 +28456,28 @@ class InsertInterconnectAttachmentRequest(proto.Message): """ interconnect_attachment_resource = proto.Field( - proto.MESSAGE, number=212341369, message="InterconnectAttachment", + proto.MESSAGE, + number=212341369, + message="InterconnectAttachment", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + validate_only = proto.Field( + proto.BOOL, + number=242744629, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - validate_only = proto.Field(proto.BOOL, number=242744629, optional=True,) class InsertInterconnectRequest(proto.Message): @@ -21861,10 +28510,19 @@ class InsertInterconnectRequest(proto.Message): """ interconnect_resource = proto.Field( - proto.MESSAGE, number=397611167, message="Interconnect", + proto.MESSAGE, + number=397611167, + message="Interconnect", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class InsertLicenseRequest(proto.Message): @@ -21896,9 +28554,20 @@ class InsertLicenseRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - license_resource = proto.Field(proto.MESSAGE, number=437955148, message="License",) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + license_resource = proto.Field( + proto.MESSAGE, + number=437955148, + message="License", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class InsertMachineImageRequest(proto.Message): @@ -21936,11 +28605,24 @@ class InsertMachineImageRequest(proto.Message): """ machine_image_resource = proto.Field( - proto.MESSAGE, number=60740970, message="MachineImage", + proto.MESSAGE, + number=60740970, + message="MachineImage", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + source_instance = proto.Field( + proto.STRING, + number=396315705, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - source_instance = proto.Field(proto.STRING, number=396315705, optional=True,) class InsertNetworkEndpointGroupRequest(proto.Message): @@ -21977,11 +28659,23 @@ class InsertNetworkEndpointGroupRequest(proto.Message): """ network_endpoint_group_resource = proto.Field( - proto.MESSAGE, number=525788839, message="NetworkEndpointGroup", + proto.MESSAGE, + number=525788839, + message="NetworkEndpointGroup", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) class InsertNetworkRequest(proto.Message): @@ -22013,9 +28707,20 @@ class InsertNetworkRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - network_resource = proto.Field(proto.MESSAGE, number=122105599, message="Network",) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + network_resource = proto.Field( + proto.MESSAGE, + number=122105599, + message="Network", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class InsertNodeGroupRequest(proto.Message): @@ -22051,13 +28756,28 @@ class InsertNodeGroupRequest(proto.Message): The name of the zone for this request. """ - initial_node_count = proto.Field(proto.INT32, number=71951469,) + initial_node_count = proto.Field( + proto.INT32, + number=71951469, + ) node_group_resource = proto.Field( - proto.MESSAGE, number=505321899, message="NodeGroup", + proto.MESSAGE, + number=505321899, + message="NodeGroup", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) class InsertNodeTemplateRequest(proto.Message): @@ -22092,11 +28812,23 @@ class InsertNodeTemplateRequest(proto.Message): """ node_template_resource = proto.Field( - proto.MESSAGE, number=127364406, message="NodeTemplate", + proto.MESSAGE, + number=127364406, + message="NodeTemplate", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class InsertPacketMirroringRequest(proto.Message): @@ -22131,11 +28863,23 @@ class InsertPacketMirroringRequest(proto.Message): """ packet_mirroring_resource = proto.Field( - proto.MESSAGE, number=493501985, message="PacketMirroring", + proto.MESSAGE, + number=493501985, + message="PacketMirroring", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class InsertPublicAdvertisedPrefixeRequest(proto.Message): @@ -22167,11 +28911,20 @@ class InsertPublicAdvertisedPrefixeRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - project = proto.Field(proto.STRING, number=227560217,) + project = proto.Field( + proto.STRING, + number=227560217, + ) public_advertised_prefix_resource = proto.Field( - proto.MESSAGE, number=233614223, message="PublicAdvertisedPrefix", + proto.MESSAGE, + number=233614223, + message="PublicAdvertisedPrefix", + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class InsertPublicDelegatedPrefixeRequest(proto.Message): @@ -22205,12 +28958,24 @@ class InsertPublicDelegatedPrefixeRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - project = proto.Field(proto.STRING, number=227560217,) + project = proto.Field( + proto.STRING, + number=227560217, + ) public_delegated_prefix_resource = proto.Field( - proto.MESSAGE, number=47594501, message="PublicDelegatedPrefix", + proto.MESSAGE, + number=47594501, + message="PublicDelegatedPrefix", + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class InsertRegionAutoscalerRequest(proto.Message): @@ -22245,11 +29010,23 @@ class InsertRegionAutoscalerRequest(proto.Message): """ autoscaler_resource = proto.Field( - proto.MESSAGE, number=207616118, message="Autoscaler", + proto.MESSAGE, + number=207616118, + message="Autoscaler", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class InsertRegionBackendServiceRequest(proto.Message): @@ -22284,11 +29061,23 @@ class InsertRegionBackendServiceRequest(proto.Message): """ backend_service_resource = proto.Field( - proto.MESSAGE, number=347586723, message="BackendService", + proto.MESSAGE, + number=347586723, + message="BackendService", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class InsertRegionCommitmentRequest(proto.Message): @@ -22323,11 +29112,23 @@ class InsertRegionCommitmentRequest(proto.Message): """ commitment_resource = proto.Field( - proto.MESSAGE, number=244240888, message="Commitment", + proto.MESSAGE, + number=244240888, + message="Commitment", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class InsertRegionDiskRequest(proto.Message): @@ -22366,11 +29167,29 @@ class InsertRegionDiskRequest(proto.Message): This field is a member of `oneof`_ ``_source_image``. """ - disk_resource = proto.Field(proto.MESSAGE, number=25880688, message="Disk",) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - source_image = proto.Field(proto.STRING, number=50443319, optional=True,) + disk_resource = proto.Field( + proto.MESSAGE, + number=25880688, + message="Disk", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + source_image = proto.Field( + proto.STRING, + number=50443319, + optional=True, + ) class InsertRegionHealthCheckRequest(proto.Message): @@ -22405,11 +29224,23 @@ class InsertRegionHealthCheckRequest(proto.Message): """ health_check_resource = proto.Field( - proto.MESSAGE, number=201925032, message="HealthCheck", + proto.MESSAGE, + number=201925032, + message="HealthCheck", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class InsertRegionHealthCheckServiceRequest(proto.Message): @@ -22444,11 +29275,23 @@ class InsertRegionHealthCheckServiceRequest(proto.Message): """ health_check_service_resource = proto.Field( - proto.MESSAGE, number=477367794, message="HealthCheckService", + proto.MESSAGE, + number=477367794, + message="HealthCheckService", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class InsertRegionInstanceGroupManagerRequest(proto.Message): @@ -22483,11 +29326,23 @@ class InsertRegionInstanceGroupManagerRequest(proto.Message): """ instance_group_manager_resource = proto.Field( - proto.MESSAGE, number=261063946, message="InstanceGroupManager", + proto.MESSAGE, + number=261063946, + message="InstanceGroupManager", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class InsertRegionNetworkEndpointGroupRequest(proto.Message): @@ -22524,11 +29379,23 @@ class InsertRegionNetworkEndpointGroupRequest(proto.Message): """ network_endpoint_group_resource = proto.Field( - proto.MESSAGE, number=525788839, message="NetworkEndpointGroup", + proto.MESSAGE, + number=525788839, + message="NetworkEndpointGroup", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class InsertRegionNotificationEndpointRequest(proto.Message): @@ -22563,11 +29430,23 @@ class InsertRegionNotificationEndpointRequest(proto.Message): """ notification_endpoint_resource = proto.Field( - proto.MESSAGE, number=338459940, message="NotificationEndpoint", + proto.MESSAGE, + number=338459940, + message="NotificationEndpoint", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class InsertRegionSslCertificateRequest(proto.Message): @@ -22601,11 +29480,23 @@ class InsertRegionSslCertificateRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) ssl_certificate_resource = proto.Field( - proto.MESSAGE, number=180709897, message="SslCertificate", + proto.MESSAGE, + number=180709897, + message="SslCertificate", ) @@ -22640,11 +29531,23 @@ class InsertRegionTargetHttpProxyRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) target_http_proxy_resource = proto.Field( - proto.MESSAGE, number=24696744, message="TargetHttpProxy", + proto.MESSAGE, + number=24696744, + message="TargetHttpProxy", ) @@ -22679,11 +29582,23 @@ class InsertRegionTargetHttpsProxyRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) target_https_proxy_resource = proto.Field( - proto.MESSAGE, number=433657473, message="TargetHttpsProxy", + proto.MESSAGE, + number=433657473, + message="TargetHttpsProxy", ) @@ -22705,10 +29620,24 @@ class InsertRegionUrlMapRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - url_map_resource = proto.Field(proto.MESSAGE, number=168675425, message="UrlMap",) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + url_map_resource = proto.Field( + proto.MESSAGE, + number=168675425, + message="UrlMap", + ) class InsertReservationRequest(proto.Message): @@ -22742,12 +29671,24 @@ class InsertReservationRequest(proto.Message): Name of the zone for this request. """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) reservation_resource = proto.Field( - proto.MESSAGE, number=285030177, message="Reservation", + proto.MESSAGE, + number=285030177, + message="Reservation", + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - zone = proto.Field(proto.STRING, number=3744684,) class InsertResourcePolicyRequest(proto.Message): @@ -22781,11 +29722,23 @@ class InsertResourcePolicyRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) resource_policy_resource = proto.Field( - proto.MESSAGE, number=76826186, message="ResourcePolicy", + proto.MESSAGE, + number=76826186, + message="ResourcePolicy", ) @@ -22818,9 +29771,20 @@ class InsertRouteRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - route_resource = proto.Field(proto.MESSAGE, number=225428804, message="Route",) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + route_resource = proto.Field( + proto.MESSAGE, + number=225428804, + message="Route", + ) class InsertRouterRequest(proto.Message): @@ -22854,10 +29818,24 @@ class InsertRouterRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - router_resource = proto.Field(proto.MESSAGE, number=155222084, message="Router",) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + router_resource = proto.Field( + proto.MESSAGE, + number=155222084, + message="Router", + ) class InsertSecurityPolicyRequest(proto.Message): @@ -22889,10 +29867,19 @@ class InsertSecurityPolicyRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) security_policy_resource = proto.Field( - proto.MESSAGE, number=216159612, message="SecurityPolicy", + proto.MESSAGE, + number=216159612, + message="SecurityPolicy", ) @@ -22927,11 +29914,23 @@ class InsertServiceAttachmentRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) service_attachment_resource = proto.Field( - proto.MESSAGE, number=472980256, message="ServiceAttachment", + proto.MESSAGE, + number=472980256, + message="ServiceAttachment", ) @@ -22964,10 +29963,19 @@ class InsertSnapshotRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) snapshot_resource = proto.Field( - proto.MESSAGE, number=481319977, message="Snapshot", + proto.MESSAGE, + number=481319977, + message="Snapshot", ) @@ -23000,10 +30008,19 @@ class InsertSslCertificateRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) ssl_certificate_resource = proto.Field( - proto.MESSAGE, number=180709897, message="SslCertificate", + proto.MESSAGE, + number=180709897, + message="SslCertificate", ) @@ -23036,10 +30053,19 @@ class InsertSslPolicyRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) ssl_policy_resource = proto.Field( - proto.MESSAGE, number=274891848, message="SslPolicy", + proto.MESSAGE, + number=274891848, + message="SslPolicy", ) @@ -23074,11 +30100,23 @@ class InsertSubnetworkRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) subnetwork_resource = proto.Field( - proto.MESSAGE, number=42233151, message="Subnetwork", + proto.MESSAGE, + number=42233151, + message="Subnetwork", ) @@ -23111,10 +30149,19 @@ class InsertTargetGrpcProxyRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) target_grpc_proxy_resource = proto.Field( - proto.MESSAGE, number=328922450, message="TargetGrpcProxy", + proto.MESSAGE, + number=328922450, + message="TargetGrpcProxy", ) @@ -23147,10 +30194,19 @@ class InsertTargetHttpProxyRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) target_http_proxy_resource = proto.Field( - proto.MESSAGE, number=24696744, message="TargetHttpProxy", + proto.MESSAGE, + number=24696744, + message="TargetHttpProxy", ) @@ -23183,10 +30239,19 @@ class InsertTargetHttpsProxyRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) target_https_proxy_resource = proto.Field( - proto.MESSAGE, number=433657473, message="TargetHttpsProxy", + proto.MESSAGE, + number=433657473, + message="TargetHttpsProxy", ) @@ -23221,12 +30286,24 @@ class InsertTargetInstanceRequest(proto.Message): Name of the zone scoping this request. """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) target_instance_resource = proto.Field( - proto.MESSAGE, number=430453066, message="TargetInstance", + proto.MESSAGE, + number=430453066, + message="TargetInstance", + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - zone = proto.Field(proto.STRING, number=3744684,) class InsertTargetPoolRequest(proto.Message): @@ -23260,11 +30337,23 @@ class InsertTargetPoolRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) target_pool_resource = proto.Field( - proto.MESSAGE, number=101281443, message="TargetPool", + proto.MESSAGE, + number=101281443, + message="TargetPool", ) @@ -23297,10 +30386,19 @@ class InsertTargetSslProxyRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) target_ssl_proxy_resource = proto.Field( - proto.MESSAGE, number=142016192, message="TargetSslProxy", + proto.MESSAGE, + number=142016192, + message="TargetSslProxy", ) @@ -23333,10 +30431,19 @@ class InsertTargetTcpProxyRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) target_tcp_proxy_resource = proto.Field( - proto.MESSAGE, number=145913931, message="TargetTcpProxy", + proto.MESSAGE, + number=145913931, + message="TargetTcpProxy", ) @@ -23371,11 +30478,23 @@ class InsertTargetVpnGatewayRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) target_vpn_gateway_resource = proto.Field( - proto.MESSAGE, number=498050, message="TargetVpnGateway", + proto.MESSAGE, + number=498050, + message="TargetVpnGateway", ) @@ -23408,9 +30527,20 @@ class InsertUrlMapRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - url_map_resource = proto.Field(proto.MESSAGE, number=168675425, message="UrlMap",) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + url_map_resource = proto.Field( + proto.MESSAGE, + number=168675425, + message="UrlMap", + ) class InsertVpnGatewayRequest(proto.Message): @@ -23444,11 +30574,23 @@ class InsertVpnGatewayRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) vpn_gateway_resource = proto.Field( - proto.MESSAGE, number=182688660, message="VpnGateway", + proto.MESSAGE, + number=182688660, + message="VpnGateway", ) @@ -23483,11 +30625,23 @@ class InsertVpnTunnelRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) vpn_tunnel_resource = proto.Field( - proto.MESSAGE, number=86839482, message="VpnTunnel", + proto.MESSAGE, + number=86839482, + message="VpnTunnel", ) @@ -23780,43 +30934,123 @@ class Status(proto.Enum): optional=True, message="AdvancedMachineFeatures", ) - can_ip_forward = proto.Field(proto.BOOL, number=467731324, optional=True,) + can_ip_forward = proto.Field( + proto.BOOL, + number=467731324, + optional=True, + ) confidential_instance_config = proto.Field( proto.MESSAGE, number=490637685, optional=True, message="ConfidentialInstanceConfig", ) - cpu_platform = proto.Field(proto.STRING, number=410285354, optional=True,) - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - deletion_protection = proto.Field(proto.BOOL, number=458014698, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - disks = proto.RepeatedField(proto.MESSAGE, number=95594102, message="AttachedDisk",) + cpu_platform = proto.Field( + proto.STRING, + number=410285354, + optional=True, + ) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + deletion_protection = proto.Field( + proto.BOOL, + number=458014698, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + disks = proto.RepeatedField( + proto.MESSAGE, + number=95594102, + message="AttachedDisk", + ) display_device = proto.Field( - proto.MESSAGE, number=258933875, optional=True, message="DisplayDevice", + proto.MESSAGE, + number=258933875, + optional=True, + message="DisplayDevice", + ) + fingerprint = proto.Field( + proto.STRING, + number=234678500, + optional=True, ) - fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) guest_accelerators = proto.RepeatedField( - proto.MESSAGE, number=463595119, message="AcceleratorConfig", - ) - hostname = proto.Field(proto.STRING, number=237067315, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - label_fingerprint = proto.Field(proto.STRING, number=178124825, optional=True,) - labels = proto.MapField(proto.STRING, proto.STRING, number=500195327,) - last_start_timestamp = proto.Field(proto.STRING, number=443830736, optional=True,) - last_stop_timestamp = proto.Field(proto.STRING, number=412823010, optional=True,) + proto.MESSAGE, + number=463595119, + message="AcceleratorConfig", + ) + hostname = proto.Field( + proto.STRING, + number=237067315, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + label_fingerprint = proto.Field( + proto.STRING, + number=178124825, + optional=True, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=500195327, + ) + last_start_timestamp = proto.Field( + proto.STRING, + number=443830736, + optional=True, + ) + last_stop_timestamp = proto.Field( + proto.STRING, + number=412823010, + optional=True, + ) last_suspended_timestamp = proto.Field( - proto.STRING, number=356275337, optional=True, + proto.STRING, + number=356275337, + optional=True, + ) + machine_type = proto.Field( + proto.STRING, + number=227711026, + optional=True, ) - machine_type = proto.Field(proto.STRING, number=227711026, optional=True,) metadata = proto.Field( - proto.MESSAGE, number=86866735, optional=True, message="Metadata", + proto.MESSAGE, + number=86866735, + optional=True, + message="Metadata", + ) + min_cpu_platform = proto.Field( + proto.STRING, + number=242912759, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, ) - min_cpu_platform = proto.Field(proto.STRING, number=242912759, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) network_interfaces = proto.RepeatedField( - proto.MESSAGE, number=52735243, message="NetworkInterface", + proto.MESSAGE, + number=52735243, + message="NetworkInterface", ) network_performance_config = proto.Field( proto.MESSAGE, @@ -23825,22 +31059,46 @@ class Status(proto.Enum): message="NetworkPerformanceConfig", ) private_ipv6_google_access = proto.Field( - proto.STRING, number=48277006, optional=True, + proto.STRING, + number=48277006, + optional=True, ) reservation_affinity = proto.Field( - proto.MESSAGE, number=157850683, optional=True, message="ReservationAffinity", + proto.MESSAGE, + number=157850683, + optional=True, + message="ReservationAffinity", + ) + resource_policies = proto.RepeatedField( + proto.STRING, + number=22220385, + ) + satisfies_pzs = proto.Field( + proto.BOOL, + number=480964267, + optional=True, ) - resource_policies = proto.RepeatedField(proto.STRING, number=22220385,) - satisfies_pzs = proto.Field(proto.BOOL, number=480964267, optional=True,) scheduling = proto.Field( - proto.MESSAGE, number=386688404, optional=True, message="Scheduling", + proto.MESSAGE, + number=386688404, + optional=True, + message="Scheduling", + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) service_accounts = proto.RepeatedField( - proto.MESSAGE, number=277537328, message="ServiceAccount", + proto.MESSAGE, + number=277537328, + message="ServiceAccount", ) shielded_instance_config = proto.Field( - proto.MESSAGE, number=12862901, optional=True, message="ShieldedInstanceConfig", + proto.MESSAGE, + number=12862901, + optional=True, + message="ShieldedInstanceConfig", ) shielded_instance_integrity_policy = proto.Field( proto.MESSAGE, @@ -23848,15 +31106,43 @@ class Status(proto.Enum): optional=True, message="ShieldedInstanceIntegrityPolicy", ) - source_machine_image = proto.Field(proto.STRING, number=21769791, optional=True,) + source_machine_image = proto.Field( + proto.STRING, + number=21769791, + optional=True, + ) source_machine_image_encryption_key = proto.Field( - proto.MESSAGE, number=192839075, optional=True, message="CustomerEncryptionKey", + proto.MESSAGE, + number=192839075, + optional=True, + message="CustomerEncryptionKey", + ) + start_restricted = proto.Field( + proto.BOOL, + number=123693144, + optional=True, + ) + status = proto.Field( + proto.STRING, + number=181260274, + optional=True, + ) + status_message = proto.Field( + proto.STRING, + number=297428154, + optional=True, + ) + tags = proto.Field( + proto.MESSAGE, + number=3552281, + optional=True, + message="Tags", + ) + zone = proto.Field( + proto.STRING, + number=3744684, + optional=True, ) - start_restricted = proto.Field(proto.BOOL, number=123693144, optional=True,) - status = proto.Field(proto.STRING, number=181260274, optional=True,) - status_message = proto.Field(proto.STRING, number=297428154, optional=True,) - tags = proto.Field(proto.MESSAGE, number=3552281, optional=True, message="Tags",) - zone = proto.Field(proto.STRING, number=3744684, optional=True,) class InstanceAggregatedList(proto.Message): @@ -23902,16 +31188,41 @@ class InstanceAggregatedList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.MapField( - proto.STRING, proto.MESSAGE, number=100526016, message="InstancesScopedList", + proto.STRING, + proto.MESSAGE, + number=100526016, + message="InstancesScopedList", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - unreachables = proto.RepeatedField(proto.STRING, number=243372063,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -24005,21 +31316,71 @@ class InstanceGroup(proto.Message): This field is a member of `oneof`_ ``_zone``. """ - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + fingerprint = proto.Field( + proto.STRING, + number=234678500, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) named_ports = proto.RepeatedField( - proto.MESSAGE, number=427598732, message="NamedPort", + proto.MESSAGE, + number=427598732, + message="NamedPort", + ) + network = proto.Field( + proto.STRING, + number=232872494, + optional=True, + ) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + size = proto.Field( + proto.INT32, + number=3530753, + optional=True, + ) + subnetwork = proto.Field( + proto.STRING, + number=307827694, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + optional=True, ) - network = proto.Field(proto.STRING, number=232872494, optional=True,) - region = proto.Field(proto.STRING, number=138946292, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - size = proto.Field(proto.INT32, number=3530753, optional=True,) - subnetwork = proto.Field(proto.STRING, number=307827694, optional=True,) - zone = proto.Field(proto.STRING, number=3744684, optional=True,) class InstanceGroupAggregatedList(proto.Message): @@ -24064,19 +31425,41 @@ class InstanceGroupAggregatedList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.MapField( proto.STRING, proto.MESSAGE, number=100526016, message="InstanceGroupsScopedList", ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - unreachables = proto.RepeatedField(proto.STRING, number=243372063,) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -24119,15 +31502,36 @@ class InstanceGroupList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="InstanceGroup", + proto.MESSAGE, + number=100526016, + message="InstanceGroup", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -24282,31 +31686,83 @@ class InstanceGroupManager(proto.Message): number=456799109, message="InstanceGroupManagerAutoHealingPolicy", ) - base_instance_name = proto.Field(proto.STRING, number=389106439, optional=True,) - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) + base_instance_name = proto.Field( + proto.STRING, + number=389106439, + optional=True, + ) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) current_actions = proto.Field( proto.MESSAGE, number=164045879, optional=True, message="InstanceGroupManagerActionsSummary", ) - description = proto.Field(proto.STRING, number=422937596, optional=True,) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) distribution_policy = proto.Field( - proto.MESSAGE, number=534558541, optional=True, message="DistributionPolicy", - ) - fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - instance_group = proto.Field(proto.STRING, number=81095253, optional=True,) - instance_template = proto.Field(proto.STRING, number=309248228, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) + proto.MESSAGE, + number=534558541, + optional=True, + message="DistributionPolicy", + ) + fingerprint = proto.Field( + proto.STRING, + number=234678500, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + instance_group = proto.Field( + proto.STRING, + number=81095253, + optional=True, + ) + instance_template = proto.Field( + proto.STRING, + number=309248228, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) named_ports = proto.RepeatedField( - proto.MESSAGE, number=427598732, message="NamedPort", + proto.MESSAGE, + number=427598732, + message="NamedPort", + ) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - region = proto.Field(proto.STRING, number=138946292, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) stateful_policy = proto.Field( - proto.MESSAGE, number=47538565, optional=True, message="StatefulPolicy", + proto.MESSAGE, + number=47538565, + optional=True, + message="StatefulPolicy", ) status = proto.Field( proto.MESSAGE, @@ -24314,8 +31770,15 @@ class InstanceGroupManager(proto.Message): optional=True, message="InstanceGroupManagerStatus", ) - target_pools = proto.RepeatedField(proto.STRING, number=336072617,) - target_size = proto.Field(proto.INT32, number=62880239, optional=True,) + target_pools = proto.RepeatedField( + proto.STRING, + number=336072617, + ) + target_size = proto.Field( + proto.INT32, + number=62880239, + optional=True, + ) update_policy = proto.Field( proto.MESSAGE, number=175809896, @@ -24323,9 +31786,15 @@ class InstanceGroupManager(proto.Message): message="InstanceGroupManagerUpdatePolicy", ) versions = proto.RepeatedField( - proto.MESSAGE, number=162430619, message="InstanceGroupManagerVersion", + proto.MESSAGE, + number=162430619, + message="InstanceGroupManagerVersion", + ) + zone = proto.Field( + proto.STRING, + number=3744684, + optional=True, ) - zone = proto.Field(proto.STRING, number=3744684, optional=True,) class InstanceGroupManagerActionsSummary(proto.Message): @@ -24424,21 +31893,71 @@ class InstanceGroupManagerActionsSummary(proto.Message): This field is a member of `oneof`_ ``_verifying``. """ - abandoning = proto.Field(proto.INT32, number=440023373, optional=True,) - creating = proto.Field(proto.INT32, number=209809081, optional=True,) + abandoning = proto.Field( + proto.INT32, + number=440023373, + optional=True, + ) + creating = proto.Field( + proto.INT32, + number=209809081, + optional=True, + ) creating_without_retries = proto.Field( - proto.INT32, number=369916745, optional=True, + proto.INT32, + number=369916745, + optional=True, + ) + deleting = proto.Field( + proto.INT32, + number=282846120, + optional=True, + ) + none = proto.Field( + proto.INT32, + number=3387192, + optional=True, + ) + recreating = proto.Field( + proto.INT32, + number=339057132, + optional=True, + ) + refreshing = proto.Field( + proto.INT32, + number=215044903, + optional=True, + ) + restarting = proto.Field( + proto.INT32, + number=372312947, + optional=True, + ) + resuming = proto.Field( + proto.INT32, + number=201100714, + optional=True, + ) + starting = proto.Field( + proto.INT32, + number=243064896, + optional=True, + ) + stopping = proto.Field( + proto.INT32, + number=105035892, + optional=True, + ) + suspending = proto.Field( + proto.INT32, + number=29113894, + optional=True, + ) + verifying = proto.Field( + proto.INT32, + number=451612873, + optional=True, ) - deleting = proto.Field(proto.INT32, number=282846120, optional=True,) - none = proto.Field(proto.INT32, number=3387192, optional=True,) - recreating = proto.Field(proto.INT32, number=339057132, optional=True,) - refreshing = proto.Field(proto.INT32, number=215044903, optional=True,) - restarting = proto.Field(proto.INT32, number=372312947, optional=True,) - resuming = proto.Field(proto.INT32, number=201100714, optional=True,) - starting = proto.Field(proto.INT32, number=243064896, optional=True,) - stopping = proto.Field(proto.INT32, number=105035892, optional=True,) - suspending = proto.Field(proto.INT32, number=29113894, optional=True,) - verifying = proto.Field(proto.INT32, number=451612873, optional=True,) class InstanceGroupManagerAggregatedList(proto.Message): @@ -24484,19 +32003,41 @@ class InstanceGroupManagerAggregatedList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.MapField( proto.STRING, proto.MESSAGE, number=100526016, message="InstanceGroupManagersScopedList", ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - unreachables = proto.RepeatedField(proto.STRING, number=243372063,) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -24522,8 +32063,16 @@ class InstanceGroupManagerAutoHealingPolicy(proto.Message): This field is a member of `oneof`_ ``_initial_delay_sec``. """ - health_check = proto.Field(proto.STRING, number=308876645, optional=True,) - initial_delay_sec = proto.Field(proto.INT32, number=263207002, optional=True,) + health_check = proto.Field( + proto.STRING, + number=308876645, + optional=True, + ) + initial_delay_sec = proto.Field( + proto.INT32, + number=263207002, + optional=True, + ) class InstanceGroupManagerList(proto.Message): @@ -24566,15 +32115,36 @@ class InstanceGroupManagerList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="InstanceGroupManager", + proto.MESSAGE, + number=100526016, + message="InstanceGroupManager", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -24610,8 +32180,16 @@ class InstanceGroupManagerStatus(proto.Message): This field is a member of `oneof`_ ``_version_target``. """ - autoscaler = proto.Field(proto.STRING, number=517258967, optional=True,) - is_stable = proto.Field(proto.BOOL, number=108410864, optional=True,) + autoscaler = proto.Field( + proto.STRING, + number=517258967, + optional=True, + ) + is_stable = proto.Field( + proto.BOOL, + number=108410864, + optional=True, + ) stateful = proto.Field( proto.MESSAGE, number=244462412, @@ -24647,7 +32225,11 @@ class InstanceGroupManagerStatusStateful(proto.Message): This field is a member of `oneof`_ ``_per_instance_configs``. """ - has_stateful_config = proto.Field(proto.BOOL, number=110474224, optional=True,) + has_stateful_config = proto.Field( + proto.BOOL, + number=110474224, + optional=True, + ) per_instance_configs = proto.Field( proto.MESSAGE, number=526265001, @@ -24669,7 +32251,11 @@ class InstanceGroupManagerStatusStatefulPerInstanceConfigs(proto.Message): This field is a member of `oneof`_ ``_all_effective``. """ - all_effective = proto.Field(proto.BOOL, number=516540553, optional=True,) + all_effective = proto.Field( + proto.BOOL, + number=516540553, + optional=True, + ) class InstanceGroupManagerStatusVersionTarget(proto.Message): @@ -24686,7 +32272,11 @@ class InstanceGroupManagerStatusVersionTarget(proto.Message): This field is a member of `oneof`_ ``_is_reached``. """ - is_reached = proto.Field(proto.BOOL, number=433209149, optional=True,) + is_reached = proto.Field( + proto.BOOL, + number=433209149, + optional=True, + ) class InstanceGroupManagerUpdatePolicy(proto.Message): @@ -24785,20 +32375,42 @@ class InstanceGroupManagerUpdatePolicy(proto.Message): """ instance_redistribution_type = proto.Field( - proto.STRING, number=292630424, optional=True, + proto.STRING, + number=292630424, + optional=True, ) max_surge = proto.Field( - proto.MESSAGE, number=302572691, optional=True, message="FixedOrPercent", + proto.MESSAGE, + number=302572691, + optional=True, + message="FixedOrPercent", ) max_unavailable = proto.Field( - proto.MESSAGE, number=404940277, optional=True, message="FixedOrPercent", + proto.MESSAGE, + number=404940277, + optional=True, + message="FixedOrPercent", + ) + minimal_action = proto.Field( + proto.STRING, + number=270567060, + optional=True, ) - minimal_action = proto.Field(proto.STRING, number=270567060, optional=True,) most_disruptive_allowed_action = proto.Field( - proto.STRING, number=66103053, optional=True, + proto.STRING, + number=66103053, + optional=True, + ) + replacement_method = proto.Field( + proto.STRING, + number=505931694, + optional=True, + ) + type_ = proto.Field( + proto.STRING, + number=3575610, + optional=True, ) - replacement_method = proto.Field(proto.STRING, number=505931694, optional=True,) - type_ = proto.Field(proto.STRING, number=3575610, optional=True,) class InstanceGroupManagerVersion(proto.Message): @@ -24838,10 +32450,21 @@ class InstanceGroupManagerVersion(proto.Message): This field is a member of `oneof`_ ``_target_size``. """ - instance_template = proto.Field(proto.STRING, number=309248228, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) + instance_template = proto.Field( + proto.STRING, + number=309248228, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) target_size = proto.Field( - proto.MESSAGE, number=62880239, optional=True, message="FixedOrPercent", + proto.MESSAGE, + number=62880239, + optional=True, + message="FixedOrPercent", ) @@ -24855,7 +32478,10 @@ class InstanceGroupManagersAbandonInstancesRequest(proto.Message): zones/[ZONE]/instances/[INSTANCE_NAME]. """ - instances = proto.RepeatedField(proto.STRING, number=29097598,) + instances = proto.RepeatedField( + proto.STRING, + number=29097598, + ) class InstanceGroupManagersApplyUpdatesRequest(proto.Message): @@ -24901,11 +32527,24 @@ class InstanceGroupManagersApplyUpdatesRequest(proto.Message): This field is a member of `oneof`_ ``_most_disruptive_allowed_action``. """ - all_instances = proto.Field(proto.BOOL, number=403676512, optional=True,) - instances = proto.RepeatedField(proto.STRING, number=29097598,) - minimal_action = proto.Field(proto.STRING, number=270567060, optional=True,) + all_instances = proto.Field( + proto.BOOL, + number=403676512, + optional=True, + ) + instances = proto.RepeatedField( + proto.STRING, + number=29097598, + ) + minimal_action = proto.Field( + proto.STRING, + number=270567060, + optional=True, + ) most_disruptive_allowed_action = proto.Field( - proto.STRING, number=66103053, optional=True, + proto.STRING, + number=66103053, + optional=True, ) @@ -24918,7 +32557,9 @@ class InstanceGroupManagersCreateInstancesRequest(proto.Message): """ instances = proto.RepeatedField( - proto.MESSAGE, number=29097598, message="PerInstanceConfig", + proto.MESSAGE, + number=29097598, + message="PerInstanceConfig", ) @@ -24944,9 +32585,14 @@ class InstanceGroupManagersDeleteInstancesRequest(proto.Message): This field is a member of `oneof`_ ``_skip_instances_on_validation_error``. """ - instances = proto.RepeatedField(proto.STRING, number=29097598,) + instances = proto.RepeatedField( + proto.STRING, + number=29097598, + ) skip_instances_on_validation_error = proto.Field( - proto.BOOL, number=40631073, optional=True, + proto.BOOL, + number=40631073, + optional=True, ) @@ -24960,7 +32606,10 @@ class InstanceGroupManagersDeletePerInstanceConfigsReq(proto.Message): instance group. """ - names = proto.RepeatedField(proto.STRING, number=104585032,) + names = proto.RepeatedField( + proto.STRING, + number=104585032, + ) class InstanceGroupManagersListErrorsResponse(proto.Message): @@ -24986,9 +32635,15 @@ def raw_page(self): return self items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="InstanceManagedByIgmError", + proto.MESSAGE, + number=100526016, + message="InstanceManagedByIgmError", + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, ) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) class InstanceGroupManagersListManagedInstancesResponse(proto.Message): @@ -25014,9 +32669,15 @@ def raw_page(self): return self managed_instances = proto.RepeatedField( - proto.MESSAGE, number=336219614, message="ManagedInstance", + proto.MESSAGE, + number=336219614, + message="ManagedInstance", + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, ) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) class InstanceGroupManagersListPerInstanceConfigsResp(proto.Message): @@ -25045,11 +32706,20 @@ def raw_page(self): return self items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="PerInstanceConfig", + proto.MESSAGE, + number=100526016, + message="PerInstanceConfig", + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, ) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -25063,7 +32733,9 @@ class InstanceGroupManagersPatchPerInstanceConfigsReq(proto.Message): """ per_instance_configs = proto.RepeatedField( - proto.MESSAGE, number=526265001, message="PerInstanceConfig", + proto.MESSAGE, + number=526265001, + message="PerInstanceConfig", ) @@ -25077,7 +32749,10 @@ class InstanceGroupManagersRecreateInstancesRequest(proto.Message): zones/[ZONE]/instances/[INSTANCE_NAME]. """ - instances = proto.RepeatedField(proto.STRING, number=29097598,) + instances = proto.RepeatedField( + proto.STRING, + number=29097598, + ) class InstanceGroupManagersScopedList(proto.Message): @@ -25095,10 +32770,15 @@ class InstanceGroupManagersScopedList(proto.Message): """ instance_group_managers = proto.RepeatedField( - proto.MESSAGE, number=214072592, message="InstanceGroupManager", + proto.MESSAGE, + number=214072592, + message="InstanceGroupManager", ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -25119,7 +32799,11 @@ class InstanceGroupManagersSetInstanceTemplateRequest(proto.Message): This field is a member of `oneof`_ ``_instance_template``. """ - instance_template = proto.Field(proto.STRING, number=309248228, optional=True,) + instance_template = proto.Field( + proto.STRING, + number=309248228, + optional=True, + ) class InstanceGroupManagersSetTargetPoolsRequest(proto.Message): @@ -25147,8 +32831,15 @@ class InstanceGroupManagersSetTargetPoolsRequest(proto.Message): group all receive these target pool settings. """ - fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) - target_pools = proto.RepeatedField(proto.STRING, number=336072617,) + fingerprint = proto.Field( + proto.STRING, + number=234678500, + optional=True, + ) + target_pools = proto.RepeatedField( + proto.STRING, + number=336072617, + ) class InstanceGroupManagersUpdatePerInstanceConfigsReq(proto.Message): @@ -25161,7 +32852,9 @@ class InstanceGroupManagersUpdatePerInstanceConfigsReq(proto.Message): """ per_instance_configs = proto.RepeatedField( - proto.MESSAGE, number=526265001, message="PerInstanceConfig", + proto.MESSAGE, + number=526265001, + message="PerInstanceConfig", ) @@ -25175,7 +32868,9 @@ class InstanceGroupsAddInstancesRequest(proto.Message): """ instances = proto.RepeatedField( - proto.MESSAGE, number=29097598, message="InstanceReference", + proto.MESSAGE, + number=29097598, + message="InstanceReference", ) @@ -25219,15 +32914,36 @@ class InstanceGroupsListInstances(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="InstanceWithNamedPorts", + proto.MESSAGE, + number=100526016, + message="InstanceWithNamedPorts", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -25256,7 +32972,11 @@ class InstanceState(proto.Enum): ALL = 64897 RUNNING = 121282975 - instance_state = proto.Field(proto.STRING, number=92223591, optional=True,) + instance_state = proto.Field( + proto.STRING, + number=92223591, + optional=True, + ) class InstanceGroupsRemoveInstancesRequest(proto.Message): @@ -25269,7 +32989,9 @@ class InstanceGroupsRemoveInstancesRequest(proto.Message): """ instances = proto.RepeatedField( - proto.MESSAGE, number=29097598, message="InstanceReference", + proto.MESSAGE, + number=29097598, + message="InstanceReference", ) @@ -25288,10 +33010,15 @@ class InstanceGroupsScopedList(proto.Message): """ instance_groups = proto.RepeatedField( - proto.MESSAGE, number=366469310, message="InstanceGroup", + proto.MESSAGE, + number=366469310, + message="InstanceGroup", ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -25318,9 +33045,15 @@ class InstanceGroupsSetNamedPortsRequest(proto.Message): instance group. """ - fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) + fingerprint = proto.Field( + proto.STRING, + number=234678500, + optional=True, + ) named_ports = proto.RepeatedField( - proto.MESSAGE, number=427598732, message="NamedPort", + proto.MESSAGE, + number=427598732, + message="NamedPort", ) @@ -25363,13 +33096,36 @@ class InstanceList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) - items = proto.RepeatedField(proto.MESSAGE, number=100526016, message="Instance",) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) + items = proto.RepeatedField( + proto.MESSAGE, + number=100526016, + message="Instance", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -25413,13 +33169,36 @@ class InstanceListReferrers(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) - items = proto.RepeatedField(proto.MESSAGE, number=100526016, message="Reference",) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) + items = proto.RepeatedField( + proto.MESSAGE, + number=100526016, + message="Reference", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -25456,7 +33235,11 @@ class InstanceManagedByIgmError(proto.Message): optional=True, message="InstanceManagedByIgmErrorInstanceActionDetails", ) - timestamp = proto.Field(proto.STRING, number=55126294, optional=True,) + timestamp = proto.Field( + proto.STRING, + number=55126294, + optional=True, + ) class InstanceManagedByIgmErrorInstanceActionDetails(proto.Message): @@ -25504,8 +33287,16 @@ class Action(proto.Enum): SUSPENDING = 514206246 VERIFYING = 16982185 - action = proto.Field(proto.STRING, number=187661878, optional=True,) - instance = proto.Field(proto.STRING, number=18257045, optional=True,) + action = proto.Field( + proto.STRING, + number=187661878, + optional=True, + ) + instance = proto.Field( + proto.STRING, + number=18257045, + optional=True, + ) version = proto.Field( proto.MESSAGE, number=351608024, @@ -25528,8 +33319,16 @@ class InstanceManagedByIgmErrorManagedInstanceError(proto.Message): This field is a member of `oneof`_ ``_message``. """ - code = proto.Field(proto.STRING, number=3059181, optional=True,) - message = proto.Field(proto.STRING, number=418054151, optional=True,) + code = proto.Field( + proto.STRING, + number=3059181, + optional=True, + ) + message = proto.Field( + proto.STRING, + number=418054151, + optional=True, + ) class InstanceMoveRequest(proto.Message): @@ -25557,8 +33356,16 @@ class InstanceMoveRequest(proto.Message): This field is a member of `oneof`_ ``_target_instance``. """ - destination_zone = proto.Field(proto.STRING, number=131854653, optional=True,) - target_instance = proto.Field(proto.STRING, number=289769347, optional=True,) + destination_zone = proto.Field( + proto.STRING, + number=131854653, + optional=True, + ) + target_instance = proto.Field( + proto.STRING, + number=289769347, + optional=True, + ) class InstanceProperties(proto.Message): @@ -25707,26 +33514,57 @@ class PrivateIpv6GoogleAccess(proto.Enum): optional=True, message="AdvancedMachineFeatures", ) - can_ip_forward = proto.Field(proto.BOOL, number=467731324, optional=True,) + can_ip_forward = proto.Field( + proto.BOOL, + number=467731324, + optional=True, + ) confidential_instance_config = proto.Field( proto.MESSAGE, number=490637685, optional=True, message="ConfidentialInstanceConfig", ) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - disks = proto.RepeatedField(proto.MESSAGE, number=95594102, message="AttachedDisk",) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + disks = proto.RepeatedField( + proto.MESSAGE, + number=95594102, + message="AttachedDisk", + ) guest_accelerators = proto.RepeatedField( - proto.MESSAGE, number=463595119, message="AcceleratorConfig", + proto.MESSAGE, + number=463595119, + message="AcceleratorConfig", + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=500195327, + ) + machine_type = proto.Field( + proto.STRING, + number=227711026, + optional=True, ) - labels = proto.MapField(proto.STRING, proto.STRING, number=500195327,) - machine_type = proto.Field(proto.STRING, number=227711026, optional=True,) metadata = proto.Field( - proto.MESSAGE, number=86866735, optional=True, message="Metadata", + proto.MESSAGE, + number=86866735, + optional=True, + message="Metadata", + ) + min_cpu_platform = proto.Field( + proto.STRING, + number=242912759, + optional=True, ) - min_cpu_platform = proto.Field(proto.STRING, number=242912759, optional=True,) network_interfaces = proto.RepeatedField( - proto.MESSAGE, number=52735243, message="NetworkInterface", + proto.MESSAGE, + number=52735243, + message="NetworkInterface", ) network_performance_config = proto.Field( proto.MESSAGE, @@ -25735,25 +33573,48 @@ class PrivateIpv6GoogleAccess(proto.Enum): message="NetworkPerformanceConfig", ) private_ipv6_google_access = proto.Field( - proto.STRING, number=48277006, optional=True, + proto.STRING, + number=48277006, + optional=True, ) reservation_affinity = proto.Field( - proto.MESSAGE, number=157850683, optional=True, message="ReservationAffinity", + proto.MESSAGE, + number=157850683, + optional=True, + message="ReservationAffinity", ) resource_manager_tags = proto.MapField( - proto.STRING, proto.STRING, number=377671164, + proto.STRING, + proto.STRING, + number=377671164, + ) + resource_policies = proto.RepeatedField( + proto.STRING, + number=22220385, ) - resource_policies = proto.RepeatedField(proto.STRING, number=22220385,) scheduling = proto.Field( - proto.MESSAGE, number=386688404, optional=True, message="Scheduling", + proto.MESSAGE, + number=386688404, + optional=True, + message="Scheduling", ) service_accounts = proto.RepeatedField( - proto.MESSAGE, number=277537328, message="ServiceAccount", + proto.MESSAGE, + number=277537328, + message="ServiceAccount", ) shielded_instance_config = proto.Field( - proto.MESSAGE, number=12862901, optional=True, message="ShieldedInstanceConfig", + proto.MESSAGE, + number=12862901, + optional=True, + message="ShieldedInstanceConfig", + ) + tags = proto.Field( + proto.MESSAGE, + number=3552281, + optional=True, + message="Tags", ) - tags = proto.Field(proto.MESSAGE, number=3552281, optional=True, message="Tags",) class InstanceReference(proto.Message): @@ -25767,7 +33628,11 @@ class InstanceReference(proto.Message): This field is a member of `oneof`_ ``_instance``. """ - instance = proto.Field(proto.STRING, number=18257045, optional=True,) + instance = proto.Field( + proto.STRING, + number=18257045, + optional=True, + ) class InstanceTemplate(proto.Message): @@ -25835,18 +33700,52 @@ class InstanceTemplate(proto.Message): This field is a member of `oneof`_ ``_source_instance_params``. """ - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) properties = proto.Field( - proto.MESSAGE, number=147688755, optional=True, message="InstanceProperties", + proto.MESSAGE, + number=147688755, + optional=True, + message="InstanceProperties", + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + source_instance = proto.Field( + proto.STRING, + number=396315705, + optional=True, ) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - source_instance = proto.Field(proto.STRING, number=396315705, optional=True,) source_instance_params = proto.Field( - proto.MESSAGE, number=135342156, optional=True, message="SourceInstanceParams", + proto.MESSAGE, + number=135342156, + optional=True, + message="SourceInstanceParams", ) @@ -25890,15 +33789,36 @@ class InstanceTemplateList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="InstanceTemplate", + proto.MESSAGE, + number=100526016, + message="InstanceTemplate", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -25934,11 +33854,21 @@ class Status(proto.Enum): SUSPENDING = 514206246 TERMINATED = 250018339 - instance = proto.Field(proto.STRING, number=18257045, optional=True,) + instance = proto.Field( + proto.STRING, + number=18257045, + optional=True, + ) named_ports = proto.RepeatedField( - proto.MESSAGE, number=427598732, message="NamedPort", + proto.MESSAGE, + number=427598732, + message="NamedPort", + ) + status = proto.Field( + proto.STRING, + number=181260274, + optional=True, ) - status = proto.Field(proto.STRING, number=181260274, optional=True,) class InstancesAddResourcePoliciesRequest(proto.Message): @@ -25950,7 +33880,10 @@ class InstancesAddResourcePoliciesRequest(proto.Message): instance. """ - resource_policies = proto.RepeatedField(proto.STRING, number=22220385,) + resource_policies = proto.RepeatedField( + proto.STRING, + number=22220385, + ) class InstancesGetEffectiveFirewallsResponse(proto.Message): @@ -25969,7 +33902,9 @@ class InstancesGetEffectiveFirewallsResponse(proto.Message): message="InstancesGetEffectiveFirewallsResponseEffectiveFirewallPolicy", ) firewalls = proto.RepeatedField( - proto.MESSAGE, number=272245619, message="Firewall", + proto.MESSAGE, + number=272245619, + message="Firewall", ) @@ -26005,13 +33940,31 @@ class Type(proto.Enum): HIERARCHY = 69902869 UNSPECIFIED = 526786327 - display_name = proto.Field(proto.STRING, number=4473832, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) + display_name = proto.Field( + proto.STRING, + number=4473832, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) rules = proto.RepeatedField( - proto.MESSAGE, number=108873975, message="FirewallPolicyRule", + proto.MESSAGE, + number=108873975, + message="FirewallPolicyRule", + ) + short_name = proto.Field( + proto.STRING, + number=492051566, + optional=True, + ) + type_ = proto.Field( + proto.STRING, + number=3575610, + optional=True, ) - short_name = proto.Field(proto.STRING, number=492051566, optional=True,) - type_ = proto.Field(proto.STRING, number=3575610, optional=True,) class InstancesRemoveResourcePoliciesRequest(proto.Message): @@ -26023,7 +33976,10 @@ class InstancesRemoveResourcePoliciesRequest(proto.Message): instance. """ - resource_policies = proto.RepeatedField(proto.STRING, number=22220385,) + resource_policies = proto.RepeatedField( + proto.STRING, + number=22220385, + ) class InstancesScopedList(proto.Message): @@ -26039,9 +33995,16 @@ class InstancesScopedList(proto.Message): This field is a member of `oneof`_ ``_warning``. """ - instances = proto.RepeatedField(proto.MESSAGE, number=29097598, message="Instance",) + instances = proto.RepeatedField( + proto.MESSAGE, + number=29097598, + message="Instance", + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -26060,8 +34023,16 @@ class InstancesSetLabelsRequest(proto.Message): """ - label_fingerprint = proto.Field(proto.STRING, number=178124825, optional=True,) - labels = proto.MapField(proto.STRING, proto.STRING, number=500195327,) + label_fingerprint = proto.Field( + proto.STRING, + number=178124825, + optional=True, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=500195327, + ) class InstancesSetMachineResourcesRequest(proto.Message): @@ -26074,7 +34045,9 @@ class InstancesSetMachineResourcesRequest(proto.Message): """ guest_accelerators = proto.RepeatedField( - proto.MESSAGE, number=463595119, message="AcceleratorConfig", + proto.MESSAGE, + number=463595119, + message="AcceleratorConfig", ) @@ -26091,7 +34064,11 @@ class InstancesSetMachineTypeRequest(proto.Message): This field is a member of `oneof`_ ``_machine_type``. """ - machine_type = proto.Field(proto.STRING, number=227711026, optional=True,) + machine_type = proto.Field( + proto.STRING, + number=227711026, + optional=True, + ) class InstancesSetMinCpuPlatformRequest(proto.Message): @@ -26105,7 +34082,11 @@ class InstancesSetMinCpuPlatformRequest(proto.Message): This field is a member of `oneof`_ ``_min_cpu_platform``. """ - min_cpu_platform = proto.Field(proto.STRING, number=242912759, optional=True,) + min_cpu_platform = proto.Field( + proto.STRING, + number=242912759, + optional=True, + ) class InstancesSetServiceAccountRequest(proto.Message): @@ -26121,8 +34102,15 @@ class InstancesSetServiceAccountRequest(proto.Message): this service account. """ - email = proto.Field(proto.STRING, number=96619420, optional=True,) - scopes = proto.RepeatedField(proto.STRING, number=165973151,) + email = proto.Field( + proto.STRING, + number=96619420, + optional=True, + ) + scopes = proto.RepeatedField( + proto.STRING, + number=165973151, + ) class InstancesStartWithEncryptionKeyRequest(proto.Message): @@ -26140,7 +34128,9 @@ class InstancesStartWithEncryptionKeyRequest(proto.Message): """ disks = proto.RepeatedField( - proto.MESSAGE, number=95594102, message="CustomerEncryptionKeyProtectedDisk", + proto.MESSAGE, + number=95594102, + message="CustomerEncryptionKeyProtectedDisk", ) @@ -26161,8 +34151,16 @@ class Int64RangeMatch(proto.Message): This field is a member of `oneof`_ ``_range_start``. """ - range_end = proto.Field(proto.INT64, number=322439897, optional=True,) - range_start = proto.Field(proto.INT64, number=103333600, optional=True,) + range_end = proto.Field( + proto.INT64, + number=322439897, + optional=True, + ) + range_start = proto.Field( + proto.INT64, + number=103333600, + optional=True, + ) class Interconnect(proto.Message): @@ -26379,33 +34377,120 @@ class State(proto.Enum): ACTIVE = 314733318 UNPROVISIONED = 517333979 - admin_enabled = proto.Field(proto.BOOL, number=445675089, optional=True,) + admin_enabled = proto.Field( + proto.BOOL, + number=445675089, + optional=True, + ) circuit_infos = proto.RepeatedField( - proto.MESSAGE, number=164839855, message="InterconnectCircuitInfo", + proto.MESSAGE, + number=164839855, + message="InterconnectCircuitInfo", + ) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + customer_name = proto.Field( + proto.STRING, + number=3665484, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, ) - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - customer_name = proto.Field(proto.STRING, number=3665484, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) expected_outages = proto.RepeatedField( - proto.MESSAGE, number=264484123, message="InterconnectOutageNotification", - ) - google_ip_address = proto.Field(proto.STRING, number=443105954, optional=True,) - google_reference_id = proto.Field(proto.STRING, number=534944469, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - interconnect_attachments = proto.RepeatedField(proto.STRING, number=425388415,) - interconnect_type = proto.Field(proto.STRING, number=515165259, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - link_type = proto.Field(proto.STRING, number=523207775, optional=True,) - location = proto.Field(proto.STRING, number=290430901, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - noc_contact_email = proto.Field(proto.STRING, number=14072832, optional=True,) - operational_status = proto.Field(proto.STRING, number=201070847, optional=True,) - peer_ip_address = proto.Field(proto.STRING, number=207735769, optional=True,) - provisioned_link_count = proto.Field(proto.INT32, number=410888565, optional=True,) - requested_link_count = proto.Field(proto.INT32, number=45051387, optional=True,) - satisfies_pzs = proto.Field(proto.BOOL, number=480964267, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - state = proto.Field(proto.STRING, number=109757585, optional=True,) + proto.MESSAGE, + number=264484123, + message="InterconnectOutageNotification", + ) + google_ip_address = proto.Field( + proto.STRING, + number=443105954, + optional=True, + ) + google_reference_id = proto.Field( + proto.STRING, + number=534944469, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + interconnect_attachments = proto.RepeatedField( + proto.STRING, + number=425388415, + ) + interconnect_type = proto.Field( + proto.STRING, + number=515165259, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + link_type = proto.Field( + proto.STRING, + number=523207775, + optional=True, + ) + location = proto.Field( + proto.STRING, + number=290430901, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + noc_contact_email = proto.Field( + proto.STRING, + number=14072832, + optional=True, + ) + operational_status = proto.Field( + proto.STRING, + number=201070847, + optional=True, + ) + peer_ip_address = proto.Field( + proto.STRING, + number=207735769, + optional=True, + ) + provisioned_link_count = proto.Field( + proto.INT32, + number=410888565, + optional=True, + ) + requested_link_count = proto.Field( + proto.INT32, + number=45051387, + optional=True, + ) + satisfies_pzs = proto.Field( + proto.BOOL, + number=480964267, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + state = proto.Field( + proto.STRING, + number=109757585, + optional=True, + ) class InterconnectAttachment(proto.Message): @@ -26846,45 +34931,128 @@ class Type(proto.Enum): PARTNER = 461924520 PARTNER_PROVIDER = 483261352 - admin_enabled = proto.Field(proto.BOOL, number=445675089, optional=True,) - bandwidth = proto.Field(proto.STRING, number=181715121, optional=True,) - candidate_ipv6_subnets = proto.RepeatedField(proto.STRING, number=70682522,) - candidate_subnets = proto.RepeatedField(proto.STRING, number=237842938,) + admin_enabled = proto.Field( + proto.BOOL, + number=445675089, + optional=True, + ) + bandwidth = proto.Field( + proto.STRING, + number=181715121, + optional=True, + ) + candidate_ipv6_subnets = proto.RepeatedField( + proto.STRING, + number=70682522, + ) + candidate_subnets = proto.RepeatedField( + proto.STRING, + number=237842938, + ) cloud_router_ip_address = proto.Field( - proto.STRING, number=287392776, optional=True, + proto.STRING, + number=287392776, + optional=True, ) cloud_router_ipv6_address = proto.Field( - proto.STRING, number=451922376, optional=True, + proto.STRING, + number=451922376, + optional=True, ) cloud_router_ipv6_interface_id = proto.Field( - proto.STRING, number=521282701, optional=True, + proto.STRING, + number=521282701, + optional=True, + ) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, ) - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) customer_router_ip_address = proto.Field( - proto.STRING, number=332475761, optional=True, + proto.STRING, + number=332475761, + optional=True, ) customer_router_ipv6_address = proto.Field( - proto.STRING, number=290127089, optional=True, + proto.STRING, + number=290127089, + optional=True, ) customer_router_ipv6_interface_id = proto.Field( - proto.STRING, number=380994308, optional=True, + proto.STRING, + number=380994308, + optional=True, + ) + dataplane_version = proto.Field( + proto.INT32, + number=34920075, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, ) - dataplane_version = proto.Field(proto.INT32, number=34920075, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) edge_availability_domain = proto.Field( - proto.STRING, number=71289510, optional=True, - ) - encryption = proto.Field(proto.STRING, number=97980291, optional=True,) - google_reference_id = proto.Field(proto.STRING, number=534944469, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - interconnect = proto.Field(proto.STRING, number=224601230, optional=True,) - ipsec_internal_addresses = proto.RepeatedField(proto.STRING, number=407648565,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - mtu = proto.Field(proto.INT32, number=108462, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - operational_status = proto.Field(proto.STRING, number=201070847, optional=True,) - pairing_key = proto.Field(proto.STRING, number=439695464, optional=True,) - partner_asn = proto.Field(proto.INT64, number=438166149, optional=True,) + proto.STRING, + number=71289510, + optional=True, + ) + encryption = proto.Field( + proto.STRING, + number=97980291, + optional=True, + ) + google_reference_id = proto.Field( + proto.STRING, + number=534944469, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + interconnect = proto.Field( + proto.STRING, + number=224601230, + optional=True, + ) + ipsec_internal_addresses = proto.RepeatedField( + proto.STRING, + number=407648565, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + mtu = proto.Field( + proto.INT32, + number=108462, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + operational_status = proto.Field( + proto.STRING, + number=201070847, + optional=True, + ) + pairing_key = proto.Field( + proto.STRING, + number=439695464, + optional=True, + ) + partner_asn = proto.Field( + proto.INT64, + number=438166149, + optional=True, + ) partner_metadata = proto.Field( proto.MESSAGE, number=65908934, @@ -26897,14 +35065,46 @@ class Type(proto.Enum): optional=True, message="InterconnectAttachmentPrivateInfo", ) - region = proto.Field(proto.STRING, number=138946292, optional=True,) - router = proto.Field(proto.STRING, number=148608841, optional=True,) - satisfies_pzs = proto.Field(proto.BOOL, number=480964267, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - stack_type = proto.Field(proto.STRING, number=425908881, optional=True,) - state = proto.Field(proto.STRING, number=109757585, optional=True,) - type_ = proto.Field(proto.STRING, number=3575610, optional=True,) - vlan_tag8021q = proto.Field(proto.INT32, number=119927836, optional=True,) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) + router = proto.Field( + proto.STRING, + number=148608841, + optional=True, + ) + satisfies_pzs = proto.Field( + proto.BOOL, + number=480964267, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + stack_type = proto.Field( + proto.STRING, + number=425908881, + optional=True, + ) + state = proto.Field( + proto.STRING, + number=109757585, + optional=True, + ) + type_ = proto.Field( + proto.STRING, + number=3575610, + optional=True, + ) + vlan_tag8021q = proto.Field( + proto.INT32, + number=119927836, + optional=True, + ) class InterconnectAttachmentAggregatedList(proto.Message): @@ -26950,19 +35150,41 @@ class InterconnectAttachmentAggregatedList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.MapField( proto.STRING, proto.MESSAGE, number=100526016, message="InterconnectAttachmentsScopedList", ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - unreachables = proto.RepeatedField(proto.STRING, number=243372063,) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -27007,15 +35229,36 @@ class InterconnectAttachmentList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="InterconnectAttachment", + proto.MESSAGE, + number=100526016, + message="InterconnectAttachment", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -27050,9 +35293,21 @@ class InterconnectAttachmentPartnerMetadata(proto.Message): This field is a member of `oneof`_ ``_portal_url``. """ - interconnect_name = proto.Field(proto.STRING, number=514963356, optional=True,) - partner_name = proto.Field(proto.STRING, number=161747874, optional=True,) - portal_url = proto.Field(proto.STRING, number=269182748, optional=True,) + interconnect_name = proto.Field( + proto.STRING, + number=514963356, + optional=True, + ) + partner_name = proto.Field( + proto.STRING, + number=161747874, + optional=True, + ) + portal_url = proto.Field( + proto.STRING, + number=269182748, + optional=True, + ) class InterconnectAttachmentPrivateInfo(proto.Message): @@ -27068,7 +35323,11 @@ class InterconnectAttachmentPrivateInfo(proto.Message): This field is a member of `oneof`_ ``_tag8021q``. """ - tag8021q = proto.Field(proto.UINT32, number=271820992, optional=True,) + tag8021q = proto.Field( + proto.UINT32, + number=271820992, + optional=True, + ) class InterconnectAttachmentsScopedList(proto.Message): @@ -27086,10 +35345,15 @@ class InterconnectAttachmentsScopedList(proto.Message): """ interconnect_attachments = proto.RepeatedField( - proto.MESSAGE, number=425388415, message="InterconnectAttachment", + proto.MESSAGE, + number=425388415, + message="InterconnectAttachment", ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -27116,9 +35380,21 @@ class InterconnectCircuitInfo(proto.Message): This field is a member of `oneof`_ ``_google_demarc_id``. """ - customer_demarc_id = proto.Field(proto.STRING, number=28771859, optional=True,) - google_circuit_id = proto.Field(proto.STRING, number=262014711, optional=True,) - google_demarc_id = proto.Field(proto.STRING, number=448196270, optional=True,) + customer_demarc_id = proto.Field( + proto.STRING, + number=28771859, + optional=True, + ) + google_circuit_id = proto.Field( + proto.STRING, + number=262014711, + optional=True, + ) + google_demarc_id = proto.Field( + proto.STRING, + number=448196270, + optional=True, + ) class InterconnectDiagnostics(proto.Message): @@ -27145,12 +35421,20 @@ class InterconnectDiagnostics(proto.Message): """ arp_caches = proto.RepeatedField( - proto.MESSAGE, number=414591761, message="InterconnectDiagnosticsARPEntry", + proto.MESSAGE, + number=414591761, + message="InterconnectDiagnosticsARPEntry", ) links = proto.RepeatedField( - proto.MESSAGE, number=102977465, message="InterconnectDiagnosticsLinkStatus", + proto.MESSAGE, + number=102977465, + message="InterconnectDiagnosticsLinkStatus", + ) + mac_address = proto.Field( + proto.STRING, + number=332540164, + optional=True, ) - mac_address = proto.Field(proto.STRING, number=332540164, optional=True,) class InterconnectDiagnosticsARPEntry(proto.Message): @@ -27167,8 +35451,16 @@ class InterconnectDiagnosticsARPEntry(proto.Message): This field is a member of `oneof`_ ``_mac_address``. """ - ip_address = proto.Field(proto.STRING, number=406272220, optional=True,) - mac_address = proto.Field(proto.STRING, number=332540164, optional=True,) + ip_address = proto.Field( + proto.STRING, + number=406272220, + optional=True, + ) + mac_address = proto.Field( + proto.STRING, + number=332540164, + optional=True, + ) class InterconnectDiagnosticsLinkLACPStatus(proto.Message): @@ -27207,9 +35499,21 @@ class State(proto.Enum): ACTIVE = 314733318 DETACHED = 216562546 - google_system_id = proto.Field(proto.STRING, number=91210405, optional=True,) - neighbor_system_id = proto.Field(proto.STRING, number=343821342, optional=True,) - state = proto.Field(proto.STRING, number=109757585, optional=True,) + google_system_id = proto.Field( + proto.STRING, + number=91210405, + optional=True, + ) + neighbor_system_id = proto.Field( + proto.STRING, + number=343821342, + optional=True, + ) + state = proto.Field( + proto.STRING, + number=109757585, + optional=True, + ) class InterconnectDiagnosticsLinkOpticalPower(proto.Message): @@ -27257,8 +35561,16 @@ class State(proto.Enum): LOW_WARNING = 338793841 OK = 2524 - state = proto.Field(proto.STRING, number=109757585, optional=True,) - value = proto.Field(proto.FLOAT, number=111972721, optional=True,) + state = proto.Field( + proto.STRING, + number=109757585, + optional=True, + ) + value = proto.Field( + proto.FLOAT, + number=111972721, + optional=True, + ) class InterconnectDiagnosticsLinkStatus(proto.Message): @@ -27298,10 +35610,20 @@ class InterconnectDiagnosticsLinkStatus(proto.Message): """ arp_caches = proto.RepeatedField( - proto.MESSAGE, number=414591761, message="InterconnectDiagnosticsARPEntry", + proto.MESSAGE, + number=414591761, + message="InterconnectDiagnosticsARPEntry", + ) + circuit_id = proto.Field( + proto.STRING, + number=225180977, + optional=True, + ) + google_demarc = proto.Field( + proto.STRING, + number=51084, + optional=True, ) - circuit_id = proto.Field(proto.STRING, number=225180977, optional=True,) - google_demarc = proto.Field(proto.STRING, number=51084, optional=True,) lacp_status = proto.Field( proto.MESSAGE, number=361210415, @@ -27362,15 +35684,36 @@ class InterconnectList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="Interconnect", + proto.MESSAGE, + number=100526016, + message="Interconnect", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -27499,26 +35842,86 @@ class Status(proto.Enum): AVAILABLE = 442079913 CLOSED = 380163436 - address = proto.Field(proto.STRING, number=462920692, optional=True,) - availability_zone = proto.Field(proto.STRING, number=158459920, optional=True,) - city = proto.Field(proto.STRING, number=3053931, optional=True,) - continent = proto.Field(proto.STRING, number=133442996, optional=True,) - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - facility_provider = proto.Field(proto.STRING, number=533303309, optional=True,) + address = proto.Field( + proto.STRING, + number=462920692, + optional=True, + ) + availability_zone = proto.Field( + proto.STRING, + number=158459920, + optional=True, + ) + city = proto.Field( + proto.STRING, + number=3053931, + optional=True, + ) + continent = proto.Field( + proto.STRING, + number=133442996, + optional=True, + ) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + facility_provider = proto.Field( + proto.STRING, + number=533303309, + optional=True, + ) facility_provider_facility_id = proto.Field( - proto.STRING, number=87269125, optional=True, + proto.STRING, + number=87269125, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + peeringdb_facility_id = proto.Field( + proto.STRING, + number=536567094, + optional=True, ) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - peeringdb_facility_id = proto.Field(proto.STRING, number=536567094, optional=True,) region_infos = proto.RepeatedField( - proto.MESSAGE, number=312194170, message="InterconnectLocationRegionInfo", + proto.MESSAGE, + number=312194170, + message="InterconnectLocationRegionInfo", + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + status = proto.Field( + proto.STRING, + number=181260274, + optional=True, + ) + supports_pzs = proto.Field( + proto.BOOL, + number=83983214, + optional=True, ) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - status = proto.Field(proto.STRING, number=181260274, optional=True,) - supports_pzs = proto.Field(proto.BOOL, number=83983214, optional=True,) class InterconnectLocationList(proto.Message): @@ -27562,15 +35965,36 @@ class InterconnectLocationList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="InterconnectLocation", + proto.MESSAGE, + number=100526016, + message="InterconnectLocation", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -27606,9 +36030,21 @@ class LocationPresence(proto.Enum): LP_GLOBAL = 429584062 LP_LOCAL_REGION = 488598851 - expected_rtt_ms = proto.Field(proto.INT64, number=422543866, optional=True,) - location_presence = proto.Field(proto.STRING, number=101517893, optional=True,) - region = proto.Field(proto.STRING, number=138946292, optional=True,) + expected_rtt_ms = proto.Field( + proto.INT64, + number=422543866, + optional=True, + ) + location_presence = proto.Field( + proto.STRING, + number=101517893, + optional=True, + ) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) class InterconnectOutageNotification(proto.Message): @@ -27715,14 +36151,45 @@ class State(proto.Enum): NS_ACTIVE = 252563136 NS_CANCELED = 506579411 - affected_circuits = proto.RepeatedField(proto.STRING, number=177717013,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - end_time = proto.Field(proto.INT64, number=114938801, optional=True,) - issue_type = proto.Field(proto.STRING, number=369639136, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - source = proto.Field(proto.STRING, number=177235995, optional=True,) - start_time = proto.Field(proto.INT64, number=37467274, optional=True,) - state = proto.Field(proto.STRING, number=109757585, optional=True,) + affected_circuits = proto.RepeatedField( + proto.STRING, + number=177717013, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + end_time = proto.Field( + proto.INT64, + number=114938801, + optional=True, + ) + issue_type = proto.Field( + proto.STRING, + number=369639136, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + source = proto.Field( + proto.STRING, + number=177235995, + optional=True, + ) + start_time = proto.Field( + proto.INT64, + number=37467274, + optional=True, + ) + state = proto.Field( + proto.STRING, + number=109757585, + optional=True, + ) class InterconnectsGetDiagnosticsResponse(proto.Message): @@ -27774,11 +36241,23 @@ class InvalidateCacheUrlMapRequest(proto.Message): """ cache_invalidation_rule_resource = proto.Field( - proto.MESSAGE, number=312795565, message="CacheInvalidationRule", + proto.MESSAGE, + number=312795565, + message="CacheInvalidationRule", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + url_map = proto.Field( + proto.STRING, + number=367020684, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - url_map = proto.Field(proto.STRING, number=367020684,) class Items(proto.Message): @@ -27804,8 +36283,16 @@ class Items(proto.Message): This field is a member of `oneof`_ ``_value``. """ - key = proto.Field(proto.STRING, number=106079, optional=True,) - value = proto.Field(proto.STRING, number=111972721, optional=True,) + key = proto.Field( + proto.STRING, + number=106079, + optional=True, + ) + value = proto.Field( + proto.STRING, + number=111972721, + optional=True, + ) class License(proto.Message): @@ -27866,21 +36353,57 @@ class License(proto.Message): This field is a member of `oneof`_ ``_transferable``. """ - charges_use_fee = proto.Field(proto.BOOL, number=372412622, optional=True,) - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - license_code = proto.Field(proto.UINT64, number=1467179, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) + charges_use_fee = proto.Field( + proto.BOOL, + number=372412622, + optional=True, + ) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + license_code = proto.Field( + proto.UINT64, + number=1467179, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) resource_requirements = proto.Field( proto.MESSAGE, number=214292769, optional=True, message="LicenseResourceRequirements", ) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - transferable = proto.Field(proto.BOOL, number=4349893, optional=True,) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + transferable = proto.Field( + proto.BOOL, + number=4349893, + optional=True, + ) class LicenseCode(proto.Message): @@ -27942,17 +36465,51 @@ class State(proto.Enum): STATE_UNSPECIFIED = 470755401 TERMINATED = 250018339 - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) license_alias = proto.RepeatedField( - proto.MESSAGE, number=43550930, message="LicenseCodeLicenseAlias", + proto.MESSAGE, + number=43550930, + message="LicenseCodeLicenseAlias", + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + state = proto.Field( + proto.STRING, + number=109757585, + optional=True, + ) + transferable = proto.Field( + proto.BOOL, + number=4349893, + optional=True, ) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - state = proto.Field(proto.STRING, number=109757585, optional=True,) - transferable = proto.Field(proto.BOOL, number=4349893, optional=True,) class LicenseCodeLicenseAlias(proto.Message): @@ -27970,8 +36527,16 @@ class LicenseCodeLicenseAlias(proto.Message): This field is a member of `oneof`_ ``_self_link``. """ - description = proto.Field(proto.STRING, number=422937596, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) class LicenseResourceCommitment(proto.Message): @@ -27993,9 +36558,21 @@ class LicenseResourceCommitment(proto.Message): This field is a member of `oneof`_ ``_license``. """ - amount = proto.Field(proto.INT64, number=196759640, optional=True,) - cores_per_license = proto.Field(proto.STRING, number=32482324, optional=True,) - license_ = proto.Field(proto.STRING, number=166757441, optional=True,) + amount = proto.Field( + proto.INT64, + number=196759640, + optional=True, + ) + cores_per_license = proto.Field( + proto.STRING, + number=32482324, + optional=True, + ) + license_ = proto.Field( + proto.STRING, + number=166757441, + optional=True, + ) class LicenseResourceRequirements(proto.Message): @@ -28016,8 +36593,16 @@ class LicenseResourceRequirements(proto.Message): This field is a member of `oneof`_ ``_min_memory_mb``. """ - min_guest_cpu_count = proto.Field(proto.INT32, number=477964836, optional=True,) - min_memory_mb = proto.Field(proto.INT32, number=504785894, optional=True,) + min_guest_cpu_count = proto.Field( + proto.INT32, + number=477964836, + optional=True, + ) + min_memory_mb = proto.Field( + proto.INT32, + number=504785894, + optional=True, + ) class LicensesListResponse(proto.Message): @@ -28054,12 +36639,31 @@ class LicensesListResponse(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) - items = proto.RepeatedField(proto.MESSAGE, number=100526016, message="License",) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) + items = proto.RepeatedField( + proto.MESSAGE, + number=100526016, + message="License", + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -28136,13 +36740,39 @@ class ListAcceleratorTypesRequest(proto.Message): The name of the zone for this request. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class ListAddressesRequest(proto.Message): @@ -28218,13 +36848,39 @@ class ListAddressesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListAssociationsFirewallPolicyRequest(proto.Message): @@ -28239,7 +36895,11 @@ class ListAssociationsFirewallPolicyRequest(proto.Message): This field is a member of `oneof`_ ``_target_resource``. """ - target_resource = proto.Field(proto.STRING, number=467318524, optional=True,) + target_resource = proto.Field( + proto.STRING, + number=467318524, + optional=True, + ) class ListAutoscalersRequest(proto.Message): @@ -28315,13 +36975,39 @@ class ListAutoscalersRequest(proto.Message): Name of the zone for this request. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class ListAvailableFeaturesSslPoliciesRequest(proto.Message): @@ -28395,12 +37081,35 @@ class ListAvailableFeaturesSslPoliciesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListBackendBucketsRequest(proto.Message): @@ -28474,12 +37183,35 @@ class ListBackendBucketsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListBackendServicesRequest(proto.Message): @@ -28553,12 +37285,35 @@ class ListBackendServicesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListDiskTypesRequest(proto.Message): @@ -28634,13 +37389,39 @@ class ListDiskTypesRequest(proto.Message): The name of the zone for this request. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class ListDisksRequest(proto.Message): @@ -28716,13 +37497,39 @@ class ListDisksRequest(proto.Message): The name of the zone for this request. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class ListErrorsInstanceGroupManagersRequest(proto.Message): @@ -28805,14 +37612,43 @@ class ListErrorsInstanceGroupManagersRequest(proto.Message): RFC1035. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - instance_group_manager = proto.Field(proto.STRING, number=249363395,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class ListErrorsRegionInstanceGroupManagersRequest(proto.Message): @@ -28894,14 +37730,43 @@ class ListErrorsRegionInstanceGroupManagersRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - instance_group_manager = proto.Field(proto.STRING, number=249363395,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListExternalVpnGatewaysRequest(proto.Message): @@ -28975,12 +37840,35 @@ class ListExternalVpnGatewaysRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListFirewallPoliciesRequest(proto.Message): @@ -29056,12 +37944,36 @@ class ListFirewallPoliciesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - parent_id = proto.Field(proto.STRING, number=459714768, optional=True,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + parent_id = proto.Field( + proto.STRING, + number=459714768, + optional=True, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListFirewallsRequest(proto.Message): @@ -29135,12 +38047,35 @@ class ListFirewallsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListForwardingRulesRequest(proto.Message): @@ -29216,13 +38151,39 @@ class ListForwardingRulesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListGlobalAddressesRequest(proto.Message): @@ -29296,12 +38257,35 @@ class ListGlobalAddressesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListGlobalForwardingRulesRequest(proto.Message): @@ -29375,12 +38359,35 @@ class ListGlobalForwardingRulesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListGlobalNetworkEndpointGroupsRequest(proto.Message): @@ -29454,12 +38461,35 @@ class ListGlobalNetworkEndpointGroupsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListGlobalOperationsRequest(proto.Message): @@ -29533,12 +38563,35 @@ class ListGlobalOperationsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListGlobalOrganizationOperationsRequest(proto.Message): @@ -29614,12 +38667,36 @@ class ListGlobalOrganizationOperationsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - parent_id = proto.Field(proto.STRING, number=459714768, optional=True,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + parent_id = proto.Field( + proto.STRING, + number=459714768, + optional=True, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListGlobalPublicDelegatedPrefixesRequest(proto.Message): @@ -29693,12 +38770,35 @@ class ListGlobalPublicDelegatedPrefixesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListHealthChecksRequest(proto.Message): @@ -29772,12 +38872,35 @@ class ListHealthChecksRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListImagesRequest(proto.Message): @@ -29851,12 +38974,35 @@ class ListImagesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListInstanceGroupManagersRequest(proto.Message): @@ -29933,13 +39079,39 @@ class ListInstanceGroupManagersRequest(proto.Message): instance group is located. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class ListInstanceGroupsRequest(proto.Message): @@ -30016,13 +39188,39 @@ class ListInstanceGroupsRequest(proto.Message): is located. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class ListInstanceTemplatesRequest(proto.Message): @@ -30096,12 +39294,35 @@ class ListInstanceTemplatesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListInstancesInstanceGroupsRequest(proto.Message): @@ -30183,17 +39404,48 @@ class ListInstancesInstanceGroupsRequest(proto.Message): is located. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - instance_group = proto.Field(proto.STRING, number=81095253,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + instance_group = proto.Field( + proto.STRING, + number=81095253, + ) instance_groups_list_instances_request_resource = proto.Field( - proto.MESSAGE, number=476255263, message="InstanceGroupsListInstancesRequest", + proto.MESSAGE, + number=476255263, + message="InstanceGroupsListInstancesRequest", + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) class ListInstancesRegionInstanceGroupsRequest(proto.Message): @@ -30274,19 +39526,48 @@ class ListInstancesRegionInstanceGroupsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - instance_group = proto.Field(proto.STRING, number=81095253,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + instance_group = proto.Field( + proto.STRING, + number=81095253, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) region_instance_groups_list_instances_request_resource = proto.Field( proto.MESSAGE, number=48239828, message="RegionInstanceGroupsListInstancesRequest", ) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListInstancesRequest(proto.Message): @@ -30362,13 +39643,39 @@ class ListInstancesRequest(proto.Message): The name of the zone for this request. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class ListInterconnectAttachmentsRequest(proto.Message): @@ -30444,13 +39751,39 @@ class ListInterconnectAttachmentsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListInterconnectLocationsRequest(proto.Message): @@ -30524,12 +39857,35 @@ class ListInterconnectLocationsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListInterconnectsRequest(proto.Message): @@ -30603,12 +39959,35 @@ class ListInterconnectsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListLicensesRequest(proto.Message): @@ -30682,12 +40061,35 @@ class ListLicensesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListMachineImagesRequest(proto.Message): @@ -30761,12 +40163,35 @@ class ListMachineImagesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListMachineTypesRequest(proto.Message): @@ -30842,13 +40267,39 @@ class ListMachineTypesRequest(proto.Message): The name of the zone for this request. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class ListManagedInstancesInstanceGroupManagersRequest(proto.Message): @@ -30928,14 +40379,43 @@ class ListManagedInstancesInstanceGroupManagersRequest(proto.Message): instance group is located. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - instance_group_manager = proto.Field(proto.STRING, number=249363395,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class ListManagedInstancesRegionInstanceGroupManagersRequest(proto.Message): @@ -31014,14 +40494,43 @@ class ListManagedInstancesRegionInstanceGroupManagersRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - instance_group_manager = proto.Field(proto.STRING, number=249363395,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListNetworkEndpointGroupsRequest(proto.Message): @@ -31099,13 +40608,39 @@ class ListNetworkEndpointGroupsRequest(proto.Message): RFC1035. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest(proto.Message): @@ -31185,13 +40720,39 @@ class ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - network_endpoint_group = proto.Field(proto.STRING, number=433907078,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + network_endpoint_group = proto.Field( + proto.STRING, + number=433907078, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListNetworkEndpointsNetworkEndpointGroupsRequest(proto.Message): @@ -31277,19 +40838,48 @@ class ListNetworkEndpointsNetworkEndpointGroupsRequest(proto.Message): RFC1035. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - network_endpoint_group = proto.Field(proto.STRING, number=433907078,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + network_endpoint_group = proto.Field( + proto.STRING, + number=433907078, + ) network_endpoint_groups_list_endpoints_request_resource = proto.Field( proto.MESSAGE, number=59493390, message="NetworkEndpointGroupsListEndpointsRequest", ) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class ListNetworksRequest(proto.Message): @@ -31363,12 +40953,35 @@ class ListNetworksRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListNodeGroupsRequest(proto.Message): @@ -31444,13 +41057,39 @@ class ListNodeGroupsRequest(proto.Message): The name of the zone for this request. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class ListNodeTemplatesRequest(proto.Message): @@ -31526,13 +41165,39 @@ class ListNodeTemplatesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListNodeTypesRequest(proto.Message): @@ -31608,13 +41273,39 @@ class ListNodeTypesRequest(proto.Message): The name of the zone for this request. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class ListNodesNodeGroupsRequest(proto.Message): @@ -31693,14 +41384,43 @@ class ListNodesNodeGroupsRequest(proto.Message): The name of the zone for this request. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - node_group = proto.Field(proto.STRING, number=469958146,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + node_group = proto.Field( + proto.STRING, + number=469958146, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class ListPacketMirroringsRequest(proto.Message): @@ -31776,13 +41496,39 @@ class ListPacketMirroringsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListPeeringRoutesNetworksRequest(proto.Message): @@ -31881,16 +41627,54 @@ class Direction(proto.Enum): INCOMING = 338552870 OUTGOING = 307438444 - direction = proto.Field(proto.STRING, number=111150975, optional=True,) - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - network = proto.Field(proto.STRING, number=232872494,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - peering_name = proto.Field(proto.STRING, number=249571370, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292, optional=True,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + direction = proto.Field( + proto.STRING, + number=111150975, + optional=True, + ) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + network = proto.Field( + proto.STRING, + number=232872494, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + peering_name = proto.Field( + proto.STRING, + number=249571370, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListPerInstanceConfigsInstanceGroupManagersRequest(proto.Message): @@ -31972,14 +41756,43 @@ class ListPerInstanceConfigsInstanceGroupManagersRequest(proto.Message): RFC1035. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - instance_group_manager = proto.Field(proto.STRING, number=249363395,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class ListPerInstanceConfigsRegionInstanceGroupManagersRequest(proto.Message): @@ -32060,14 +41873,43 @@ class ListPerInstanceConfigsRegionInstanceGroupManagersRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - instance_group_manager = proto.Field(proto.STRING, number=249363395,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListPreconfiguredExpressionSetsSecurityPoliciesRequest(proto.Message): @@ -32142,12 +41984,35 @@ class ListPreconfiguredExpressionSetsSecurityPoliciesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListPublicAdvertisedPrefixesRequest(proto.Message): @@ -32221,12 +42086,35 @@ class ListPublicAdvertisedPrefixesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListPublicDelegatedPrefixesRequest(proto.Message): @@ -32302,13 +42190,39 @@ class ListPublicDelegatedPrefixesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListReferrersInstancesRequest(proto.Message): @@ -32388,14 +42302,43 @@ class ListReferrersInstancesRequest(proto.Message): The name of the zone for this request. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - instance = proto.Field(proto.STRING, number=18257045,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + instance = proto.Field( + proto.STRING, + number=18257045, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class ListRegionAutoscalersRequest(proto.Message): @@ -32471,13 +42414,39 @@ class ListRegionAutoscalersRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListRegionBackendServicesRequest(proto.Message): @@ -32553,13 +42522,39 @@ class ListRegionBackendServicesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListRegionCommitmentsRequest(proto.Message): @@ -32635,13 +42630,39 @@ class ListRegionCommitmentsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListRegionDiskTypesRequest(proto.Message): @@ -32717,13 +42738,39 @@ class ListRegionDiskTypesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListRegionDisksRequest(proto.Message): @@ -32799,13 +42846,39 @@ class ListRegionDisksRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListRegionHealthCheckServicesRequest(proto.Message): @@ -32881,13 +42954,39 @@ class ListRegionHealthCheckServicesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListRegionHealthChecksRequest(proto.Message): @@ -32963,13 +43062,39 @@ class ListRegionHealthChecksRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListRegionInstanceGroupManagersRequest(proto.Message): @@ -33045,13 +43170,39 @@ class ListRegionInstanceGroupManagersRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListRegionInstanceGroupsRequest(proto.Message): @@ -33127,13 +43278,39 @@ class ListRegionInstanceGroupsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListRegionNetworkEndpointGroupsRequest(proto.Message): @@ -33211,13 +43388,39 @@ class ListRegionNetworkEndpointGroupsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListRegionNotificationEndpointsRequest(proto.Message): @@ -33293,13 +43496,39 @@ class ListRegionNotificationEndpointsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListRegionOperationsRequest(proto.Message): @@ -33375,13 +43604,39 @@ class ListRegionOperationsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListRegionSslCertificatesRequest(proto.Message): @@ -33457,13 +43712,39 @@ class ListRegionSslCertificatesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListRegionTargetHttpProxiesRequest(proto.Message): @@ -33539,13 +43820,39 @@ class ListRegionTargetHttpProxiesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListRegionTargetHttpsProxiesRequest(proto.Message): @@ -33621,13 +43928,39 @@ class ListRegionTargetHttpsProxiesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListRegionUrlMapsRequest(proto.Message): @@ -33703,13 +44036,39 @@ class ListRegionUrlMapsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListRegionsRequest(proto.Message): @@ -33783,12 +44142,35 @@ class ListRegionsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListReservationsRequest(proto.Message): @@ -33864,13 +44246,39 @@ class ListReservationsRequest(proto.Message): Name of the zone for this request. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class ListResourcePoliciesRequest(proto.Message): @@ -33946,13 +44354,39 @@ class ListResourcePoliciesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListRoutersRequest(proto.Message): @@ -34028,13 +44462,39 @@ class ListRoutersRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListRoutesRequest(proto.Message): @@ -34108,12 +44568,35 @@ class ListRoutesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListSecurityPoliciesRequest(proto.Message): @@ -34187,12 +44670,35 @@ class ListSecurityPoliciesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListServiceAttachmentsRequest(proto.Message): @@ -34268,13 +44774,39 @@ class ListServiceAttachmentsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListSnapshotsRequest(proto.Message): @@ -34348,12 +44880,35 @@ class ListSnapshotsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListSslCertificatesRequest(proto.Message): @@ -34427,12 +44982,35 @@ class ListSslCertificatesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListSslPoliciesRequest(proto.Message): @@ -34506,12 +45084,35 @@ class ListSslPoliciesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListSubnetworksRequest(proto.Message): @@ -34587,13 +45188,39 @@ class ListSubnetworksRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListTargetGrpcProxiesRequest(proto.Message): @@ -34667,12 +45294,35 @@ class ListTargetGrpcProxiesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListTargetHttpProxiesRequest(proto.Message): @@ -34746,12 +45396,35 @@ class ListTargetHttpProxiesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListTargetHttpsProxiesRequest(proto.Message): @@ -34825,12 +45498,35 @@ class ListTargetHttpsProxiesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListTargetInstancesRequest(proto.Message): @@ -34906,13 +45602,39 @@ class ListTargetInstancesRequest(proto.Message): Name of the zone scoping this request. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class ListTargetPoolsRequest(proto.Message): @@ -34988,13 +45710,39 @@ class ListTargetPoolsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListTargetSslProxiesRequest(proto.Message): @@ -35068,12 +45816,35 @@ class ListTargetSslProxiesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListTargetTcpProxiesRequest(proto.Message): @@ -35147,12 +45918,35 @@ class ListTargetTcpProxiesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListTargetVpnGatewaysRequest(proto.Message): @@ -35228,13 +46022,39 @@ class ListTargetVpnGatewaysRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListUrlMapsRequest(proto.Message): @@ -35308,12 +46128,35 @@ class ListUrlMapsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListUsableSubnetworksRequest(proto.Message): @@ -35387,12 +46230,35 @@ class ListUsableSubnetworksRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListVpnGatewaysRequest(proto.Message): @@ -35468,13 +46334,39 @@ class ListVpnGatewaysRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListVpnTunnelsRequest(proto.Message): @@ -35550,13 +46442,39 @@ class ListVpnTunnelsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class ListXpnHostsProjectsRequest(proto.Message): @@ -35632,15 +46550,40 @@ class ListXpnHostsProjectsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) projects_list_xpn_hosts_request_resource = proto.Field( - proto.MESSAGE, number=238266391, message="ProjectsListXpnHostsRequest", + proto.MESSAGE, + number=238266391, + message="ProjectsListXpnHostsRequest", + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, ) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) class ListZoneOperationsRequest(proto.Message): @@ -35716,13 +46659,39 @@ class ListZoneOperationsRequest(proto.Message): Name of the zone for request. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class ListZonesRequest(proto.Message): @@ -35796,12 +46765,35 @@ class ListZonesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - filter = proto.Field(proto.STRING, number=336120696, optional=True,) - max_results = proto.Field(proto.UINT32, number=54715419, optional=True,) - order_by = proto.Field(proto.STRING, number=160562920, optional=True,) - page_token = proto.Field(proto.STRING, number=19994697, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - return_partial_success = proto.Field(proto.BOOL, number=517198390, optional=True,) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) class LocalDisk(proto.Message): @@ -35826,9 +46818,21 @@ class LocalDisk(proto.Message): This field is a member of `oneof`_ ``_disk_type``. """ - disk_count = proto.Field(proto.INT32, number=182933485, optional=True,) - disk_size_gb = proto.Field(proto.INT32, number=316263735, optional=True,) - disk_type = proto.Field(proto.STRING, number=93009052, optional=True,) + disk_count = proto.Field( + proto.INT32, + number=182933485, + optional=True, + ) + disk_size_gb = proto.Field( + proto.INT32, + number=316263735, + optional=True, + ) + disk_type = proto.Field( + proto.STRING, + number=93009052, + optional=True, + ) class LocationPolicy(proto.Message): @@ -35845,7 +46849,10 @@ class LocationPolicy(proto.Message): """ locations = proto.MapField( - proto.STRING, proto.MESSAGE, number=413423454, message="LocationPolicyLocation", + proto.STRING, + proto.MESSAGE, + number=413423454, + message="LocationPolicyLocation", ) @@ -35868,7 +46875,11 @@ class Preference(proto.Enum): DENY = 2094604 PREFERENCE_UNSPECIFIED = 496219571 - preference = proto.Field(proto.STRING, number=150781147, optional=True,) + preference = proto.Field( + proto.STRING, + number=150781147, + optional=True, + ) class LogConfig(proto.Message): @@ -35942,7 +46953,11 @@ class LogName(proto.Enum): optional=True, message="AuthorizationLoggingOptions", ) - log_name = proto.Field(proto.STRING, number=402913958, optional=True,) + log_name = proto.Field( + proto.STRING, + number=402913958, + optional=True, + ) class LogConfigCounterOptions(proto.Message): @@ -35965,10 +46980,20 @@ class LogConfigCounterOptions(proto.Message): """ custom_fields = proto.RepeatedField( - proto.MESSAGE, number=249651015, message="LogConfigCounterOptionsCustomField", + proto.MESSAGE, + number=249651015, + message="LogConfigCounterOptionsCustomField", + ) + field = proto.Field( + proto.STRING, + number=97427706, + optional=True, + ) + metric = proto.Field( + proto.STRING, + number=533067184, + optional=True, ) - field = proto.Field(proto.STRING, number=97427706, optional=True,) - metric = proto.Field(proto.STRING, number=533067184, optional=True,) class LogConfigCounterOptionsCustomField(proto.Message): @@ -35987,8 +47012,16 @@ class LogConfigCounterOptionsCustomField(proto.Message): This field is a member of `oneof`_ ``_value``. """ - name = proto.Field(proto.STRING, number=3373707, optional=True,) - value = proto.Field(proto.STRING, number=111972721, optional=True,) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + value = proto.Field( + proto.STRING, + number=111972721, + optional=True, + ) class LogConfigDataAccessOptions(proto.Message): @@ -36009,7 +47042,11 @@ class LogMode(proto.Enum): LOG_FAIL_CLOSED = 360469778 LOG_MODE_UNSPECIFIED = 88160822 - log_mode = proto.Field(proto.STRING, number=402897342, optional=True,) + log_mode = proto.Field( + proto.STRING, + number=402897342, + optional=True, + ) class MachineImage(proto.Message): @@ -36143,36 +47180,93 @@ class Status(proto.Enum): READY = 77848963 UPLOADING = 267603489 - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - guest_flush = proto.Field(proto.BOOL, number=385550813, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + guest_flush = proto.Field( + proto.BOOL, + number=385550813, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) instance_properties = proto.Field( - proto.MESSAGE, number=215355165, optional=True, message="InstanceProperties", + proto.MESSAGE, + number=215355165, + optional=True, + message="InstanceProperties", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) machine_image_encryption_key = proto.Field( - proto.MESSAGE, number=528089087, optional=True, message="CustomerEncryptionKey", + proto.MESSAGE, + number=528089087, + optional=True, + message="CustomerEncryptionKey", + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + satisfies_pzs = proto.Field( + proto.BOOL, + number=480964267, + optional=True, ) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - satisfies_pzs = proto.Field(proto.BOOL, number=480964267, optional=True,) saved_disks = proto.RepeatedField( - proto.MESSAGE, number=397424318, message="SavedDisk", + proto.MESSAGE, + number=397424318, + message="SavedDisk", + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) source_disk_encryption_keys = proto.RepeatedField( - proto.MESSAGE, number=370408498, message="SourceDiskEncryptionKey", + proto.MESSAGE, + number=370408498, + message="SourceDiskEncryptionKey", + ) + source_instance = proto.Field( + proto.STRING, + number=396315705, + optional=True, ) - source_instance = proto.Field(proto.STRING, number=396315705, optional=True,) source_instance_properties = proto.Field( proto.MESSAGE, number=475195641, optional=True, message="SourceInstanceProperties", ) - status = proto.Field(proto.STRING, number=181260274, optional=True,) - storage_locations = proto.RepeatedField(proto.STRING, number=328005274,) - total_storage_bytes = proto.Field(proto.INT64, number=81855468, optional=True,) + status = proto.Field( + proto.STRING, + number=181260274, + optional=True, + ) + storage_locations = proto.RepeatedField( + proto.STRING, + number=328005274, + ) + total_storage_bytes = proto.Field( + proto.INT64, + number=81855468, + optional=True, + ) class MachineImageList(proto.Message): @@ -36214,15 +47308,36 @@ class MachineImageList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="MachineImage", + proto.MESSAGE, + number=100526016, + message="MachineImage", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -36308,31 +47423,86 @@ class MachineType(proto.Message): """ accelerators = proto.RepeatedField( - proto.MESSAGE, number=269577064, message="Accelerators", + proto.MESSAGE, + number=269577064, + message="Accelerators", + ) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, ) - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) deprecated = proto.Field( - proto.MESSAGE, number=515138995, optional=True, message="DeprecationStatus", - ) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - guest_cpus = proto.Field(proto.INT32, number=393356754, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - image_space_gb = proto.Field(proto.INT32, number=75331864, optional=True,) - is_shared_cpu = proto.Field(proto.BOOL, number=521399555, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) + proto.MESSAGE, + number=515138995, + optional=True, + message="DeprecationStatus", + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + guest_cpus = proto.Field( + proto.INT32, + number=393356754, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + image_space_gb = proto.Field( + proto.INT32, + number=75331864, + optional=True, + ) + is_shared_cpu = proto.Field( + proto.BOOL, + number=521399555, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) maximum_persistent_disks = proto.Field( - proto.INT32, number=496220941, optional=True, + proto.INT32, + number=496220941, + optional=True, ) maximum_persistent_disks_size_gb = proto.Field( - proto.INT64, number=154274471, optional=True, + proto.INT64, + number=154274471, + optional=True, + ) + memory_mb = proto.Field( + proto.INT32, + number=116001171, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, ) - memory_mb = proto.Field(proto.INT32, number=116001171, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) scratch_disks = proto.RepeatedField( - proto.MESSAGE, number=480778481, message="ScratchDisks", + proto.MESSAGE, + number=480778481, + message="ScratchDisks", + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + optional=True, ) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - zone = proto.Field(proto.STRING, number=3744684, optional=True,) class MachineTypeAggregatedList(proto.Message): @@ -36377,16 +47547,41 @@ class MachineTypeAggregatedList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.MapField( - proto.STRING, proto.MESSAGE, number=100526016, message="MachineTypesScopedList", + proto.STRING, + proto.MESSAGE, + number=100526016, + message="MachineTypesScopedList", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - unreachables = proto.RepeatedField(proto.STRING, number=243372063,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -36429,13 +47624,36 @@ class MachineTypeList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) - items = proto.RepeatedField(proto.MESSAGE, number=100526016, message="MachineType",) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) + items = proto.RepeatedField( + proto.MESSAGE, + number=100526016, + message="MachineType", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -36454,10 +47672,15 @@ class MachineTypesScopedList(proto.Message): """ machine_types = proto.RepeatedField( - proto.MESSAGE, number=79720065, message="MachineType", + proto.MESSAGE, + number=79720065, + message="MachineType", ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -36580,13 +47803,31 @@ class InstanceStatus(proto.Enum): SUSPENDING = 514206246 TERMINATED = 250018339 - current_action = proto.Field(proto.STRING, number=178475964, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - instance = proto.Field(proto.STRING, number=18257045, optional=True,) + current_action = proto.Field( + proto.STRING, + number=178475964, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + instance = proto.Field( + proto.STRING, + number=18257045, + optional=True, + ) instance_health = proto.RepeatedField( - proto.MESSAGE, number=382667078, message="ManagedInstanceInstanceHealth", + proto.MESSAGE, + number=382667078, + message="ManagedInstanceInstanceHealth", + ) + instance_status = proto.Field( + proto.STRING, + number=174577372, + optional=True, ) - instance_status = proto.Field(proto.STRING, number=174577372, optional=True,) last_attempt = proto.Field( proto.MESSAGE, number=434771492, @@ -36594,10 +47835,16 @@ class InstanceStatus(proto.Enum): message="ManagedInstanceLastAttempt", ) preserved_state_from_config = proto.Field( - proto.MESSAGE, number=98661858, optional=True, message="PreservedState", + proto.MESSAGE, + number=98661858, + optional=True, + message="PreservedState", ) preserved_state_from_policy = proto.Field( - proto.MESSAGE, number=470783954, optional=True, message="PreservedState", + proto.MESSAGE, + number=470783954, + optional=True, + message="PreservedState", ) version = proto.Field( proto.MESSAGE, @@ -36633,8 +47880,16 @@ class DetailedHealthState(proto.Enum): UNHEALTHY = 462118084 UNKNOWN = 433141802 - detailed_health_state = proto.Field(proto.STRING, number=510470173, optional=True,) - health_check = proto.Field(proto.STRING, number=308876645, optional=True,) + detailed_health_state = proto.Field( + proto.STRING, + number=510470173, + optional=True, + ) + health_check = proto.Field( + proto.STRING, + number=308876645, + optional=True, + ) class ManagedInstanceLastAttempt(proto.Message): @@ -36649,7 +47904,10 @@ class ManagedInstanceLastAttempt(proto.Message): """ errors = proto.Field( - proto.MESSAGE, number=315977579, optional=True, message="Errors", + proto.MESSAGE, + number=315977579, + optional=True, + message="Errors", ) @@ -36669,8 +47927,16 @@ class ManagedInstanceVersion(proto.Message): This field is a member of `oneof`_ ``_name``. """ - instance_template = proto.Field(proto.STRING, number=309248228, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) + instance_template = proto.Field( + proto.STRING, + number=309248228, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) class Metadata(proto.Message): @@ -36701,9 +47967,21 @@ class Metadata(proto.Message): This field is a member of `oneof`_ ``_kind``. """ - fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) - items = proto.RepeatedField(proto.MESSAGE, number=100526016, message="Items",) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) + fingerprint = proto.Field( + proto.STRING, + number=234678500, + optional=True, + ) + items = proto.RepeatedField( + proto.MESSAGE, + number=100526016, + message="Items", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) class MetadataFilter(proto.Message): @@ -36754,9 +48032,15 @@ class FilterMatchCriteria(proto.Enum): NOT_SET = 163646646 filter_labels = proto.RepeatedField( - proto.MESSAGE, number=307903142, message="MetadataFilterLabelMatch", + proto.MESSAGE, + number=307903142, + message="MetadataFilterLabelMatch", + ) + filter_match_criteria = proto.Field( + proto.STRING, + number=239970368, + optional=True, ) - filter_match_criteria = proto.Field(proto.STRING, number=239970368, optional=True,) class MetadataFilterLabelMatch(proto.Message): @@ -36779,8 +48063,16 @@ class MetadataFilterLabelMatch(proto.Message): This field is a member of `oneof`_ ``_value``. """ - name = proto.Field(proto.STRING, number=3373707, optional=True,) - value = proto.Field(proto.STRING, number=111972721, optional=True,) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + value = proto.Field( + proto.STRING, + number=111972721, + optional=True, + ) class MoveDiskProjectRequest(proto.Message): @@ -36813,10 +48105,19 @@ class MoveDiskProjectRequest(proto.Message): """ disk_move_request_resource = proto.Field( - proto.MESSAGE, number=313008458, message="DiskMoveRequest", + proto.MESSAGE, + number=313008458, + message="DiskMoveRequest", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class MoveFirewallPolicyRequest(proto.Message): @@ -36850,9 +48151,20 @@ class MoveFirewallPolicyRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - firewall_policy = proto.Field(proto.STRING, number=498173265,) - parent_id = proto.Field(proto.STRING, number=459714768, optional=True,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + firewall_policy = proto.Field( + proto.STRING, + number=498173265, + ) + parent_id = proto.Field( + proto.STRING, + number=459714768, + optional=True, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class MoveInstanceProjectRequest(proto.Message): @@ -36885,10 +48197,19 @@ class MoveInstanceProjectRequest(proto.Message): """ instance_move_request_resource = proto.Field( - proto.MESSAGE, number=311664194, message="InstanceMoveRequest", + proto.MESSAGE, + number=311664194, + message="InstanceMoveRequest", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class NamedPort(proto.Message): @@ -36908,8 +48229,16 @@ class NamedPort(proto.Message): This field is a member of `oneof`_ ``_port``. """ - name = proto.Field(proto.STRING, number=3373707, optional=True,) - port = proto.Field(proto.INT32, number=3446913, optional=True,) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + port = proto.Field( + proto.INT32, + number=3446913, + optional=True, + ) class Network(proto.Message): @@ -37001,23 +48330,71 @@ class Network(proto.Message): subnetworks in this VPC network. """ - I_pv4_range = proto.Field(proto.STRING, number=59234358, optional=True,) - auto_create_subnetworks = proto.Field(proto.BOOL, number=256156690, optional=True,) - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - gateway_i_pv4 = proto.Field(proto.STRING, number=178678877, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - mtu = proto.Field(proto.INT32, number=108462, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) + I_pv4_range = proto.Field( + proto.STRING, + number=59234358, + optional=True, + ) + auto_create_subnetworks = proto.Field( + proto.BOOL, + number=256156690, + optional=True, + ) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + gateway_i_pv4 = proto.Field( + proto.STRING, + number=178678877, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + mtu = proto.Field( + proto.INT32, + number=108462, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) peerings = proto.RepeatedField( - proto.MESSAGE, number=69883187, message="NetworkPeering", + proto.MESSAGE, + number=69883187, + message="NetworkPeering", ) routing_config = proto.Field( - proto.MESSAGE, number=523556059, optional=True, message="NetworkRoutingConfig", + proto.MESSAGE, + number=523556059, + optional=True, + message="NetworkRoutingConfig", + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + subnetworks = proto.RepeatedField( + proto.STRING, + number=415853125, ) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - subnetworks = proto.RepeatedField(proto.STRING, number=415853125,) class NetworkEndpoint(proto.Message): @@ -37060,11 +48437,31 @@ class NetworkEndpoint(proto.Message): This field is a member of `oneof`_ ``_port``. """ - annotations = proto.MapField(proto.STRING, proto.STRING, number=112032548,) - fqdn = proto.Field(proto.STRING, number=3150485, optional=True,) - instance = proto.Field(proto.STRING, number=18257045, optional=True,) - ip_address = proto.Field(proto.STRING, number=406272220, optional=True,) - port = proto.Field(proto.INT32, number=3446913, optional=True,) + annotations = proto.MapField( + proto.STRING, + proto.STRING, + number=112032548, + ) + fqdn = proto.Field( + proto.STRING, + number=3150485, + optional=True, + ) + instance = proto.Field( + proto.STRING, + number=18257045, + optional=True, + ) + ip_address = proto.Field( + proto.STRING, + number=406272220, + optional=True, + ) + port = proto.Field( + proto.INT32, + number=3446913, + optional=True, + ) class NetworkEndpointGroup(proto.Message): @@ -37195,7 +48592,11 @@ class NetworkEndpointType(proto.Enum): PRIVATE_SERVICE_CONNECT = 48134724 SERVERLESS = 270492508 - annotations = proto.MapField(proto.STRING, proto.STRING, number=112032548,) + annotations = proto.MapField( + proto.STRING, + proto.STRING, + number=112032548, + ) app_engine = proto.Field( proto.MESSAGE, number=340788768, @@ -37214,20 +48615,76 @@ class NetworkEndpointType(proto.Enum): optional=True, message="NetworkEndpointGroupCloudRun", ) - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - default_port = proto.Field(proto.INT32, number=423377855, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - network = proto.Field(proto.STRING, number=232872494, optional=True,) - network_endpoint_type = proto.Field(proto.STRING, number=118301523, optional=True,) - psc_target_service = proto.Field(proto.STRING, number=269132134, optional=True,) - region = proto.Field(proto.STRING, number=138946292, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - size = proto.Field(proto.INT32, number=3530753, optional=True,) - subnetwork = proto.Field(proto.STRING, number=307827694, optional=True,) - zone = proto.Field(proto.STRING, number=3744684, optional=True,) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + default_port = proto.Field( + proto.INT32, + number=423377855, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + network = proto.Field( + proto.STRING, + number=232872494, + optional=True, + ) + network_endpoint_type = proto.Field( + proto.STRING, + number=118301523, + optional=True, + ) + psc_target_service = proto.Field( + proto.STRING, + number=269132134, + optional=True, + ) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + size = proto.Field( + proto.INT32, + number=3530753, + optional=True, + ) + subnetwork = proto.Field( + proto.STRING, + number=307827694, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + optional=True, + ) class NetworkEndpointGroupAggregatedList(proto.Message): @@ -37273,19 +48730,41 @@ class NetworkEndpointGroupAggregatedList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.MapField( proto.STRING, proto.MESSAGE, number=100526016, message="NetworkEndpointGroupsScopedList", ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - unreachables = proto.RepeatedField(proto.STRING, number=243372063,) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -37327,9 +48806,21 @@ class NetworkEndpointGroupAppEngine(proto.Message): This field is a member of `oneof`_ ``_version``. """ - service = proto.Field(proto.STRING, number=373540533, optional=True,) - url_mask = proto.Field(proto.STRING, number=103352252, optional=True,) - version = proto.Field(proto.STRING, number=351608024, optional=True,) + service = proto.Field( + proto.STRING, + number=373540533, + optional=True, + ) + url_mask = proto.Field( + proto.STRING, + number=103352252, + optional=True, + ) + version = proto.Field( + proto.STRING, + number=351608024, + optional=True, + ) class NetworkEndpointGroupCloudFunction(proto.Message): @@ -37360,8 +48851,16 @@ class NetworkEndpointGroupCloudFunction(proto.Message): This field is a member of `oneof`_ ``_url_mask``. """ - function = proto.Field(proto.STRING, number=307196888, optional=True,) - url_mask = proto.Field(proto.STRING, number=103352252, optional=True,) + function = proto.Field( + proto.STRING, + number=307196888, + optional=True, + ) + url_mask = proto.Field( + proto.STRING, + number=103352252, + optional=True, + ) class NetworkEndpointGroupCloudRun(proto.Message): @@ -37403,9 +48902,21 @@ class NetworkEndpointGroupCloudRun(proto.Message): This field is a member of `oneof`_ ``_url_mask``. """ - service = proto.Field(proto.STRING, number=373540533, optional=True,) - tag = proto.Field(proto.STRING, number=114586, optional=True,) - url_mask = proto.Field(proto.STRING, number=103352252, optional=True,) + service = proto.Field( + proto.STRING, + number=373540533, + optional=True, + ) + tag = proto.Field( + proto.STRING, + number=114586, + optional=True, + ) + url_mask = proto.Field( + proto.STRING, + number=103352252, + optional=True, + ) class NetworkEndpointGroupList(proto.Message): @@ -37448,15 +48959,36 @@ class NetworkEndpointGroupList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="NetworkEndpointGroup", + proto.MESSAGE, + number=100526016, + message="NetworkEndpointGroup", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -37469,7 +49001,9 @@ class NetworkEndpointGroupsAttachEndpointsRequest(proto.Message): """ network_endpoints = proto.RepeatedField( - proto.MESSAGE, number=149850285, message="NetworkEndpoint", + proto.MESSAGE, + number=149850285, + message="NetworkEndpoint", ) @@ -37482,7 +49016,9 @@ class NetworkEndpointGroupsDetachEndpointsRequest(proto.Message): """ network_endpoints = proto.RepeatedField( - proto.MESSAGE, number=149850285, message="NetworkEndpoint", + proto.MESSAGE, + number=149850285, + message="NetworkEndpoint", ) @@ -37512,7 +49048,11 @@ class HealthStatus(proto.Enum): SHOW = 2544381 SKIP = 2547071 - health_status = proto.Field(proto.STRING, number=380545845, optional=True,) + health_status = proto.Field( + proto.STRING, + number=380545845, + optional=True, + ) class NetworkEndpointGroupsListNetworkEndpoints(proto.Message): @@ -37553,14 +49093,31 @@ class NetworkEndpointGroupsListNetworkEndpoints(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="NetworkEndpointWithHealthStatus", + proto.MESSAGE, + number=100526016, + message="NetworkEndpointWithHealthStatus", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -37579,10 +49136,15 @@ class NetworkEndpointGroupsScopedList(proto.Message): """ network_endpoint_groups = proto.RepeatedField( - proto.MESSAGE, number=29346733, message="NetworkEndpointGroup", + proto.MESSAGE, + number=29346733, + message="NetworkEndpointGroup", ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -37599,10 +49161,15 @@ class NetworkEndpointWithHealthStatus(proto.Message): """ healths = proto.RepeatedField( - proto.MESSAGE, number=258689431, message="HealthStatusForNetworkEndpoint", + proto.MESSAGE, + number=258689431, + message="HealthStatusForNetworkEndpoint", ) network_endpoint = proto.Field( - proto.MESSAGE, number=56789126, optional=True, message="NetworkEndpoint", + proto.MESSAGE, + number=56789126, + optional=True, + message="NetworkEndpoint", ) @@ -37755,25 +49322,75 @@ class StackType(proto.Enum): UNSPECIFIED_STACK_TYPE = 298084569 access_configs = proto.RepeatedField( - proto.MESSAGE, number=111058326, message="AccessConfig", + proto.MESSAGE, + number=111058326, + message="AccessConfig", ) alias_ip_ranges = proto.RepeatedField( - proto.MESSAGE, number=165085631, message="AliasIpRange", + proto.MESSAGE, + number=165085631, + message="AliasIpRange", + ) + fingerprint = proto.Field( + proto.STRING, + number=234678500, + optional=True, ) - fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) ipv6_access_configs = proto.RepeatedField( - proto.MESSAGE, number=483472110, message="AccessConfig", + proto.MESSAGE, + number=483472110, + message="AccessConfig", + ) + ipv6_access_type = proto.Field( + proto.STRING, + number=504658653, + optional=True, + ) + ipv6_address = proto.Field( + proto.STRING, + number=341563804, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + network = proto.Field( + proto.STRING, + number=232872494, + optional=True, + ) + network_i_p = proto.Field( + proto.STRING, + number=207181961, + optional=True, + ) + nic_type = proto.Field( + proto.STRING, + number=59810577, + optional=True, + ) + queue_count = proto.Field( + proto.INT32, + number=503708769, + optional=True, + ) + stack_type = proto.Field( + proto.STRING, + number=425908881, + optional=True, + ) + subnetwork = proto.Field( + proto.STRING, + number=307827694, + optional=True, ) - ipv6_access_type = proto.Field(proto.STRING, number=504658653, optional=True,) - ipv6_address = proto.Field(proto.STRING, number=341563804, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - network = proto.Field(proto.STRING, number=232872494, optional=True,) - network_i_p = proto.Field(proto.STRING, number=207181961, optional=True,) - nic_type = proto.Field(proto.STRING, number=59810577, optional=True,) - queue_count = proto.Field(proto.INT32, number=503708769, optional=True,) - stack_type = proto.Field(proto.STRING, number=425908881, optional=True,) - subnetwork = proto.Field(proto.STRING, number=307827694, optional=True,) class NetworkList(proto.Message): @@ -37815,13 +49432,36 @@ class NetworkList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) - items = proto.RepeatedField(proto.MESSAGE, number=100526016, message="Network",) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) + items = proto.RepeatedField( + proto.MESSAGE, + number=100526016, + message="Network", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -37923,21 +49563,61 @@ class State(proto.Enum): ACTIVE = 314733318 INACTIVE = 270421099 - auto_create_routes = proto.Field(proto.BOOL, number=57454941, optional=True,) - exchange_subnet_routes = proto.Field(proto.BOOL, number=26322256, optional=True,) - export_custom_routes = proto.Field(proto.BOOL, number=60281485, optional=True,) + auto_create_routes = proto.Field( + proto.BOOL, + number=57454941, + optional=True, + ) + exchange_subnet_routes = proto.Field( + proto.BOOL, + number=26322256, + optional=True, + ) + export_custom_routes = proto.Field( + proto.BOOL, + number=60281485, + optional=True, + ) export_subnet_routes_with_public_ip = proto.Field( - proto.BOOL, number=97940834, optional=True, + proto.BOOL, + number=97940834, + optional=True, + ) + import_custom_routes = proto.Field( + proto.BOOL, + number=197982398, + optional=True, ) - import_custom_routes = proto.Field(proto.BOOL, number=197982398, optional=True,) import_subnet_routes_with_public_ip = proto.Field( - proto.BOOL, number=14419729, optional=True, + proto.BOOL, + number=14419729, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + network = proto.Field( + proto.STRING, + number=232872494, + optional=True, + ) + peer_mtu = proto.Field( + proto.INT32, + number=69584721, + optional=True, + ) + state = proto.Field( + proto.STRING, + number=109757585, + optional=True, + ) + state_details = proto.Field( + proto.STRING, + number=95566996, + optional=True, ) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - network = proto.Field(proto.STRING, number=232872494, optional=True,) - peer_mtu = proto.Field(proto.INT32, number=69584721, optional=True,) - state = proto.Field(proto.STRING, number=109757585, optional=True,) - state_details = proto.Field(proto.STRING, number=95566996, optional=True,) class NetworkPerformanceConfig(proto.Message): @@ -37958,7 +49638,9 @@ class TotalEgressBandwidthTier(proto.Enum): TIER_1 = 326919444 total_egress_bandwidth_tier = proto.Field( - proto.STRING, number=130109439, optional=True, + proto.STRING, + number=130109439, + optional=True, ) @@ -37993,7 +49675,11 @@ class RoutingMode(proto.Enum): GLOBAL = 494663587 REGIONAL = 92288543 - routing_mode = proto.Field(proto.STRING, number=475143548, optional=True,) + routing_mode = proto.Field( + proto.STRING, + number=475143548, + optional=True, + ) class NetworksAddPeeringRequest(proto.Message): @@ -38035,12 +49721,27 @@ class NetworksAddPeeringRequest(proto.Message): This field is a member of `oneof`_ ``_peer_network``. """ - auto_create_routes = proto.Field(proto.BOOL, number=57454941, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) + auto_create_routes = proto.Field( + proto.BOOL, + number=57454941, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) network_peering = proto.Field( - proto.MESSAGE, number=328926767, optional=True, message="NetworkPeering", + proto.MESSAGE, + number=328926767, + optional=True, + message="NetworkPeering", + ) + peer_network = proto.Field( + proto.STRING, + number=500625489, + optional=True, ) - peer_network = proto.Field(proto.STRING, number=500625489, optional=True,) class NetworksGetEffectiveFirewallsResponse(proto.Message): @@ -38059,7 +49760,9 @@ class NetworksGetEffectiveFirewallsResponse(proto.Message): message="NetworksGetEffectiveFirewallsResponseEffectiveFirewallPolicy", ) firewalls = proto.RepeatedField( - proto.MESSAGE, number=272245619, message="Firewall", + proto.MESSAGE, + number=272245619, + message="Firewall", ) @@ -38096,13 +49799,31 @@ class Type(proto.Enum): NETWORK = 413984270 UNSPECIFIED = 526786327 - display_name = proto.Field(proto.STRING, number=4473832, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) + display_name = proto.Field( + proto.STRING, + number=4473832, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) rules = proto.RepeatedField( - proto.MESSAGE, number=108873975, message="FirewallPolicyRule", + proto.MESSAGE, + number=108873975, + message="FirewallPolicyRule", + ) + short_name = proto.Field( + proto.STRING, + number=492051566, + optional=True, + ) + type_ = proto.Field( + proto.STRING, + number=3575610, + optional=True, ) - short_name = proto.Field(proto.STRING, number=492051566, optional=True,) - type_ = proto.Field(proto.STRING, number=3575610, optional=True,) class NetworksRemovePeeringRequest(proto.Message): @@ -38116,7 +49837,11 @@ class NetworksRemovePeeringRequest(proto.Message): This field is a member of `oneof`_ ``_name``. """ - name = proto.Field(proto.STRING, number=3373707, optional=True,) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) class NetworksUpdatePeeringRequest(proto.Message): @@ -38129,7 +49854,10 @@ class NetworksUpdatePeeringRequest(proto.Message): """ network_peering = proto.Field( - proto.MESSAGE, number=328926767, optional=True, message="NetworkPeering", + proto.MESSAGE, + number=328926767, + optional=True, + message="NetworkPeering", ) @@ -38251,25 +49979,77 @@ class Status(proto.Enum): optional=True, message="NodeGroupAutoscalingPolicy", ) - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - location_hint = proto.Field(proto.STRING, number=350519505, optional=True,) - maintenance_policy = proto.Field(proto.STRING, number=528327646, optional=True,) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + fingerprint = proto.Field( + proto.STRING, + number=234678500, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + location_hint = proto.Field( + proto.STRING, + number=350519505, + optional=True, + ) + maintenance_policy = proto.Field( + proto.STRING, + number=528327646, + optional=True, + ) maintenance_window = proto.Field( proto.MESSAGE, number=186374812, optional=True, message="NodeGroupMaintenanceWindow", ) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - node_template = proto.Field(proto.STRING, number=323154455, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - size = proto.Field(proto.INT32, number=3530753, optional=True,) - status = proto.Field(proto.STRING, number=181260274, optional=True,) - zone = proto.Field(proto.STRING, number=3744684, optional=True,) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + node_template = proto.Field( + proto.STRING, + number=323154455, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + size = proto.Field( + proto.INT32, + number=3530753, + optional=True, + ) + status = proto.Field( + proto.STRING, + number=181260274, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + optional=True, + ) class NodeGroupAggregatedList(proto.Message): @@ -38314,16 +50094,41 @@ class NodeGroupAggregatedList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.MapField( - proto.STRING, proto.MESSAGE, number=100526016, message="NodeGroupsScopedList", + proto.STRING, + proto.MESSAGE, + number=100526016, + message="NodeGroupsScopedList", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - unreachables = proto.RepeatedField(proto.STRING, number=243372063,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -38360,9 +50165,21 @@ class Mode(proto.Enum): ON = 2527 ONLY_SCALE_OUT = 152713670 - max_nodes = proto.Field(proto.INT32, number=297762838, optional=True,) - min_nodes = proto.Field(proto.INT32, number=533370500, optional=True,) - mode = proto.Field(proto.STRING, number=3357091, optional=True,) + max_nodes = proto.Field( + proto.INT32, + number=297762838, + optional=True, + ) + min_nodes = proto.Field( + proto.INT32, + number=533370500, + optional=True, + ) + mode = proto.Field( + proto.STRING, + number=3357091, + optional=True, + ) class NodeGroupList(proto.Message): @@ -38404,13 +50221,36 @@ class NodeGroupList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) - items = proto.RepeatedField(proto.MESSAGE, number=100526016, message="NodeGroup",) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) + items = proto.RepeatedField( + proto.MESSAGE, + number=100526016, + message="NodeGroup", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -38435,9 +50275,16 @@ class NodeGroupMaintenanceWindow(proto.Message): """ maintenance_duration = proto.Field( - proto.MESSAGE, number=525291840, optional=True, message="Duration", + proto.MESSAGE, + number=525291840, + optional=True, + message="Duration", + ) + start_time = proto.Field( + proto.STRING, + number=37467274, + optional=True, ) - start_time = proto.Field(proto.STRING, number=37467274, optional=True,) class NodeGroupNode(proto.Message): @@ -38500,19 +50347,55 @@ class Status(proto.Enum): REPAIRING = 413483285 accelerators = proto.RepeatedField( - proto.MESSAGE, number=269577064, message="AcceleratorConfig", - ) - cpu_overcommit_type = proto.Field(proto.STRING, number=247727959, optional=True,) - disks = proto.RepeatedField(proto.MESSAGE, number=95594102, message="LocalDisk",) - instances = proto.RepeatedField(proto.STRING, number=29097598,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - node_type = proto.Field(proto.STRING, number=465832791, optional=True,) - satisfies_pzs = proto.Field(proto.BOOL, number=480964267, optional=True,) + proto.MESSAGE, + number=269577064, + message="AcceleratorConfig", + ) + cpu_overcommit_type = proto.Field( + proto.STRING, + number=247727959, + optional=True, + ) + disks = proto.RepeatedField( + proto.MESSAGE, + number=95594102, + message="LocalDisk", + ) + instances = proto.RepeatedField( + proto.STRING, + number=29097598, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + node_type = proto.Field( + proto.STRING, + number=465832791, + optional=True, + ) + satisfies_pzs = proto.Field( + proto.BOOL, + number=480964267, + optional=True, + ) server_binding = proto.Field( - proto.MESSAGE, number=208179593, optional=True, message="ServerBinding", + proto.MESSAGE, + number=208179593, + optional=True, + message="ServerBinding", + ) + server_id = proto.Field( + proto.STRING, + number=339433367, + optional=True, + ) + status = proto.Field( + proto.STRING, + number=181260274, + optional=True, ) - server_id = proto.Field(proto.STRING, number=339433367, optional=True,) - status = proto.Field(proto.STRING, number=181260274, optional=True,) class NodeGroupsAddNodesRequest(proto.Message): @@ -38526,7 +50409,11 @@ class NodeGroupsAddNodesRequest(proto.Message): This field is a member of `oneof`_ ``_additional_node_count``. """ - additional_node_count = proto.Field(proto.INT32, number=134997930, optional=True,) + additional_node_count = proto.Field( + proto.INT32, + number=134997930, + optional=True, + ) class NodeGroupsDeleteNodesRequest(proto.Message): @@ -38537,7 +50424,10 @@ class NodeGroupsDeleteNodesRequest(proto.Message): Names of the nodes to delete. """ - nodes = proto.RepeatedField(proto.STRING, number=104993457,) + nodes = proto.RepeatedField( + proto.STRING, + number=104993457, + ) class NodeGroupsListNodes(proto.Message): @@ -38580,15 +50470,36 @@ class NodeGroupsListNodes(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="NodeGroupNode", + proto.MESSAGE, + number=100526016, + message="NodeGroupNode", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -38606,10 +50517,15 @@ class NodeGroupsScopedList(proto.Message): """ node_groups = proto.RepeatedField( - proto.MESSAGE, number=73188017, message="NodeGroup", + proto.MESSAGE, + number=73188017, + message="NodeGroup", ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -38624,7 +50540,11 @@ class NodeGroupsSetNodeTemplateRequest(proto.Message): This field is a member of `oneof`_ ``_node_template``. """ - node_template = proto.Field(proto.STRING, number=323154455, optional=True,) + node_template = proto.Field( + proto.STRING, + number=323154455, + optional=True, + ) class NodeTemplate(proto.Message): @@ -38739,30 +50659,87 @@ class Status(proto.Enum): READY = 77848963 accelerators = proto.RepeatedField( - proto.MESSAGE, number=269577064, message="AcceleratorConfig", - ) - cpu_overcommit_type = proto.Field(proto.STRING, number=247727959, optional=True,) - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - disks = proto.RepeatedField(proto.MESSAGE, number=95594102, message="LocalDisk",) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - node_affinity_labels = proto.MapField(proto.STRING, proto.STRING, number=339007161,) - node_type = proto.Field(proto.STRING, number=465832791, optional=True,) + proto.MESSAGE, + number=269577064, + message="AcceleratorConfig", + ) + cpu_overcommit_type = proto.Field( + proto.STRING, + number=247727959, + optional=True, + ) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + disks = proto.RepeatedField( + proto.MESSAGE, + number=95594102, + message="LocalDisk", + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + node_affinity_labels = proto.MapField( + proto.STRING, + proto.STRING, + number=339007161, + ) + node_type = proto.Field( + proto.STRING, + number=465832791, + optional=True, + ) node_type_flexibility = proto.Field( proto.MESSAGE, number=315257905, optional=True, message="NodeTemplateNodeTypeFlexibility", ) - region = proto.Field(proto.STRING, number=138946292, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) server_binding = proto.Field( - proto.MESSAGE, number=208179593, optional=True, message="ServerBinding", + proto.MESSAGE, + number=208179593, + optional=True, + message="ServerBinding", + ) + status = proto.Field( + proto.STRING, + number=181260274, + optional=True, + ) + status_message = proto.Field( + proto.STRING, + number=297428154, + optional=True, ) - status = proto.Field(proto.STRING, number=181260274, optional=True,) - status_message = proto.Field(proto.STRING, number=297428154, optional=True,) class NodeTemplateAggregatedList(proto.Message): @@ -38807,19 +50784,41 @@ class NodeTemplateAggregatedList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.MapField( proto.STRING, proto.MESSAGE, number=100526016, message="NodeTemplatesScopedList", ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - unreachables = proto.RepeatedField(proto.STRING, number=243372063,) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -38862,15 +50861,36 @@ class NodeTemplateList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="NodeTemplate", + proto.MESSAGE, + number=100526016, + message="NodeTemplate", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -38889,9 +50909,21 @@ class NodeTemplateNodeTypeFlexibility(proto.Message): This field is a member of `oneof`_ ``_memory``. """ - cpus = proto.Field(proto.STRING, number=3060683, optional=True,) - local_ssd = proto.Field(proto.STRING, number=405741360, optional=True,) - memory = proto.Field(proto.STRING, number=532856065, optional=True,) + cpus = proto.Field( + proto.STRING, + number=3060683, + optional=True, + ) + local_ssd = proto.Field( + proto.STRING, + number=405741360, + optional=True, + ) + memory = proto.Field( + proto.STRING, + number=532856065, + optional=True, + ) class NodeTemplatesScopedList(proto.Message): @@ -38909,10 +50941,15 @@ class NodeTemplatesScopedList(proto.Message): """ node_templates = proto.RepeatedField( - proto.MESSAGE, number=354111804, message="NodeTemplate", + proto.MESSAGE, + number=354111804, + message="NodeTemplate", ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -38983,20 +51020,67 @@ class NodeType(proto.Message): This field is a member of `oneof`_ ``_zone``. """ - cpu_platform = proto.Field(proto.STRING, number=410285354, optional=True,) - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) + cpu_platform = proto.Field( + proto.STRING, + number=410285354, + optional=True, + ) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) deprecated = proto.Field( - proto.MESSAGE, number=515138995, optional=True, message="DeprecationStatus", + proto.MESSAGE, + number=515138995, + optional=True, + message="DeprecationStatus", + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + guest_cpus = proto.Field( + proto.INT32, + number=393356754, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + local_ssd_gb = proto.Field( + proto.INT32, + number=329237578, + optional=True, + ) + memory_mb = proto.Field( + proto.INT32, + number=116001171, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + optional=True, ) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - guest_cpus = proto.Field(proto.INT32, number=393356754, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - local_ssd_gb = proto.Field(proto.INT32, number=329237578, optional=True,) - memory_mb = proto.Field(proto.INT32, number=116001171, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - zone = proto.Field(proto.STRING, number=3744684, optional=True,) class NodeTypeAggregatedList(proto.Message): @@ -39041,16 +51125,41 @@ class NodeTypeAggregatedList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.MapField( - proto.STRING, proto.MESSAGE, number=100526016, message="NodeTypesScopedList", + proto.STRING, + proto.MESSAGE, + number=100526016, + message="NodeTypesScopedList", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - unreachables = proto.RepeatedField(proto.STRING, number=243372063,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -39093,13 +51202,36 @@ class NodeTypeList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) - items = proto.RepeatedField(proto.MESSAGE, number=100526016, message="NodeType",) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) + items = proto.RepeatedField( + proto.MESSAGE, + number=100526016, + message="NodeType", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -39117,10 +51249,15 @@ class NodeTypesScopedList(proto.Message): """ node_types = proto.RepeatedField( - proto.MESSAGE, number=482172924, message="NodeType", + proto.MESSAGE, + number=482172924, + message="NodeType", ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -39182,19 +51319,47 @@ class NotificationEndpoint(proto.Message): This field is a member of `oneof`_ ``_self_link``. """ - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) grpc_settings = proto.Field( proto.MESSAGE, number=456139556, optional=True, message="NotificationEndpointGrpcSettings", ) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - region = proto.Field(proto.STRING, number=138946292, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) class NotificationEndpointGrpcSettings(proto.Message): @@ -39238,13 +51403,32 @@ class NotificationEndpointGrpcSettings(proto.Message): This field is a member of `oneof`_ ``_retry_duration_sec``. """ - authority = proto.Field(proto.STRING, number=401868611, optional=True,) - endpoint = proto.Field(proto.STRING, number=130489749, optional=True,) - payload_name = proto.Field(proto.STRING, number=300358300, optional=True,) + authority = proto.Field( + proto.STRING, + number=401868611, + optional=True, + ) + endpoint = proto.Field( + proto.STRING, + number=130489749, + optional=True, + ) + payload_name = proto.Field( + proto.STRING, + number=300358300, + optional=True, + ) resend_interval = proto.Field( - proto.MESSAGE, number=478288969, optional=True, message="Duration", + proto.MESSAGE, + number=478288969, + optional=True, + message="Duration", + ) + retry_duration_sec = proto.Field( + proto.UINT32, + number=115681117, + optional=True, ) - retry_duration_sec = proto.Field(proto.UINT32, number=115681117, optional=True,) class NotificationEndpointList(proto.Message): @@ -39286,15 +51470,36 @@ class NotificationEndpointList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="NotificationEndpoint", + proto.MESSAGE, + number=100526016, + message="NotificationEndpoint", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -39450,30 +51655,128 @@ class Status(proto.Enum): PENDING = 35394935 RUNNING = 121282975 - client_operation_id = proto.Field(proto.STRING, number=297240295, optional=True,) - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - end_time = proto.Field(proto.STRING, number=114938801, optional=True,) - error = proto.Field(proto.MESSAGE, number=96784904, optional=True, message="Error",) - http_error_message = proto.Field(proto.STRING, number=202521945, optional=True,) - http_error_status_code = proto.Field(proto.INT32, number=312345196, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - insert_time = proto.Field(proto.STRING, number=433722515, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - operation_group_id = proto.Field(proto.STRING, number=40171187, optional=True,) - operation_type = proto.Field(proto.STRING, number=177650450, optional=True,) - progress = proto.Field(proto.INT32, number=72663597, optional=True,) - region = proto.Field(proto.STRING, number=138946292, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - start_time = proto.Field(proto.STRING, number=37467274, optional=True,) - status = proto.Field(proto.ENUM, number=181260274, optional=True, enum=Status,) - status_message = proto.Field(proto.STRING, number=297428154, optional=True,) - target_id = proto.Field(proto.UINT64, number=258165385, optional=True,) - target_link = proto.Field(proto.STRING, number=62671336, optional=True,) - user = proto.Field(proto.STRING, number=3599307, optional=True,) - warnings = proto.RepeatedField(proto.MESSAGE, number=498091095, message="Warnings",) - zone = proto.Field(proto.STRING, number=3744684, optional=True,) + client_operation_id = proto.Field( + proto.STRING, + number=297240295, + optional=True, + ) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + end_time = proto.Field( + proto.STRING, + number=114938801, + optional=True, + ) + error = proto.Field( + proto.MESSAGE, + number=96784904, + optional=True, + message="Error", + ) + http_error_message = proto.Field( + proto.STRING, + number=202521945, + optional=True, + ) + http_error_status_code = proto.Field( + proto.INT32, + number=312345196, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + insert_time = proto.Field( + proto.STRING, + number=433722515, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + operation_group_id = proto.Field( + proto.STRING, + number=40171187, + optional=True, + ) + operation_type = proto.Field( + proto.STRING, + number=177650450, + optional=True, + ) + progress = proto.Field( + proto.INT32, + number=72663597, + optional=True, + ) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + start_time = proto.Field( + proto.STRING, + number=37467274, + optional=True, + ) + status = proto.Field( + proto.ENUM, + number=181260274, + optional=True, + enum=Status, + ) + status_message = proto.Field( + proto.STRING, + number=297428154, + optional=True, + ) + target_id = proto.Field( + proto.UINT64, + number=258165385, + optional=True, + ) + target_link = proto.Field( + proto.STRING, + number=62671336, + optional=True, + ) + user = proto.Field( + proto.STRING, + number=3599307, + optional=True, + ) + warnings = proto.RepeatedField( + proto.MESSAGE, + number=498091095, + message="Warnings", + ) + zone = proto.Field( + proto.STRING, + number=3744684, + optional=True, + ) class OperationAggregatedList(proto.Message): @@ -39518,16 +51821,41 @@ class OperationAggregatedList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.MapField( - proto.STRING, proto.MESSAGE, number=100526016, message="OperationsScopedList", + proto.STRING, + proto.MESSAGE, + number=100526016, + message="OperationsScopedList", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - unreachables = proto.RepeatedField(proto.STRING, number=243372063,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -39570,13 +51898,36 @@ class OperationList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) - items = proto.RepeatedField(proto.MESSAGE, number=100526016, message="Operation",) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) + items = proto.RepeatedField( + proto.MESSAGE, + number=100526016, + message="Operation", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -39594,10 +51945,15 @@ class OperationsScopedList(proto.Message): """ operations = proto.RepeatedField( - proto.MESSAGE, number=4184044, message="Operation", + proto.MESSAGE, + number=4184044, + message="Operation", ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -39698,31 +52054,61 @@ class OutlierDetection(proto.Message): """ base_ejection_time = proto.Field( - proto.MESSAGE, number=80997255, optional=True, message="Duration", + proto.MESSAGE, + number=80997255, + optional=True, + message="Duration", + ) + consecutive_errors = proto.Field( + proto.INT32, + number=387193248, + optional=True, ) - consecutive_errors = proto.Field(proto.INT32, number=387193248, optional=True,) consecutive_gateway_failure = proto.Field( - proto.INT32, number=417504250, optional=True, + proto.INT32, + number=417504250, + optional=True, ) enforcing_consecutive_errors = proto.Field( - proto.INT32, number=213133760, optional=True, + proto.INT32, + number=213133760, + optional=True, ) enforcing_consecutive_gateway_failure = proto.Field( - proto.INT32, number=394440666, optional=True, + proto.INT32, + number=394440666, + optional=True, + ) + enforcing_success_rate = proto.Field( + proto.INT32, + number=194508732, + optional=True, ) - enforcing_success_rate = proto.Field(proto.INT32, number=194508732, optional=True,) interval = proto.Field( - proto.MESSAGE, number=33547461, optional=True, message="Duration", + proto.MESSAGE, + number=33547461, + optional=True, + message="Duration", + ) + max_ejection_percent = proto.Field( + proto.INT32, + number=18436888, + optional=True, ) - max_ejection_percent = proto.Field(proto.INT32, number=18436888, optional=True,) success_rate_minimum_hosts = proto.Field( - proto.INT32, number=525766903, optional=True, + proto.INT32, + number=525766903, + optional=True, ) success_rate_request_volume = proto.Field( - proto.INT32, number=281425357, optional=True, + proto.INT32, + number=281425357, + optional=True, ) success_rate_stdev_factor = proto.Field( - proto.INT32, number=174735773, optional=True, + proto.INT32, + number=174735773, + optional=True, ) @@ -39782,12 +52168,36 @@ class Type(proto.Enum): TRANSMIT = 452903600 TYPE_UNSPECIFIED = 437714322 - avg_ms = proto.Field(proto.INT64, number=204811827, optional=True,) - duration = proto.Field(proto.STRING, number=155471252, optional=True,) - max_ms = proto.Field(proto.INT64, number=529474145, optional=True,) - min_ms = proto.Field(proto.INT64, number=536564403, optional=True,) - num_intervals = proto.Field(proto.INT64, number=186329813, optional=True,) - type_ = proto.Field(proto.STRING, number=3575610, optional=True,) + avg_ms = proto.Field( + proto.INT64, + number=204811827, + optional=True, + ) + duration = proto.Field( + proto.STRING, + number=155471252, + optional=True, + ) + max_ms = proto.Field( + proto.INT64, + number=529474145, + optional=True, + ) + min_ms = proto.Field( + proto.INT64, + number=536564403, + optional=True, + ) + num_intervals = proto.Field( + proto.INT64, + number=186329813, + optional=True, + ) + type_ = proto.Field( + proto.STRING, + number=3575610, + optional=True, + ) class PacketMirroring(proto.Message): @@ -39903,30 +52313,69 @@ class Enable(proto.Enum): optional=True, message="PacketMirroringForwardingRuleInfo", ) - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - enable = proto.Field(proto.STRING, number=311764355, optional=True,) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + enable = proto.Field( + proto.STRING, + number=311764355, + optional=True, + ) filter = proto.Field( - proto.MESSAGE, number=336120696, optional=True, message="PacketMirroringFilter", + proto.MESSAGE, + number=336120696, + optional=True, + message="PacketMirroringFilter", + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, ) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) mirrored_resources = proto.Field( proto.MESSAGE, number=124817348, optional=True, message="PacketMirroringMirroredResourceInfo", ) - name = proto.Field(proto.STRING, number=3373707, optional=True,) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) network = proto.Field( proto.MESSAGE, number=232872494, optional=True, message="PacketMirroringNetworkInfo", ) - priority = proto.Field(proto.UINT32, number=445151652, optional=True,) - region = proto.Field(proto.STRING, number=138946292, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + priority = proto.Field( + proto.UINT32, + number=445151652, + optional=True, + ) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) class PacketMirroringAggregatedList(proto.Message): @@ -39969,19 +52418,41 @@ class PacketMirroringAggregatedList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.MapField( proto.STRING, proto.MESSAGE, number=100526016, message="PacketMirroringsScopedList", ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - unreachables = proto.RepeatedField(proto.STRING, number=243372063,) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -40022,9 +52493,19 @@ class Direction(proto.Enum): EGRESS = 432880501 INGRESS = 516931221 - I_p_protocols = proto.RepeatedField(proto.STRING, number=98544854,) - cidr_ranges = proto.RepeatedField(proto.STRING, number=487901697,) - direction = proto.Field(proto.STRING, number=111150975, optional=True,) + I_p_protocols = proto.RepeatedField( + proto.STRING, + number=98544854, + ) + cidr_ranges = proto.RepeatedField( + proto.STRING, + number=487901697, + ) + direction = proto.Field( + proto.STRING, + number=111150975, + optional=True, + ) class PacketMirroringForwardingRuleInfo(proto.Message): @@ -40044,8 +52525,16 @@ class PacketMirroringForwardingRuleInfo(proto.Message): This field is a member of `oneof`_ ``_url``. """ - canonical_url = proto.Field(proto.STRING, number=512294820, optional=True,) - url = proto.Field(proto.STRING, number=116079, optional=True,) + canonical_url = proto.Field( + proto.STRING, + number=512294820, + optional=True, + ) + url = proto.Field( + proto.STRING, + number=116079, + optional=True, + ) class PacketMirroringList(proto.Message): @@ -40087,15 +52576,36 @@ class PacketMirroringList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="PacketMirroring", + proto.MESSAGE, + number=100526016, + message="PacketMirroring", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -40134,7 +52644,10 @@ class PacketMirroringMirroredResourceInfo(proto.Message): number=415853125, message="PacketMirroringMirroredResourceInfoSubnetInfo", ) - tags = proto.RepeatedField(proto.STRING, number=3552281,) + tags = proto.RepeatedField( + proto.STRING, + number=3552281, + ) class PacketMirroringMirroredResourceInfoInstanceInfo(proto.Message): @@ -40153,8 +52666,16 @@ class PacketMirroringMirroredResourceInfoInstanceInfo(proto.Message): This field is a member of `oneof`_ ``_url``. """ - canonical_url = proto.Field(proto.STRING, number=512294820, optional=True,) - url = proto.Field(proto.STRING, number=116079, optional=True,) + canonical_url = proto.Field( + proto.STRING, + number=512294820, + optional=True, + ) + url = proto.Field( + proto.STRING, + number=116079, + optional=True, + ) class PacketMirroringMirroredResourceInfoSubnetInfo(proto.Message): @@ -40174,8 +52695,16 @@ class PacketMirroringMirroredResourceInfoSubnetInfo(proto.Message): This field is a member of `oneof`_ ``_url``. """ - canonical_url = proto.Field(proto.STRING, number=512294820, optional=True,) - url = proto.Field(proto.STRING, number=116079, optional=True,) + canonical_url = proto.Field( + proto.STRING, + number=512294820, + optional=True, + ) + url = proto.Field( + proto.STRING, + number=116079, + optional=True, + ) class PacketMirroringNetworkInfo(proto.Message): @@ -40193,8 +52722,16 @@ class PacketMirroringNetworkInfo(proto.Message): This field is a member of `oneof`_ ``_url``. """ - canonical_url = proto.Field(proto.STRING, number=512294820, optional=True,) - url = proto.Field(proto.STRING, number=116079, optional=True,) + canonical_url = proto.Field( + proto.STRING, + number=512294820, + optional=True, + ) + url = proto.Field( + proto.STRING, + number=116079, + optional=True, + ) class PacketMirroringsScopedList(proto.Message): @@ -40212,10 +52749,15 @@ class PacketMirroringsScopedList(proto.Message): """ packet_mirrorings = proto.RepeatedField( - proto.MESSAGE, number=154615079, message="PacketMirroring", + proto.MESSAGE, + number=154615079, + message="PacketMirroring", ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -40254,13 +52796,29 @@ class PatchAutoscalerRequest(proto.Message): Name of the zone for this request. """ - autoscaler = proto.Field(proto.STRING, number=517258967, optional=True,) + autoscaler = proto.Field( + proto.STRING, + number=517258967, + optional=True, + ) autoscaler_resource = proto.Field( - proto.MESSAGE, number=207616118, message="Autoscaler", + proto.MESSAGE, + number=207616118, + message="Autoscaler", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) class PatchBackendBucketRequest(proto.Message): @@ -40294,12 +52852,24 @@ class PatchBackendBucketRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - backend_bucket = proto.Field(proto.STRING, number=91714037,) + backend_bucket = proto.Field( + proto.STRING, + number=91714037, + ) backend_bucket_resource = proto.Field( - proto.MESSAGE, number=380757784, message="BackendBucket", + proto.MESSAGE, + number=380757784, + message="BackendBucket", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class PatchBackendServiceRequest(proto.Message): @@ -40333,12 +52903,24 @@ class PatchBackendServiceRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - backend_service = proto.Field(proto.STRING, number=306946058,) + backend_service = proto.Field( + proto.STRING, + number=306946058, + ) backend_service_resource = proto.Field( - proto.MESSAGE, number=347586723, message="BackendService", + proto.MESSAGE, + number=347586723, + message="BackendService", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class PatchFirewallPolicyRequest(proto.Message): @@ -40370,11 +52952,20 @@ class PatchFirewallPolicyRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - firewall_policy = proto.Field(proto.STRING, number=498173265,) + firewall_policy = proto.Field( + proto.STRING, + number=498173265, + ) firewall_policy_resource = proto.Field( - proto.MESSAGE, number=495049532, message="FirewallPolicy", + proto.MESSAGE, + number=495049532, + message="FirewallPolicy", + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class PatchFirewallRequest(proto.Message): @@ -40408,10 +52999,24 @@ class PatchFirewallRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - firewall = proto.Field(proto.STRING, number=511016192,) - firewall_resource = proto.Field(proto.MESSAGE, number=41425005, message="Firewall",) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + firewall = proto.Field( + proto.STRING, + number=511016192, + ) + firewall_resource = proto.Field( + proto.MESSAGE, + number=41425005, + message="Firewall", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class PatchForwardingRuleRequest(proto.Message): @@ -40447,13 +53052,28 @@ class PatchForwardingRuleRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - forwarding_rule = proto.Field(proto.STRING, number=269964030,) + forwarding_rule = proto.Field( + proto.STRING, + number=269964030, + ) forwarding_rule_resource = proto.Field( - proto.MESSAGE, number=301211695, message="ForwardingRule", + proto.MESSAGE, + number=301211695, + message="ForwardingRule", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class PatchGlobalForwardingRuleRequest(proto.Message): @@ -40487,12 +53107,24 @@ class PatchGlobalForwardingRuleRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - forwarding_rule = proto.Field(proto.STRING, number=269964030,) + forwarding_rule = proto.Field( + proto.STRING, + number=269964030, + ) forwarding_rule_resource = proto.Field( - proto.MESSAGE, number=301211695, message="ForwardingRule", + proto.MESSAGE, + number=301211695, + message="ForwardingRule", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class PatchGlobalPublicDelegatedPrefixeRequest(proto.Message): @@ -40527,12 +53159,24 @@ class PatchGlobalPublicDelegatedPrefixeRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - project = proto.Field(proto.STRING, number=227560217,) - public_delegated_prefix = proto.Field(proto.STRING, number=204238440,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + public_delegated_prefix = proto.Field( + proto.STRING, + number=204238440, + ) public_delegated_prefix_resource = proto.Field( - proto.MESSAGE, number=47594501, message="PublicDelegatedPrefix", + proto.MESSAGE, + number=47594501, + message="PublicDelegatedPrefix", + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class PatchHealthCheckRequest(proto.Message): @@ -40566,12 +53210,24 @@ class PatchHealthCheckRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - health_check = proto.Field(proto.STRING, number=308876645,) + health_check = proto.Field( + proto.STRING, + number=308876645, + ) health_check_resource = proto.Field( - proto.MESSAGE, number=201925032, message="HealthCheck", + proto.MESSAGE, + number=201925032, + message="HealthCheck", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class PatchImageRequest(proto.Message): @@ -40605,10 +53261,24 @@ class PatchImageRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - image = proto.Field(proto.STRING, number=100313435,) - image_resource = proto.Field(proto.MESSAGE, number=371171954, message="Image",) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + image = proto.Field( + proto.STRING, + number=100313435, + ) + image_resource = proto.Field( + proto.MESSAGE, + number=371171954, + message="Image", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class PatchInstanceGroupManagerRequest(proto.Message): @@ -40645,13 +53315,28 @@ class PatchInstanceGroupManagerRequest(proto.Message): the managed instance group. """ - instance_group_manager = proto.Field(proto.STRING, number=249363395,) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) instance_group_manager_resource = proto.Field( - proto.MESSAGE, number=261063946, message="InstanceGroupManager", + proto.MESSAGE, + number=261063946, + message="InstanceGroupManager", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) class PatchInterconnectAttachmentRequest(proto.Message): @@ -40687,13 +53372,28 @@ class PatchInterconnectAttachmentRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - interconnect_attachment = proto.Field(proto.STRING, number=308135284,) + interconnect_attachment = proto.Field( + proto.STRING, + number=308135284, + ) interconnect_attachment_resource = proto.Field( - proto.MESSAGE, number=212341369, message="InterconnectAttachment", + proto.MESSAGE, + number=212341369, + message="InterconnectAttachment", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class PatchInterconnectRequest(proto.Message): @@ -40727,12 +53427,24 @@ class PatchInterconnectRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - interconnect = proto.Field(proto.STRING, number=224601230,) + interconnect = proto.Field( + proto.STRING, + number=224601230, + ) interconnect_resource = proto.Field( - proto.MESSAGE, number=397611167, message="Interconnect", + proto.MESSAGE, + number=397611167, + message="Interconnect", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class PatchNetworkRequest(proto.Message): @@ -40766,10 +53478,24 @@ class PatchNetworkRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - network = proto.Field(proto.STRING, number=232872494,) - network_resource = proto.Field(proto.MESSAGE, number=122105599, message="Network",) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + network = proto.Field( + proto.STRING, + number=232872494, + ) + network_resource = proto.Field( + proto.MESSAGE, + number=122105599, + message="Network", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class PatchNodeGroupRequest(proto.Message): @@ -40805,13 +53531,28 @@ class PatchNodeGroupRequest(proto.Message): The name of the zone for this request. """ - node_group = proto.Field(proto.STRING, number=469958146,) + node_group = proto.Field( + proto.STRING, + number=469958146, + ) node_group_resource = proto.Field( - proto.MESSAGE, number=505321899, message="NodeGroup", + proto.MESSAGE, + number=505321899, + message="NodeGroup", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) class PatchPacketMirroringRequest(proto.Message): @@ -40848,13 +53589,28 @@ class PatchPacketMirroringRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - packet_mirroring = proto.Field(proto.STRING, number=22305996,) + packet_mirroring = proto.Field( + proto.STRING, + number=22305996, + ) packet_mirroring_resource = proto.Field( - proto.MESSAGE, number=493501985, message="PacketMirroring", + proto.MESSAGE, + number=493501985, + message="PacketMirroring", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class PatchPerInstanceConfigsInstanceGroupManagerRequest(proto.Message): @@ -40894,15 +53650,28 @@ class PatchPerInstanceConfigsInstanceGroupManagerRequest(proto.Message): RFC1035. """ - instance_group_manager = proto.Field(proto.STRING, number=249363395,) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) instance_group_managers_patch_per_instance_configs_req_resource = proto.Field( proto.MESSAGE, number=356650495, message="InstanceGroupManagersPatchPerInstanceConfigsReq", ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class PatchPerInstanceConfigsRegionInstanceGroupManagerRequest(proto.Message): @@ -40941,15 +53710,28 @@ class PatchPerInstanceConfigsRegionInstanceGroupManagerRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - instance_group_manager = proto.Field(proto.STRING, number=249363395,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) region_instance_group_manager_patch_instance_config_req_resource = proto.Field( proto.MESSAGE, number=197682890, message="RegionInstanceGroupManagerPatchInstanceConfigReq", ) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class PatchPublicAdvertisedPrefixeRequest(proto.Message): @@ -40984,12 +53766,24 @@ class PatchPublicAdvertisedPrefixeRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - project = proto.Field(proto.STRING, number=227560217,) - public_advertised_prefix = proto.Field(proto.STRING, number=101874590,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + public_advertised_prefix = proto.Field( + proto.STRING, + number=101874590, + ) public_advertised_prefix_resource = proto.Field( - proto.MESSAGE, number=233614223, message="PublicAdvertisedPrefix", + proto.MESSAGE, + number=233614223, + message="PublicAdvertisedPrefix", + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class PatchPublicDelegatedPrefixeRequest(proto.Message): @@ -41026,13 +53820,28 @@ class PatchPublicDelegatedPrefixeRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - project = proto.Field(proto.STRING, number=227560217,) - public_delegated_prefix = proto.Field(proto.STRING, number=204238440,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + public_delegated_prefix = proto.Field( + proto.STRING, + number=204238440, + ) public_delegated_prefix_resource = proto.Field( - proto.MESSAGE, number=47594501, message="PublicDelegatedPrefix", + proto.MESSAGE, + number=47594501, + message="PublicDelegatedPrefix", + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class PatchRegionAutoscalerRequest(proto.Message): @@ -41070,13 +53879,29 @@ class PatchRegionAutoscalerRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - autoscaler = proto.Field(proto.STRING, number=517258967, optional=True,) + autoscaler = proto.Field( + proto.STRING, + number=517258967, + optional=True, + ) autoscaler_resource = proto.Field( - proto.MESSAGE, number=207616118, message="Autoscaler", + proto.MESSAGE, + number=207616118, + message="Autoscaler", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class PatchRegionBackendServiceRequest(proto.Message): @@ -41112,13 +53937,28 @@ class PatchRegionBackendServiceRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - backend_service = proto.Field(proto.STRING, number=306946058,) + backend_service = proto.Field( + proto.STRING, + number=306946058, + ) backend_service_resource = proto.Field( - proto.MESSAGE, number=347586723, message="BackendService", + proto.MESSAGE, + number=347586723, + message="BackendService", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class PatchRegionHealthCheckRequest(proto.Message): @@ -41154,13 +53994,28 @@ class PatchRegionHealthCheckRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - health_check = proto.Field(proto.STRING, number=308876645,) + health_check = proto.Field( + proto.STRING, + number=308876645, + ) health_check_resource = proto.Field( - proto.MESSAGE, number=201925032, message="HealthCheck", + proto.MESSAGE, + number=201925032, + message="HealthCheck", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class PatchRegionHealthCheckServiceRequest(proto.Message): @@ -41198,13 +54053,28 @@ class PatchRegionHealthCheckServiceRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - health_check_service = proto.Field(proto.STRING, number=408374747,) + health_check_service = proto.Field( + proto.STRING, + number=408374747, + ) health_check_service_resource = proto.Field( - proto.MESSAGE, number=477367794, message="HealthCheckService", + proto.MESSAGE, + number=477367794, + message="HealthCheckService", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class PatchRegionInstanceGroupManagerRequest(proto.Message): @@ -41240,13 +54110,28 @@ class PatchRegionInstanceGroupManagerRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - instance_group_manager = proto.Field(proto.STRING, number=249363395,) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) instance_group_manager_resource = proto.Field( - proto.MESSAGE, number=261063946, message="InstanceGroupManager", + proto.MESSAGE, + number=261063946, + message="InstanceGroupManager", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class PatchRegionUrlMapRequest(proto.Message): @@ -41269,11 +54154,28 @@ class PatchRegionUrlMapRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - url_map = proto.Field(proto.STRING, number=367020684,) - url_map_resource = proto.Field(proto.MESSAGE, number=168675425, message="UrlMap",) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + url_map = proto.Field( + proto.STRING, + number=367020684, + ) + url_map_resource = proto.Field( + proto.MESSAGE, + number=168675425, + message="UrlMap", + ) class PatchRouterRequest(proto.Message): @@ -41309,11 +54211,28 @@ class PatchRouterRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - router = proto.Field(proto.STRING, number=148608841,) - router_resource = proto.Field(proto.MESSAGE, number=155222084, message="Router",) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + router = proto.Field( + proto.STRING, + number=148608841, + ) + router_resource = proto.Field( + proto.MESSAGE, + number=155222084, + message="Router", + ) class PatchRuleFirewallPolicyRequest(proto.Message): @@ -41349,12 +54268,25 @@ class PatchRuleFirewallPolicyRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - firewall_policy = proto.Field(proto.STRING, number=498173265,) + firewall_policy = proto.Field( + proto.STRING, + number=498173265, + ) firewall_policy_rule_resource = proto.Field( - proto.MESSAGE, number=250523523, message="FirewallPolicyRule", + proto.MESSAGE, + number=250523523, + message="FirewallPolicyRule", + ) + priority = proto.Field( + proto.INT32, + number=445151652, + optional=True, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - priority = proto.Field(proto.INT32, number=445151652, optional=True,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class PatchRuleSecurityPolicyRequest(proto.Message): @@ -41374,11 +54306,23 @@ class PatchRuleSecurityPolicyRequest(proto.Message): The body resource for this request """ - priority = proto.Field(proto.INT32, number=445151652, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - security_policy = proto.Field(proto.STRING, number=171082513,) + priority = proto.Field( + proto.INT32, + number=445151652, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + security_policy = proto.Field( + proto.STRING, + number=171082513, + ) security_policy_rule_resource = proto.Field( - proto.MESSAGE, number=402693443, message="SecurityPolicyRule", + proto.MESSAGE, + number=402693443, + message="SecurityPolicyRule", ) @@ -41413,11 +54357,23 @@ class PatchSecurityPolicyRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - security_policy = proto.Field(proto.STRING, number=171082513,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + security_policy = proto.Field( + proto.STRING, + number=171082513, + ) security_policy_resource = proto.Field( - proto.MESSAGE, number=216159612, message="SecurityPolicy", + proto.MESSAGE, + number=216159612, + message="SecurityPolicy", ) @@ -41458,12 +54414,27 @@ class PatchServiceAttachmentRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - service_attachment = proto.Field(proto.STRING, number=338957549,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + service_attachment = proto.Field( + proto.STRING, + number=338957549, + ) service_attachment_resource = proto.Field( - proto.MESSAGE, number=472980256, message="ServiceAttachment", + proto.MESSAGE, + number=472980256, + message="ServiceAttachment", ) @@ -41500,11 +54471,23 @@ class PatchSslPolicyRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - ssl_policy = proto.Field(proto.STRING, number=295190213,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + ssl_policy = proto.Field( + proto.STRING, + number=295190213, + ) ssl_policy_resource = proto.Field( - proto.MESSAGE, number=274891848, message="SslPolicy", + proto.MESSAGE, + number=274891848, + message="SslPolicy", ) @@ -41554,13 +54537,32 @@ class PatchSubnetworkRequest(proto.Message): The body resource for this request """ - drain_timeout_seconds = proto.Field(proto.INT32, number=357707098, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - subnetwork = proto.Field(proto.STRING, number=307827694,) + drain_timeout_seconds = proto.Field( + proto.INT32, + number=357707098, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + subnetwork = proto.Field( + proto.STRING, + number=307827694, + ) subnetwork_resource = proto.Field( - proto.MESSAGE, number=42233151, message="Subnetwork", + proto.MESSAGE, + number=42233151, + message="Subnetwork", ) @@ -41596,11 +54598,23 @@ class PatchTargetGrpcProxyRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - target_grpc_proxy = proto.Field(proto.STRING, number=5020283,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + target_grpc_proxy = proto.Field( + proto.STRING, + number=5020283, + ) target_grpc_proxy_resource = proto.Field( - proto.MESSAGE, number=328922450, message="TargetGrpcProxy", + proto.MESSAGE, + number=328922450, + message="TargetGrpcProxy", ) @@ -41636,11 +54650,23 @@ class PatchTargetHttpProxyRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - target_http_proxy = proto.Field(proto.STRING, number=206872421,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + target_http_proxy = proto.Field( + proto.STRING, + number=206872421, + ) target_http_proxy_resource = proto.Field( - proto.MESSAGE, number=24696744, message="TargetHttpProxy", + proto.MESSAGE, + number=24696744, + message="TargetHttpProxy", ) @@ -41676,11 +54702,23 @@ class PatchTargetHttpsProxyRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - target_https_proxy = proto.Field(proto.STRING, number=52336748,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + target_https_proxy = proto.Field( + proto.STRING, + number=52336748, + ) target_https_proxy_resource = proto.Field( - proto.MESSAGE, number=433657473, message="TargetHttpsProxy", + proto.MESSAGE, + number=433657473, + message="TargetHttpsProxy", ) @@ -41715,10 +54753,24 @@ class PatchUrlMapRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - url_map = proto.Field(proto.STRING, number=367020684,) - url_map_resource = proto.Field(proto.MESSAGE, number=168675425, message="UrlMap",) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + url_map = proto.Field( + proto.STRING, + number=367020684, + ) + url_map_resource = proto.Field( + proto.MESSAGE, + number=168675425, + message="UrlMap", + ) class PathMatcher(proto.Message): @@ -41823,22 +54875,47 @@ class PathMatcher(proto.Message): """ default_route_action = proto.Field( - proto.MESSAGE, number=378919466, optional=True, message="HttpRouteAction", + proto.MESSAGE, + number=378919466, + optional=True, + message="HttpRouteAction", + ) + default_service = proto.Field( + proto.STRING, + number=370242231, + optional=True, ) - default_service = proto.Field(proto.STRING, number=370242231, optional=True,) default_url_redirect = proto.Field( - proto.MESSAGE, number=359503338, optional=True, message="HttpRedirectAction", + proto.MESSAGE, + number=359503338, + optional=True, + message="HttpRedirectAction", + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, ) - description = proto.Field(proto.STRING, number=422937596, optional=True,) header_action = proto.Field( - proto.MESSAGE, number=328077352, optional=True, message="HttpHeaderAction", + proto.MESSAGE, + number=328077352, + optional=True, + message="HttpHeaderAction", + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, ) - name = proto.Field(proto.STRING, number=3373707, optional=True,) path_rules = proto.RepeatedField( - proto.MESSAGE, number=104439901, message="PathRule", + proto.MESSAGE, + number=104439901, + message="PathRule", ) route_rules = proto.RepeatedField( - proto.MESSAGE, number=376292225, message="HttpRouteRule", + proto.MESSAGE, + number=376292225, + message="HttpRouteRule", ) @@ -41894,13 +54971,26 @@ class PathRule(proto.Message): This field is a member of `oneof`_ ``_url_redirect``. """ - paths = proto.RepeatedField(proto.STRING, number=106438894,) + paths = proto.RepeatedField( + proto.STRING, + number=106438894, + ) route_action = proto.Field( - proto.MESSAGE, number=424563948, optional=True, message="HttpRouteAction", + proto.MESSAGE, + number=424563948, + optional=True, + message="HttpRouteAction", + ) + service = proto.Field( + proto.STRING, + number=373540533, + optional=True, ) - service = proto.Field(proto.STRING, number=373540533, optional=True,) url_redirect = proto.Field( - proto.MESSAGE, number=405147820, optional=True, message="HttpRedirectAction", + proto.MESSAGE, + number=405147820, + optional=True, + message="HttpRedirectAction", ) @@ -41957,12 +55047,27 @@ class Status(proto.Enum): UNAPPLIED = 483935140 UNAPPLIED_DELETION = 313956873 - fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) + fingerprint = proto.Field( + proto.STRING, + number=234678500, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) preserved_state = proto.Field( - proto.MESSAGE, number=2634026, optional=True, message="PreservedState", + proto.MESSAGE, + number=2634026, + optional=True, + message="PreservedState", + ) + status = proto.Field( + proto.STRING, + number=181260274, + optional=True, ) - status = proto.Field(proto.STRING, number=181260274, optional=True,) class Policy(proto.Message): @@ -42069,13 +55174,35 @@ class Policy(proto.Message): """ audit_configs = proto.RepeatedField( - proto.MESSAGE, number=328080653, message="AuditConfig", + proto.MESSAGE, + number=328080653, + message="AuditConfig", + ) + bindings = proto.RepeatedField( + proto.MESSAGE, + number=403251854, + message="Binding", + ) + etag = proto.Field( + proto.STRING, + number=3123477, + optional=True, + ) + iam_owned = proto.Field( + proto.BOOL, + number=450566203, + optional=True, + ) + rules = proto.RepeatedField( + proto.MESSAGE, + number=108873975, + message="Rule", + ) + version = proto.Field( + proto.INT32, + number=351608024, + optional=True, ) - bindings = proto.RepeatedField(proto.MESSAGE, number=403251854, message="Binding",) - etag = proto.Field(proto.STRING, number=3123477, optional=True,) - iam_owned = proto.Field(proto.BOOL, number=450566203, optional=True,) - rules = proto.RepeatedField(proto.MESSAGE, number=108873975, message="Rule",) - version = proto.Field(proto.INT32, number=351608024, optional=True,) class PreconfiguredWafSet(proto.Message): @@ -42088,7 +55215,9 @@ class PreconfiguredWafSet(proto.Message): """ expression_sets = proto.RepeatedField( - proto.MESSAGE, number=474011032, message="WafExpressionSet", + proto.MESSAGE, + number=474011032, + message="WafExpressionSet", ) @@ -42110,7 +55239,11 @@ class PreservedState(proto.Message): number=95594102, message="PreservedStatePreservedDisk", ) - metadata = proto.MapField(proto.STRING, proto.STRING, number=86866735,) + metadata = proto.MapField( + proto.STRING, + proto.STRING, + number=86866735, + ) class PreservedStatePreservedDisk(proto.Message): @@ -42161,9 +55294,21 @@ class Mode(proto.Enum): READ_ONLY = 91950261 READ_WRITE = 173607894 - auto_delete = proto.Field(proto.STRING, number=464761403, optional=True,) - mode = proto.Field(proto.STRING, number=3357091, optional=True,) - source = proto.Field(proto.STRING, number=177235995, optional=True,) + auto_delete = proto.Field( + proto.STRING, + number=464761403, + optional=True, + ) + mode = proto.Field( + proto.STRING, + number=3357091, + optional=True, + ) + source = proto.Field( + proto.STRING, + number=177235995, + optional=True, + ) class PreviewRouterRequest(proto.Message): @@ -42181,10 +55326,23 @@ class PreviewRouterRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - router = proto.Field(proto.STRING, number=148608841,) - router_resource = proto.Field(proto.MESSAGE, number=155222084, message="Router",) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + router = proto.Field( + proto.STRING, + number=148608841, + ) + router_resource = proto.Field( + proto.MESSAGE, + number=155222084, + message="Router", + ) class Project(proto.Message): @@ -42287,24 +55445,71 @@ class XpnProjectStatus(proto.Enum): UNSPECIFIED_XPN_PROJECT_STATUS = 340393257 common_instance_metadata = proto.Field( - proto.MESSAGE, number=185794117, optional=True, message="Metadata", + proto.MESSAGE, + number=185794117, + optional=True, + message="Metadata", + ) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + default_network_tier = proto.Field( + proto.STRING, + number=471753361, + optional=True, ) - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - default_network_tier = proto.Field(proto.STRING, number=471753361, optional=True,) default_service_account = proto.Field( - proto.STRING, number=298712229, optional=True, - ) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - enabled_features = proto.RepeatedField(proto.STRING, number=469017467,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - quotas = proto.RepeatedField(proto.MESSAGE, number=125341947, message="Quota",) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + proto.STRING, + number=298712229, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + enabled_features = proto.RepeatedField( + proto.STRING, + number=469017467, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + quotas = proto.RepeatedField( + proto.MESSAGE, + number=125341947, + message="Quota", + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) usage_export_location = proto.Field( - proto.MESSAGE, number=347543874, optional=True, message="UsageExportLocation", + proto.MESSAGE, + number=347543874, + optional=True, + message="UsageExportLocation", + ) + xpn_project_status = proto.Field( + proto.STRING, + number=228419265, + optional=True, ) - xpn_project_status = proto.Field(proto.STRING, number=228419265, optional=True,) class ProjectsDisableXpnResourceRequest(proto.Message): @@ -42318,7 +55523,10 @@ class ProjectsDisableXpnResourceRequest(proto.Message): """ xpn_resource = proto.Field( - proto.MESSAGE, number=133384631, optional=True, message="XpnResourceId", + proto.MESSAGE, + number=133384631, + optional=True, + message="XpnResourceId", ) @@ -42333,7 +55541,10 @@ class ProjectsEnableXpnResourceRequest(proto.Message): """ xpn_resource = proto.Field( - proto.MESSAGE, number=133384631, optional=True, message="XpnResourceId", + proto.MESSAGE, + number=133384631, + optional=True, + message="XpnResourceId", ) @@ -42366,10 +55577,20 @@ class ProjectsGetXpnResources(proto.Message): def raw_page(self): return self - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) resources = proto.RepeatedField( - proto.MESSAGE, number=164412965, message="XpnResourceId", + proto.MESSAGE, + number=164412965, + message="XpnResourceId", ) @@ -42386,7 +55607,11 @@ class ProjectsListXpnHostsRequest(proto.Message): This field is a member of `oneof`_ ``_organization``. """ - organization = proto.Field(proto.STRING, number=105180467, optional=True,) + organization = proto.Field( + proto.STRING, + number=105180467, + optional=True, + ) class ProjectsSetDefaultNetworkTierRequest(proto.Message): @@ -42409,7 +55634,11 @@ class NetworkTier(proto.Enum): STANDARD = 484642493 STANDARD_OVERRIDES_FIXED_STANDARD = 465847234 - network_tier = proto.Field(proto.STRING, number=517397843, optional=True,) + network_tier = proto.Field( + proto.STRING, + number=517397843, + optional=True, + ) class PublicAdvertisedPrefix(proto.Message): @@ -42521,22 +55750,66 @@ class Status(proto.Enum): REVERSE_DNS_LOOKUP_FAILED = 295755183 VALIDATED = 66197998 - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - dns_verification_ip = proto.Field(proto.STRING, number=241011381, optional=True,) - fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - ip_cidr_range = proto.Field(proto.STRING, number=98117322, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + dns_verification_ip = proto.Field( + proto.STRING, + number=241011381, + optional=True, + ) + fingerprint = proto.Field( + proto.STRING, + number=234678500, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + ip_cidr_range = proto.Field( + proto.STRING, + number=98117322, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) public_delegated_prefixs = proto.RepeatedField( proto.MESSAGE, number=425811723, message="PublicAdvertisedPrefixPublicDelegatedPrefix", ) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - shared_secret = proto.Field(proto.STRING, number=381932490, optional=True,) - status = proto.Field(proto.STRING, number=181260274, optional=True,) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + shared_secret = proto.Field( + proto.STRING, + number=381932490, + optional=True, + ) + status = proto.Field( + proto.STRING, + number=181260274, + optional=True, + ) class PublicAdvertisedPrefixList(proto.Message): @@ -42579,15 +55852,36 @@ class PublicAdvertisedPrefixList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="PublicAdvertisedPrefix", + proto.MESSAGE, + number=100526016, + message="PublicAdvertisedPrefix", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -42625,11 +55919,31 @@ class PublicAdvertisedPrefixPublicDelegatedPrefix(proto.Message): This field is a member of `oneof`_ ``_status``. """ - ip_range = proto.Field(proto.STRING, number=145092645, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - project = proto.Field(proto.STRING, number=227560217, optional=True,) - region = proto.Field(proto.STRING, number=138946292, optional=True,) - status = proto.Field(proto.STRING, number=181260274, optional=True,) + ip_range = proto.Field( + proto.STRING, + number=145092645, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + optional=True, + ) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) + status = proto.Field( + proto.STRING, + number=181260274, + optional=True, + ) class PublicDelegatedPrefix(proto.Message): @@ -42743,23 +56057,71 @@ class Status(proto.Enum): INITIALIZING = 306588749 READY_TO_ANNOUNCE = 64641265 - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - ip_cidr_range = proto.Field(proto.STRING, number=98117322, optional=True,) - is_live_migration = proto.Field(proto.BOOL, number=511823856, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - parent_prefix = proto.Field(proto.STRING, number=15233991, optional=True,) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + fingerprint = proto.Field( + proto.STRING, + number=234678500, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + ip_cidr_range = proto.Field( + proto.STRING, + number=98117322, + optional=True, + ) + is_live_migration = proto.Field( + proto.BOOL, + number=511823856, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + parent_prefix = proto.Field( + proto.STRING, + number=15233991, + optional=True, + ) public_delegated_sub_prefixs = proto.RepeatedField( proto.MESSAGE, number=188940044, message="PublicDelegatedPrefixPublicDelegatedSubPrefix", ) - region = proto.Field(proto.STRING, number=138946292, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - status = proto.Field(proto.STRING, number=181260274, optional=True,) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + status = proto.Field( + proto.STRING, + number=181260274, + optional=True, + ) class PublicDelegatedPrefixAggregatedList(proto.Message): @@ -42805,19 +56167,41 @@ class PublicDelegatedPrefixAggregatedList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.MapField( proto.STRING, proto.MESSAGE, number=100526016, message="PublicDelegatedPrefixesScopedList", ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - unreachables = proto.RepeatedField(proto.STRING, number=243372063,) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -42861,15 +56245,36 @@ class PublicDelegatedPrefixList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="PublicDelegatedPrefix", + proto.MESSAGE, + number=100526016, + message="PublicDelegatedPrefix", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -42920,13 +56325,41 @@ class Status(proto.Enum): ACTIVE = 314733318 INACTIVE = 270421099 - delegatee_project = proto.Field(proto.STRING, number=414860634, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - ip_cidr_range = proto.Field(proto.STRING, number=98117322, optional=True,) - is_address = proto.Field(proto.BOOL, number=352617951, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - region = proto.Field(proto.STRING, number=138946292, optional=True,) - status = proto.Field(proto.STRING, number=181260274, optional=True,) + delegatee_project = proto.Field( + proto.STRING, + number=414860634, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + ip_cidr_range = proto.Field( + proto.STRING, + number=98117322, + optional=True, + ) + is_address = proto.Field( + proto.BOOL, + number=352617951, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) + status = proto.Field( + proto.STRING, + number=181260274, + optional=True, + ) class PublicDelegatedPrefixesScopedList(proto.Message): @@ -42944,10 +56377,15 @@ class PublicDelegatedPrefixesScopedList(proto.Message): """ public_delegated_prefixes = proto.RepeatedField( - proto.MESSAGE, number=315261206, message="PublicDelegatedPrefix", + proto.MESSAGE, + number=315261206, + message="PublicDelegatedPrefix", ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -43107,10 +56545,26 @@ class Metric(proto.Enum): VPN_TUNNELS = 104327296 XPN_SERVICE_PROJECTS = 95191981 - limit = proto.Field(proto.DOUBLE, number=102976443, optional=True,) - metric = proto.Field(proto.STRING, number=533067184, optional=True,) - owner = proto.Field(proto.STRING, number=106164915, optional=True,) - usage = proto.Field(proto.DOUBLE, number=111574433, optional=True,) + limit = proto.Field( + proto.DOUBLE, + number=102976443, + optional=True, + ) + metric = proto.Field( + proto.STRING, + number=533067184, + optional=True, + ) + owner = proto.Field( + proto.STRING, + number=106164915, + optional=True, + ) + usage = proto.Field( + proto.DOUBLE, + number=111574433, + optional=True, + ) class RawDisk(proto.Message): @@ -43155,9 +56609,21 @@ class ContainerType(proto.Enum): UNDEFINED_CONTAINER_TYPE = 0 TAR = 82821 - container_type = proto.Field(proto.STRING, number=318809144, optional=True,) - sha1_checksum = proto.Field(proto.STRING, number=314444349, optional=True,) - source = proto.Field(proto.STRING, number=177235995, optional=True,) + container_type = proto.Field( + proto.STRING, + number=318809144, + optional=True, + ) + sha1_checksum = proto.Field( + proto.STRING, + number=314444349, + optional=True, + ) + source = proto.Field( + proto.STRING, + number=177235995, + optional=True, + ) class RecreateInstancesInstanceGroupManagerRequest(proto.Message): @@ -43195,15 +56661,28 @@ class RecreateInstancesInstanceGroupManagerRequest(proto.Message): instance group is located. """ - instance_group_manager = proto.Field(proto.STRING, number=249363395,) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) instance_group_managers_recreate_instances_request_resource = proto.Field( proto.MESSAGE, number=21405952, message="InstanceGroupManagersRecreateInstancesRequest", ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class RecreateInstancesRegionInstanceGroupManagerRequest(proto.Message): @@ -43240,15 +56719,28 @@ class RecreateInstancesRegionInstanceGroupManagerRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - instance_group_manager = proto.Field(proto.STRING, number=249363395,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) region_instance_group_managers_recreate_request_resource = proto.Field( proto.MESSAGE, number=170999316, message="RegionInstanceGroupManagersRecreateRequest", ) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class Reference(proto.Message): @@ -43277,10 +56769,26 @@ class Reference(proto.Message): This field is a member of `oneof`_ ``_target``. """ - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - reference_type = proto.Field(proto.STRING, number=247521198, optional=True,) - referrer = proto.Field(proto.STRING, number=351173663, optional=True,) - target = proto.Field(proto.STRING, number=192835985, optional=True,) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + reference_type = proto.Field( + proto.STRING, + number=247521198, + optional=True, + ) + referrer = proto.Field( + proto.STRING, + number=351173663, + optional=True, + ) + target = proto.Field( + proto.STRING, + number=192835985, + optional=True, + ) class Region(proto.Message): @@ -43342,19 +56850,61 @@ class Status(proto.Enum): DOWN = 2104482 UP = 2715 - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) deprecated = proto.Field( - proto.MESSAGE, number=515138995, optional=True, message="DeprecationStatus", + proto.MESSAGE, + number=515138995, + optional=True, + message="DeprecationStatus", + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + quotas = proto.RepeatedField( + proto.MESSAGE, + number=125341947, + message="Quota", + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + status = proto.Field( + proto.STRING, + number=181260274, + optional=True, + ) + supports_pzs = proto.Field( + proto.BOOL, + number=83983214, + optional=True, + ) + zones = proto.RepeatedField( + proto.STRING, + number=116085319, ) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - quotas = proto.RepeatedField(proto.MESSAGE, number=125341947, message="Quota",) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - status = proto.Field(proto.STRING, number=181260274, optional=True,) - supports_pzs = proto.Field(proto.BOOL, number=83983214, optional=True,) - zones = proto.RepeatedField(proto.STRING, number=116085319,) class RegionAutoscalerList(proto.Message): @@ -43395,13 +56945,36 @@ class RegionAutoscalerList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) - items = proto.RepeatedField(proto.MESSAGE, number=100526016, message="Autoscaler",) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) + items = proto.RepeatedField( + proto.MESSAGE, + number=100526016, + message="Autoscaler", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -43444,13 +57017,36 @@ class RegionDiskTypeList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) - items = proto.RepeatedField(proto.MESSAGE, number=100526016, message="DiskType",) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) + items = proto.RepeatedField( + proto.MESSAGE, + number=100526016, + message="DiskType", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -43462,7 +57058,10 @@ class RegionDisksAddResourcePoliciesRequest(proto.Message): Resource policies to be added to this disk. """ - resource_policies = proto.RepeatedField(proto.STRING, number=22220385,) + resource_policies = proto.RepeatedField( + proto.STRING, + number=22220385, + ) class RegionDisksRemoveResourcePoliciesRequest(proto.Message): @@ -43474,7 +57073,10 @@ class RegionDisksRemoveResourcePoliciesRequest(proto.Message): disk. """ - resource_policies = proto.RepeatedField(proto.STRING, number=22220385,) + resource_policies = proto.RepeatedField( + proto.STRING, + number=22220385, + ) class RegionDisksResizeRequest(proto.Message): @@ -43488,7 +57090,11 @@ class RegionDisksResizeRequest(proto.Message): This field is a member of `oneof`_ ``_size_gb``. """ - size_gb = proto.Field(proto.INT64, number=494929369, optional=True,) + size_gb = proto.Field( + proto.INT64, + number=494929369, + optional=True, + ) class RegionInstanceGroupList(proto.Message): @@ -43529,15 +57135,36 @@ class RegionInstanceGroupList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="InstanceGroup", + proto.MESSAGE, + number=100526016, + message="InstanceGroup", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -43551,7 +57178,10 @@ class RegionInstanceGroupManagerDeleteInstanceConfigReq(proto.Message): instance group. """ - names = proto.RepeatedField(proto.STRING, number=104585032,) + names = proto.RepeatedField( + proto.STRING, + number=104585032, + ) class RegionInstanceGroupManagerList(proto.Message): @@ -43594,15 +57224,36 @@ class RegionInstanceGroupManagerList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="InstanceGroupManager", + proto.MESSAGE, + number=100526016, + message="InstanceGroupManager", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -43616,7 +57267,9 @@ class RegionInstanceGroupManagerPatchInstanceConfigReq(proto.Message): """ per_instance_configs = proto.RepeatedField( - proto.MESSAGE, number=526265001, message="PerInstanceConfig", + proto.MESSAGE, + number=526265001, + message="PerInstanceConfig", ) @@ -43630,7 +57283,9 @@ class RegionInstanceGroupManagerUpdateInstanceConfigReq(proto.Message): """ per_instance_configs = proto.RepeatedField( - proto.MESSAGE, number=526265001, message="PerInstanceConfig", + proto.MESSAGE, + number=526265001, + message="PerInstanceConfig", ) @@ -43644,7 +57299,10 @@ class RegionInstanceGroupManagersAbandonInstancesRequest(proto.Message): zones/[ZONE]/instances/[INSTANCE_NAME]. """ - instances = proto.RepeatedField(proto.STRING, number=29097598,) + instances = proto.RepeatedField( + proto.STRING, + number=29097598, + ) class RegionInstanceGroupManagersApplyUpdatesRequest(proto.Message): @@ -43690,11 +57348,24 @@ class RegionInstanceGroupManagersApplyUpdatesRequest(proto.Message): This field is a member of `oneof`_ ``_most_disruptive_allowed_action``. """ - all_instances = proto.Field(proto.BOOL, number=403676512, optional=True,) - instances = proto.RepeatedField(proto.STRING, number=29097598,) - minimal_action = proto.Field(proto.STRING, number=270567060, optional=True,) + all_instances = proto.Field( + proto.BOOL, + number=403676512, + optional=True, + ) + instances = proto.RepeatedField( + proto.STRING, + number=29097598, + ) + minimal_action = proto.Field( + proto.STRING, + number=270567060, + optional=True, + ) most_disruptive_allowed_action = proto.Field( - proto.STRING, number=66103053, optional=True, + proto.STRING, + number=66103053, + optional=True, ) @@ -43707,7 +57378,9 @@ class RegionInstanceGroupManagersCreateInstancesRequest(proto.Message): """ instances = proto.RepeatedField( - proto.MESSAGE, number=29097598, message="PerInstanceConfig", + proto.MESSAGE, + number=29097598, + message="PerInstanceConfig", ) @@ -43733,9 +57406,14 @@ class RegionInstanceGroupManagersDeleteInstancesRequest(proto.Message): This field is a member of `oneof`_ ``_skip_instances_on_validation_error``. """ - instances = proto.RepeatedField(proto.STRING, number=29097598,) + instances = proto.RepeatedField( + proto.STRING, + number=29097598, + ) skip_instances_on_validation_error = proto.Field( - proto.BOOL, number=40631073, optional=True, + proto.BOOL, + number=40631073, + optional=True, ) @@ -43762,9 +57440,15 @@ def raw_page(self): return self items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="InstanceManagedByIgmError", + proto.MESSAGE, + number=100526016, + message="InstanceManagedByIgmError", + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, ) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) class RegionInstanceGroupManagersListInstanceConfigsResp(proto.Message): @@ -43793,11 +57477,20 @@ def raw_page(self): return self items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="PerInstanceConfig", + proto.MESSAGE, + number=100526016, + message="PerInstanceConfig", + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, ) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -43823,9 +57516,15 @@ def raw_page(self): return self managed_instances = proto.RepeatedField( - proto.MESSAGE, number=336219614, message="ManagedInstance", + proto.MESSAGE, + number=336219614, + message="ManagedInstance", + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, ) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) class RegionInstanceGroupManagersRecreateRequest(proto.Message): @@ -43838,7 +57537,10 @@ class RegionInstanceGroupManagersRecreateRequest(proto.Message): zones/[ZONE]/instances/[INSTANCE_NAME]. """ - instances = proto.RepeatedField(proto.STRING, number=29097598,) + instances = proto.RepeatedField( + proto.STRING, + number=29097598, + ) class RegionInstanceGroupManagersSetTargetPoolsRequest(proto.Message): @@ -43859,8 +57561,15 @@ class RegionInstanceGroupManagersSetTargetPoolsRequest(proto.Message): the instances in the managed instance group. """ - fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) - target_pools = proto.RepeatedField(proto.STRING, number=336072617,) + fingerprint = proto.Field( + proto.STRING, + number=234678500, + optional=True, + ) + target_pools = proto.RepeatedField( + proto.STRING, + number=336072617, + ) class RegionInstanceGroupManagersSetTemplateRequest(proto.Message): @@ -43874,7 +57583,11 @@ class RegionInstanceGroupManagersSetTemplateRequest(proto.Message): This field is a member of `oneof`_ ``_instance_template``. """ - instance_template = proto.Field(proto.STRING, number=309248228, optional=True,) + instance_template = proto.Field( + proto.STRING, + number=309248228, + optional=True, + ) class RegionInstanceGroupsListInstances(proto.Message): @@ -43915,15 +57628,36 @@ class RegionInstanceGroupsListInstances(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="InstanceWithNamedPorts", + proto.MESSAGE, + number=100526016, + message="InstanceWithNamedPorts", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -43956,8 +57690,16 @@ class InstanceState(proto.Enum): ALL = 64897 RUNNING = 121282975 - instance_state = proto.Field(proto.STRING, number=92223591, optional=True,) - port_name = proto.Field(proto.STRING, number=41534345, optional=True,) + instance_state = proto.Field( + proto.STRING, + number=92223591, + optional=True, + ) + port_name = proto.Field( + proto.STRING, + number=41534345, + optional=True, + ) class RegionInstanceGroupsSetNamedPortsRequest(proto.Message): @@ -43981,9 +57723,15 @@ class RegionInstanceGroupsSetNamedPortsRequest(proto.Message): instance group. """ - fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) + fingerprint = proto.Field( + proto.STRING, + number=234678500, + optional=True, + ) named_ports = proto.RepeatedField( - proto.MESSAGE, number=427598732, message="NamedPort", + proto.MESSAGE, + number=427598732, + message="NamedPort", ) @@ -44026,13 +57774,36 @@ class RegionList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) - items = proto.RepeatedField(proto.MESSAGE, number=100526016, message="Region",) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) + items = proto.RepeatedField( + proto.MESSAGE, + number=100526016, + message="Region", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -44055,8 +57826,16 @@ class RegionSetLabelsRequest(proto.Message): The labels to set for this resource. """ - label_fingerprint = proto.Field(proto.STRING, number=178124825, optional=True,) - labels = proto.MapField(proto.STRING, proto.STRING, number=500195327,) + label_fingerprint = proto.Field( + proto.STRING, + number=178124825, + optional=True, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=500195327, + ) class RegionSetPolicyRequest(proto.Message): @@ -44083,10 +57862,21 @@ class RegionSetPolicyRequest(proto.Message): This field is a member of `oneof`_ ``_policy``. """ - bindings = proto.RepeatedField(proto.MESSAGE, number=403251854, message="Binding",) - etag = proto.Field(proto.STRING, number=3123477, optional=True,) + bindings = proto.RepeatedField( + proto.MESSAGE, + number=403251854, + message="Binding", + ) + etag = proto.Field( + proto.STRING, + number=3123477, + optional=True, + ) policy = proto.Field( - proto.MESSAGE, number=91071794, optional=True, message="Policy", + proto.MESSAGE, + number=91071794, + optional=True, + message="Policy", ) @@ -44101,7 +57891,10 @@ class RegionTargetHttpsProxiesSetSslCertificatesRequest(proto.Message): must be specified. """ - ssl_certificates = proto.RepeatedField(proto.STRING, number=366006543,) + ssl_certificates = proto.RepeatedField( + proto.STRING, + number=366006543, + ) class RegionUrlMapsValidateRequest(proto.Message): @@ -44115,7 +57908,10 @@ class RegionUrlMapsValidateRequest(proto.Message): """ resource = proto.Field( - proto.MESSAGE, number=195806222, optional=True, message="UrlMap", + proto.MESSAGE, + number=195806222, + optional=True, + message="UrlMap", ) @@ -44150,9 +57946,20 @@ class RemoveAssociationFirewallPolicyRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - firewall_policy = proto.Field(proto.STRING, number=498173265,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + firewall_policy = proto.Field( + proto.STRING, + number=498173265, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class RemoveHealthCheckTargetPoolRequest(proto.Message): @@ -44189,12 +57996,27 @@ class RemoveHealthCheckTargetPoolRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - target_pool = proto.Field(proto.STRING, number=62796298,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + target_pool = proto.Field( + proto.STRING, + number=62796298, + ) target_pools_remove_health_check_request_resource = proto.Field( - proto.MESSAGE, number=304985011, message="TargetPoolsRemoveHealthCheckRequest", + proto.MESSAGE, + number=304985011, + message="TargetPoolsRemoveHealthCheckRequest", ) @@ -44232,12 +58054,27 @@ class RemoveInstanceTargetPoolRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - target_pool = proto.Field(proto.STRING, number=62796298,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + target_pool = proto.Field( + proto.STRING, + number=62796298, + ) target_pools_remove_instance_request_resource = proto.Field( - proto.MESSAGE, number=29548547, message="TargetPoolsRemoveInstanceRequest", + proto.MESSAGE, + number=29548547, + message="TargetPoolsRemoveInstanceRequest", ) @@ -44276,13 +58113,28 @@ class RemoveInstancesInstanceGroupRequest(proto.Message): is located. """ - instance_group = proto.Field(proto.STRING, number=81095253,) + instance_group = proto.Field( + proto.STRING, + number=81095253, + ) instance_groups_remove_instances_request_resource = proto.Field( - proto.MESSAGE, number=390981817, message="InstanceGroupsRemoveInstancesRequest", + proto.MESSAGE, + number=390981817, + message="InstanceGroupsRemoveInstancesRequest", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) class RemovePeeringNetworkRequest(proto.Message): @@ -44317,12 +58169,24 @@ class RemovePeeringNetworkRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - network = proto.Field(proto.STRING, number=232872494,) + network = proto.Field( + proto.STRING, + number=232872494, + ) networks_remove_peering_request_resource = proto.Field( - proto.MESSAGE, number=421162494, message="NetworksRemovePeeringRequest", + proto.MESSAGE, + number=421162494, + message="NetworksRemovePeeringRequest", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class RemoveResourcePoliciesDiskRequest(proto.Message): @@ -44358,13 +58222,28 @@ class RemoveResourcePoliciesDiskRequest(proto.Message): The name of the zone for this request. """ - disk = proto.Field(proto.STRING, number=3083677,) + disk = proto.Field( + proto.STRING, + number=3083677, + ) disks_remove_resource_policies_request_resource = proto.Field( - proto.MESSAGE, number=436756718, message="DisksRemoveResourcePoliciesRequest", + proto.MESSAGE, + number=436756718, + message="DisksRemoveResourcePoliciesRequest", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) class RemoveResourcePoliciesInstanceRequest(proto.Message): @@ -44400,15 +58279,28 @@ class RemoveResourcePoliciesInstanceRequest(proto.Message): The name of the zone for this request. """ - instance = proto.Field(proto.STRING, number=18257045,) + instance = proto.Field( + proto.STRING, + number=18257045, + ) instances_remove_resource_policies_request_resource = proto.Field( proto.MESSAGE, number=49229558, message="InstancesRemoveResourcePoliciesRequest", ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class RemoveResourcePoliciesRegionDiskRequest(proto.Message): @@ -44444,15 +58336,28 @@ class RemoveResourcePoliciesRegionDiskRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - disk = proto.Field(proto.STRING, number=3083677,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + disk = proto.Field( + proto.STRING, + number=3083677, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) region_disks_remove_resource_policies_request_resource = proto.Field( proto.MESSAGE, number=8741283, message="RegionDisksRemoveResourcePoliciesRequest", ) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class RemoveRuleFirewallPolicyRequest(proto.Message): @@ -44487,9 +58392,20 @@ class RemoveRuleFirewallPolicyRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - firewall_policy = proto.Field(proto.STRING, number=498173265,) - priority = proto.Field(proto.INT32, number=445151652, optional=True,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + firewall_policy = proto.Field( + proto.STRING, + number=498173265, + ) + priority = proto.Field( + proto.INT32, + number=445151652, + optional=True, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class RemoveRuleSecurityPolicyRequest(proto.Message): @@ -44508,9 +58424,19 @@ class RemoveRuleSecurityPolicyRequest(proto.Message): Name of the security policy to update. """ - priority = proto.Field(proto.INT32, number=445151652, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - security_policy = proto.Field(proto.STRING, number=171082513,) + priority = proto.Field( + proto.INT32, + number=445151652, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + security_policy = proto.Field( + proto.STRING, + number=171082513, + ) class RequestMirrorPolicy(proto.Message): @@ -44528,7 +58454,11 @@ class RequestMirrorPolicy(proto.Message): This field is a member of `oneof`_ ``_backend_service``. """ - backend_service = proto.Field(proto.STRING, number=306946058, optional=True,) + backend_service = proto.Field( + proto.STRING, + number=306946058, + optional=True, + ) class Reservation(proto.Message): @@ -44623,16 +58553,51 @@ class Status(proto.Enum): READY = 77848963 UPDATING = 494614342 - commitment = proto.Field(proto.STRING, number=482134805, optional=True,) - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - satisfies_pzs = proto.Field(proto.BOOL, number=480964267, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + commitment = proto.Field( + proto.STRING, + number=482134805, + optional=True, + ) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + satisfies_pzs = proto.Field( + proto.BOOL, + number=480964267, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) share_settings = proto.Field( - proto.MESSAGE, number=266668163, optional=True, message="ShareSettings", + proto.MESSAGE, + number=266668163, + optional=True, + message="ShareSettings", ) specific_reservation = proto.Field( proto.MESSAGE, @@ -44641,10 +58606,20 @@ class Status(proto.Enum): message="AllocationSpecificSKUReservation", ) specific_reservation_required = proto.Field( - proto.BOOL, number=226550687, optional=True, + proto.BOOL, + number=226550687, + optional=True, + ) + status = proto.Field( + proto.STRING, + number=181260274, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + optional=True, ) - status = proto.Field(proto.STRING, number=181260274, optional=True,) - zone = proto.Field(proto.STRING, number=3744684, optional=True,) class ReservationAffinity(proto.Message): @@ -44688,10 +58663,19 @@ class ConsumeReservationType(proto.Enum): UNSPECIFIED = 526786327 consume_reservation_type = proto.Field( - proto.STRING, number=300736944, optional=True, + proto.STRING, + number=300736944, + optional=True, + ) + key = proto.Field( + proto.STRING, + number=106079, + optional=True, + ) + values = proto.RepeatedField( + proto.STRING, + number=249928994, ) - key = proto.Field(proto.STRING, number=106079, optional=True,) - values = proto.RepeatedField(proto.STRING, number=249928994,) class ReservationAggregatedList(proto.Message): @@ -44734,16 +58718,41 @@ class ReservationAggregatedList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.MapField( - proto.STRING, proto.MESSAGE, number=100526016, message="ReservationsScopedList", + proto.STRING, + proto.MESSAGE, + number=100526016, + message="ReservationsScopedList", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - unreachables = proto.RepeatedField(proto.STRING, number=243372063,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -44786,13 +58795,36 @@ class ReservationList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) - items = proto.RepeatedField(proto.MESSAGE, number=100526016, message="Reservation",) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) + items = proto.RepeatedField( + proto.MESSAGE, + number=100526016, + message="Reservation", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -44807,7 +58839,11 @@ class ReservationsResizeRequest(proto.Message): This field is a member of `oneof`_ ``_specific_sku_count``. """ - specific_sku_count = proto.Field(proto.INT64, number=13890720, optional=True,) + specific_sku_count = proto.Field( + proto.INT64, + number=13890720, + optional=True, + ) class ReservationsScopedList(proto.Message): @@ -44825,10 +58861,15 @@ class ReservationsScopedList(proto.Message): """ reservations = proto.RepeatedField( - proto.MESSAGE, number=399717927, message="Reservation", + proto.MESSAGE, + number=399717927, + message="Reservation", ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -44863,10 +58904,23 @@ class ResetInstanceRequest(proto.Message): The name of the zone for this request. """ - instance = proto.Field(proto.STRING, number=18257045,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + instance = proto.Field( + proto.STRING, + number=18257045, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class ResizeDiskRequest(proto.Message): @@ -44902,13 +58956,28 @@ class ResizeDiskRequest(proto.Message): The name of the zone for this request. """ - disk = proto.Field(proto.STRING, number=3083677,) + disk = proto.Field( + proto.STRING, + number=3083677, + ) disks_resize_request_resource = proto.Field( - proto.MESSAGE, number=78307616, message="DisksResizeRequest", + proto.MESSAGE, + number=78307616, + message="DisksResizeRequest", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) class ResizeInstanceGroupManagerRequest(proto.Message): @@ -44949,11 +59018,27 @@ class ResizeInstanceGroupManagerRequest(proto.Message): instance group is located. """ - instance_group_manager = proto.Field(proto.STRING, number=249363395,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - size = proto.Field(proto.INT32, number=3530753,) - zone = proto.Field(proto.STRING, number=3744684,) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + size = proto.Field( + proto.INT32, + number=3530753, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class ResizeRegionDiskRequest(proto.Message): @@ -44989,13 +59074,28 @@ class ResizeRegionDiskRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - disk = proto.Field(proto.STRING, number=3083677,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + disk = proto.Field( + proto.STRING, + number=3083677, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) region_disks_resize_request_resource = proto.Field( - proto.MESSAGE, number=446633237, message="RegionDisksResizeRequest", + proto.MESSAGE, + number=446633237, + message="RegionDisksResizeRequest", + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class ResizeRegionInstanceGroupManagerRequest(proto.Message): @@ -45032,11 +59132,27 @@ class ResizeRegionInstanceGroupManagerRequest(proto.Message): instance group manager. """ - instance_group_manager = proto.Field(proto.STRING, number=249363395,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - size = proto.Field(proto.INT32, number=3530753,) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + size = proto.Field( + proto.INT32, + number=3530753, + ) class ResizeReservationRequest(proto.Message): @@ -45072,13 +59188,28 @@ class ResizeReservationRequest(proto.Message): Name of the zone for this request. """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - reservation = proto.Field(proto.STRING, number=47530956,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + reservation = proto.Field( + proto.STRING, + number=47530956, + ) reservations_resize_request_resource = proto.Field( - proto.MESSAGE, number=389262801, message="ReservationsResizeRequest", + proto.MESSAGE, + number=389262801, + message="ReservationsResizeRequest", + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - zone = proto.Field(proto.STRING, number=3744684,) class ResourceCommitment(proto.Message): @@ -45120,9 +59251,21 @@ class Type(proto.Enum): UNSPECIFIED = 526786327 VCPU = 2628978 - accelerator_type = proto.Field(proto.STRING, number=138031246, optional=True,) - amount = proto.Field(proto.INT64, number=196759640, optional=True,) - type_ = proto.Field(proto.STRING, number=3575610, optional=True,) + accelerator_type = proto.Field( + proto.STRING, + number=138031246, + optional=True, + ) + amount = proto.Field( + proto.INT64, + number=196759640, + optional=True, + ) + type_ = proto.Field( + proto.STRING, + number=3575610, + optional=True, + ) class ResourceGroupReference(proto.Message): @@ -45137,7 +59280,11 @@ class ResourceGroupReference(proto.Message): This field is a member of `oneof`_ ``_group``. """ - group = proto.Field(proto.STRING, number=98629247, optional=True,) + group = proto.Field( + proto.STRING, + number=98629247, + optional=True, + ) class ResourcePoliciesScopedList(proto.Message): @@ -45155,10 +59302,15 @@ class ResourcePoliciesScopedList(proto.Message): """ resource_policies = proto.RepeatedField( - proto.MESSAGE, number=22220385, message="ResourcePolicy", + proto.MESSAGE, + number=22220385, + message="ResourcePolicy", ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -45240,38 +59392,70 @@ class Status(proto.Enum): INVALID = 530283991 READY = 77848963 - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) group_placement_policy = proto.Field( proto.MESSAGE, number=10931596, optional=True, message="ResourcePolicyGroupPlacementPolicy", ) - id = proto.Field(proto.UINT64, number=3355, optional=True,) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) instance_schedule_policy = proto.Field( proto.MESSAGE, number=344877104, optional=True, message="ResourcePolicyInstanceSchedulePolicy", ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - region = proto.Field(proto.STRING, number=138946292, optional=True,) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) resource_status = proto.Field( proto.MESSAGE, number=249429315, optional=True, message="ResourcePolicyResourceStatus", ) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) snapshot_schedule_policy = proto.Field( proto.MESSAGE, number=218131295, optional=True, message="ResourcePolicySnapshotSchedulePolicy", ) - status = proto.Field(proto.STRING, number=181260274, optional=True,) + status = proto.Field( + proto.STRING, + number=181260274, + optional=True, + ) class ResourcePolicyAggregatedList(proto.Message): @@ -45317,20 +59501,46 @@ class ResourcePolicyAggregatedList(proto.Message): def raw_page(self): return self - etag = proto.Field(proto.STRING, number=3123477, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + etag = proto.Field( + proto.STRING, + number=3123477, + optional=True, + ) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.MapField( proto.STRING, proto.MESSAGE, number=100526016, message="ResourcePoliciesScopedList", ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - unreachables = proto.RepeatedField(proto.STRING, number=243372063,) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -45359,9 +59569,21 @@ class ResourcePolicyDailyCycle(proto.Message): This field is a member of `oneof`_ ``_start_time``. """ - days_in_cycle = proto.Field(proto.INT32, number=369790004, optional=True,) - duration = proto.Field(proto.STRING, number=155471252, optional=True,) - start_time = proto.Field(proto.STRING, number=37467274, optional=True,) + days_in_cycle = proto.Field( + proto.INT32, + number=369790004, + optional=True, + ) + duration = proto.Field( + proto.STRING, + number=155471252, + optional=True, + ) + start_time = proto.Field( + proto.STRING, + number=37467274, + optional=True, + ) class ResourcePolicyGroupPlacementPolicy(proto.Message): @@ -45396,10 +59618,20 @@ class Collocation(proto.Enum): UNSPECIFIED_COLLOCATION = 464308205 availability_domain_count = proto.Field( - proto.INT32, number=12453432, optional=True, + proto.INT32, + number=12453432, + optional=True, + ) + collocation = proto.Field( + proto.STRING, + number=511156533, + optional=True, + ) + vm_count = proto.Field( + proto.INT32, + number=261463431, + optional=True, ) - collocation = proto.Field(proto.STRING, number=511156533, optional=True,) - vm_count = proto.Field(proto.INT32, number=261463431, optional=True,) class ResourcePolicyHourlyCycle(proto.Message): @@ -45424,9 +59656,21 @@ class ResourcePolicyHourlyCycle(proto.Message): This field is a member of `oneof`_ ``_start_time``. """ - duration = proto.Field(proto.STRING, number=155471252, optional=True,) - hours_in_cycle = proto.Field(proto.INT32, number=526763132, optional=True,) - start_time = proto.Field(proto.STRING, number=37467274, optional=True,) + duration = proto.Field( + proto.STRING, + number=155471252, + optional=True, + ) + hours_in_cycle = proto.Field( + proto.INT32, + number=526763132, + optional=True, + ) + start_time = proto.Field( + proto.STRING, + number=37467274, + optional=True, + ) class ResourcePolicyInstanceSchedulePolicy(proto.Message): @@ -45463,9 +59707,21 @@ class ResourcePolicyInstanceSchedulePolicy(proto.Message): This field is a member of `oneof`_ ``_vm_stop_schedule``. """ - expiration_time = proto.Field(proto.STRING, number=230299229, optional=True,) - start_time = proto.Field(proto.STRING, number=37467274, optional=True,) - time_zone = proto.Field(proto.STRING, number=36848094, optional=True,) + expiration_time = proto.Field( + proto.STRING, + number=230299229, + optional=True, + ) + start_time = proto.Field( + proto.STRING, + number=37467274, + optional=True, + ) + time_zone = proto.Field( + proto.STRING, + number=36848094, + optional=True, + ) vm_start_schedule = proto.Field( proto.MESSAGE, number=17762396, @@ -45491,7 +59747,11 @@ class ResourcePolicyInstanceSchedulePolicySchedule(proto.Message): This field is a member of `oneof`_ ``_schedule``. """ - schedule = proto.Field(proto.STRING, number=375820951, optional=True,) + schedule = proto.Field( + proto.STRING, + number=375820951, + optional=True, + ) class ResourcePolicyList(proto.Message): @@ -45536,16 +59796,41 @@ class ResourcePolicyList(proto.Message): def raw_page(self): return self - etag = proto.Field(proto.STRING, number=3123477, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + etag = proto.Field( + proto.STRING, + number=3123477, + optional=True, + ) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="ResourcePolicy", + proto.MESSAGE, + number=100526016, + message="ResourcePolicy", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -45589,8 +59874,16 @@ class ResourcePolicyResourceStatusInstanceSchedulePolicyStatus(proto.Message): This field is a member of `oneof`_ ``_next_run_start_time``. """ - last_run_start_time = proto.Field(proto.STRING, number=303069063, optional=True,) - next_run_start_time = proto.Field(proto.STRING, number=318642570, optional=True,) + last_run_start_time = proto.Field( + proto.STRING, + number=303069063, + optional=True, + ) + next_run_start_time = proto.Field( + proto.STRING, + number=318642570, + optional=True, + ) class ResourcePolicySnapshotSchedulePolicy(proto.Message): @@ -45666,8 +59959,16 @@ class OnSourceDiskDelete(proto.Enum): KEEP_AUTO_SNAPSHOTS = 258925689 UNSPECIFIED_ON_SOURCE_DISK_DELETE = 239140769 - max_retention_days = proto.Field(proto.INT32, number=324296979, optional=True,) - on_source_disk_delete = proto.Field(proto.STRING, number=321955529, optional=True,) + max_retention_days = proto.Field( + proto.INT32, + number=324296979, + optional=True, + ) + on_source_disk_delete = proto.Field( + proto.STRING, + number=321955529, + optional=True, + ) class ResourcePolicySnapshotSchedulePolicySchedule(proto.Message): @@ -45729,10 +60030,25 @@ class ResourcePolicySnapshotSchedulePolicySnapshotProperties(proto.Message): auto snapshot (regional or multi-regional). """ - chain_name = proto.Field(proto.STRING, number=68644169, optional=True,) - guest_flush = proto.Field(proto.BOOL, number=385550813, optional=True,) - labels = proto.MapField(proto.STRING, proto.STRING, number=500195327,) - storage_locations = proto.RepeatedField(proto.STRING, number=328005274,) + chain_name = proto.Field( + proto.STRING, + number=68644169, + optional=True, + ) + guest_flush = proto.Field( + proto.BOOL, + number=385550813, + optional=True, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=500195327, + ) + storage_locations = proto.RepeatedField( + proto.STRING, + number=328005274, + ) class ResourcePolicyWeeklyCycle(proto.Message): @@ -45745,7 +60061,9 @@ class ResourcePolicyWeeklyCycle(proto.Message): """ day_of_weeks = proto.RepeatedField( - proto.MESSAGE, number=257871834, message="ResourcePolicyWeeklyCycleDayOfWeek", + proto.MESSAGE, + number=257871834, + message="ResourcePolicyWeeklyCycleDayOfWeek", ) @@ -45789,9 +60107,21 @@ class Day(proto.Enum): TUESDAY = 277509677 WEDNESDAY = 422029110 - day = proto.Field(proto.STRING, number=99228, optional=True,) - duration = proto.Field(proto.STRING, number=155471252, optional=True,) - start_time = proto.Field(proto.STRING, number=37467274, optional=True,) + day = proto.Field( + proto.STRING, + number=99228, + optional=True, + ) + duration = proto.Field( + proto.STRING, + number=155471252, + optional=True, + ) + start_time = proto.Field( + proto.STRING, + number=37467274, + optional=True, + ) class ResumeInstanceRequest(proto.Message): @@ -45825,10 +60155,23 @@ class ResumeInstanceRequest(proto.Message): The name of the zone for this request. """ - instance = proto.Field(proto.STRING, number=18257045,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + instance = proto.Field( + proto.STRING, + number=18257045, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class Route(proto.Message): @@ -45977,27 +60320,104 @@ class RouteType(proto.Enum): TRANSIT = 187793843 as_paths = proto.RepeatedField( - proto.MESSAGE, number=137568929, message="RouteAsPath", - ) - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - dest_range = proto.Field(proto.STRING, number=381327712, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - network = proto.Field(proto.STRING, number=232872494, optional=True,) - next_hop_gateway = proto.Field(proto.STRING, number=377175298, optional=True,) - next_hop_ilb = proto.Field(proto.STRING, number=198679901, optional=True,) - next_hop_instance = proto.Field(proto.STRING, number=393508247, optional=True,) - next_hop_ip = proto.Field(proto.STRING, number=110319529, optional=True,) - next_hop_network = proto.Field(proto.STRING, number=262295788, optional=True,) - next_hop_peering = proto.Field(proto.STRING, number=412682750, optional=True,) - next_hop_vpn_tunnel = proto.Field(proto.STRING, number=519844501, optional=True,) - priority = proto.Field(proto.UINT32, number=445151652, optional=True,) - route_type = proto.Field(proto.STRING, number=375888752, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - tags = proto.RepeatedField(proto.STRING, number=3552281,) - warnings = proto.RepeatedField(proto.MESSAGE, number=498091095, message="Warnings",) + proto.MESSAGE, + number=137568929, + message="RouteAsPath", + ) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + dest_range = proto.Field( + proto.STRING, + number=381327712, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + network = proto.Field( + proto.STRING, + number=232872494, + optional=True, + ) + next_hop_gateway = proto.Field( + proto.STRING, + number=377175298, + optional=True, + ) + next_hop_ilb = proto.Field( + proto.STRING, + number=198679901, + optional=True, + ) + next_hop_instance = proto.Field( + proto.STRING, + number=393508247, + optional=True, + ) + next_hop_ip = proto.Field( + proto.STRING, + number=110319529, + optional=True, + ) + next_hop_network = proto.Field( + proto.STRING, + number=262295788, + optional=True, + ) + next_hop_peering = proto.Field( + proto.STRING, + number=412682750, + optional=True, + ) + next_hop_vpn_tunnel = proto.Field( + proto.STRING, + number=519844501, + optional=True, + ) + priority = proto.Field( + proto.UINT32, + number=445151652, + optional=True, + ) + route_type = proto.Field( + proto.STRING, + number=375888752, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + tags = proto.RepeatedField( + proto.STRING, + number=3552281, + ) + warnings = proto.RepeatedField( + proto.MESSAGE, + number=498091095, + message="Warnings", + ) class RouteAsPath(proto.Message): @@ -46037,8 +60457,15 @@ class PathSegmentType(proto.Enum): AS_SEQUENCE = 106735918 AS_SET = 329846453 - as_lists = proto.RepeatedField(proto.UINT32, number=134112584,) - path_segment_type = proto.Field(proto.STRING, number=513464992, optional=True,) + as_lists = proto.RepeatedField( + proto.UINT32, + number=134112584, + ) + path_segment_type = proto.Field( + proto.STRING, + number=513464992, + optional=True, + ) class RouteList(proto.Message): @@ -46079,13 +60506,36 @@ class RouteList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) - items = proto.RepeatedField(proto.MESSAGE, number=100526016, message="Route",) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) + items = proto.RepeatedField( + proto.MESSAGE, + number=100526016, + message="Route", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -46167,25 +60617,72 @@ class Router(proto.Message): This field is a member of `oneof`_ ``_self_link``. """ - bgp = proto.Field(proto.MESSAGE, number=97483, optional=True, message="RouterBgp",) + bgp = proto.Field( + proto.MESSAGE, + number=97483, + optional=True, + message="RouterBgp", + ) bgp_peers = proto.RepeatedField( - proto.MESSAGE, number=452695773, message="RouterBgpPeer", + proto.MESSAGE, + number=452695773, + message="RouterBgpPeer", + ) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, ) - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) encrypted_interconnect_router = proto.Field( - proto.BOOL, number=297996575, optional=True, + proto.BOOL, + number=297996575, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, ) - id = proto.Field(proto.UINT64, number=3355, optional=True,) interfaces = proto.RepeatedField( - proto.MESSAGE, number=12073562, message="RouterInterface", + proto.MESSAGE, + number=12073562, + message="RouterInterface", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + nats = proto.RepeatedField( + proto.MESSAGE, + number=3373938, + message="RouterNat", + ) + network = proto.Field( + proto.STRING, + number=232872494, + optional=True, + ) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - nats = proto.RepeatedField(proto.MESSAGE, number=3373938, message="RouterNat",) - network = proto.Field(proto.STRING, number=232872494, optional=True,) - region = proto.Field(proto.STRING, number=138946292, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) class RouterAdvertisedIpRange(proto.Message): @@ -46203,8 +60700,16 @@ class RouterAdvertisedIpRange(proto.Message): This field is a member of `oneof`_ ``_range``. """ - description = proto.Field(proto.STRING, number=422937596, optional=True,) - range_ = proto.Field(proto.STRING, number=108280125, optional=True,) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + range_ = proto.Field( + proto.STRING, + number=108280125, + optional=True, + ) class RouterAggregatedList(proto.Message): @@ -46247,16 +60752,41 @@ class RouterAggregatedList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.MapField( - proto.STRING, proto.MESSAGE, number=100526016, message="RoutersScopedList", + proto.STRING, + proto.MESSAGE, + number=100526016, + message="RoutersScopedList", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - unreachables = proto.RepeatedField(proto.STRING, number=243372063,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -46324,13 +60854,30 @@ class AdvertisedGroups(proto.Enum): UNDEFINED_ADVERTISED_GROUPS = 0 ALL_SUBNETS = 3622872 - advertise_mode = proto.Field(proto.STRING, number=312134331, optional=True,) - advertised_groups = proto.RepeatedField(proto.STRING, number=21065526,) + advertise_mode = proto.Field( + proto.STRING, + number=312134331, + optional=True, + ) + advertised_groups = proto.RepeatedField( + proto.STRING, + number=21065526, + ) advertised_ip_ranges = proto.RepeatedField( - proto.MESSAGE, number=35449932, message="RouterAdvertisedIpRange", + proto.MESSAGE, + number=35449932, + message="RouterAdvertisedIpRange", + ) + asn = proto.Field( + proto.UINT32, + number=96892, + optional=True, + ) + keepalive_interval = proto.Field( + proto.UINT32, + number=276771516, + optional=True, ) - asn = proto.Field(proto.UINT32, number=96892, optional=True,) - keepalive_interval = proto.Field(proto.UINT32, number=276771516, optional=True,) class RouterBgpPeer(proto.Message): @@ -46489,31 +61036,85 @@ class ManagementType(proto.Enum): MANAGED_BY_ATTACHMENT = 458926411 MANAGED_BY_USER = 317294067 - advertise_mode = proto.Field(proto.STRING, number=312134331, optional=True,) - advertised_groups = proto.RepeatedField(proto.STRING, number=21065526,) + advertise_mode = proto.Field( + proto.STRING, + number=312134331, + optional=True, + ) + advertised_groups = proto.RepeatedField( + proto.STRING, + number=21065526, + ) advertised_ip_ranges = proto.RepeatedField( - proto.MESSAGE, number=35449932, message="RouterAdvertisedIpRange", + proto.MESSAGE, + number=35449932, + message="RouterAdvertisedIpRange", ) advertised_route_priority = proto.Field( - proto.UINT32, number=186486332, optional=True, + proto.UINT32, + number=186486332, + optional=True, ) bfd = proto.Field( - proto.MESSAGE, number=97440, optional=True, message="RouterBgpPeerBfd", - ) - enable = proto.Field(proto.STRING, number=311764355, optional=True,) - enable_ipv6 = proto.Field(proto.BOOL, number=181467939, optional=True,) - interface_name = proto.Field(proto.STRING, number=437854673, optional=True,) - ip_address = proto.Field(proto.STRING, number=406272220, optional=True,) - ipv6_nexthop_address = proto.Field(proto.STRING, number=27968211, optional=True,) - management_type = proto.Field(proto.STRING, number=173703606, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - peer_asn = proto.Field(proto.UINT32, number=69573151, optional=True,) - peer_ip_address = proto.Field(proto.STRING, number=207735769, optional=True,) + proto.MESSAGE, + number=97440, + optional=True, + message="RouterBgpPeerBfd", + ) + enable = proto.Field( + proto.STRING, + number=311764355, + optional=True, + ) + enable_ipv6 = proto.Field( + proto.BOOL, + number=181467939, + optional=True, + ) + interface_name = proto.Field( + proto.STRING, + number=437854673, + optional=True, + ) + ip_address = proto.Field( + proto.STRING, + number=406272220, + optional=True, + ) + ipv6_nexthop_address = proto.Field( + proto.STRING, + number=27968211, + optional=True, + ) + management_type = proto.Field( + proto.STRING, + number=173703606, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + peer_asn = proto.Field( + proto.UINT32, + number=69573151, + optional=True, + ) + peer_ip_address = proto.Field( + proto.STRING, + number=207735769, + optional=True, + ) peer_ipv6_nexthop_address = proto.Field( - proto.STRING, number=491486608, optional=True, + proto.STRING, + number=491486608, + optional=True, ) router_appliance_instance = proto.Field( - proto.STRING, number=468312989, optional=True, + proto.STRING, + number=468312989, + optional=True, ) @@ -46576,11 +61177,25 @@ class SessionInitializationMode(proto.Enum): DISABLED = 516696700 PASSIVE = 462813959 - min_receive_interval = proto.Field(proto.UINT32, number=186981614, optional=True,) - min_transmit_interval = proto.Field(proto.UINT32, number=523282631, optional=True,) - multiplier = proto.Field(proto.UINT32, number=191331777, optional=True,) + min_receive_interval = proto.Field( + proto.UINT32, + number=186981614, + optional=True, + ) + min_transmit_interval = proto.Field( + proto.UINT32, + number=523282631, + optional=True, + ) + multiplier = proto.Field( + proto.UINT32, + number=191331777, + optional=True, + ) session_initialization_mode = proto.Field( - proto.STRING, number=105957049, optional=True, + proto.STRING, + number=105957049, + optional=True, ) @@ -46686,16 +61301,46 @@ class ManagementType(proto.Enum): MANAGED_BY_ATTACHMENT = 458926411 MANAGED_BY_USER = 317294067 - ip_range = proto.Field(proto.STRING, number=145092645, optional=True,) + ip_range = proto.Field( + proto.STRING, + number=145092645, + optional=True, + ) linked_interconnect_attachment = proto.Field( - proto.STRING, number=501085518, optional=True, + proto.STRING, + number=501085518, + optional=True, + ) + linked_vpn_tunnel = proto.Field( + proto.STRING, + number=352296953, + optional=True, + ) + management_type = proto.Field( + proto.STRING, + number=173703606, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + private_ip_address = proto.Field( + proto.STRING, + number=100854040, + optional=True, + ) + redundant_interface = proto.Field( + proto.STRING, + number=523187303, + optional=True, + ) + subnetwork = proto.Field( + proto.STRING, + number=307827694, + optional=True, ) - linked_vpn_tunnel = proto.Field(proto.STRING, number=352296953, optional=True,) - management_type = proto.Field(proto.STRING, number=173703606, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - private_ip_address = proto.Field(proto.STRING, number=100854040, optional=True,) - redundant_interface = proto.Field(proto.STRING, number=523187303, optional=True,) - subnetwork = proto.Field(proto.STRING, number=307827694, optional=True,) class RouterList(proto.Message): @@ -46737,13 +61382,36 @@ class RouterList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) - items = proto.RepeatedField(proto.MESSAGE, number=100526016, message="Router",) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) + items = proto.RepeatedField( + proto.MESSAGE, + number=100526016, + message="Router", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -46909,41 +61577,90 @@ class SourceSubnetworkIpRangesToNat(proto.Enum): ALL_SUBNETWORKS_ALL_PRIMARY_IP_RANGES = 185573819 LIST_OF_SUBNETWORKS = 517542270 - drain_nat_ips = proto.RepeatedField(proto.STRING, number=504078535,) + drain_nat_ips = proto.RepeatedField( + proto.STRING, + number=504078535, + ) enable_dynamic_port_allocation = proto.Field( - proto.BOOL, number=532106402, optional=True, + proto.BOOL, + number=532106402, + optional=True, ) enable_endpoint_independent_mapping = proto.Field( - proto.BOOL, number=259441819, optional=True, + proto.BOOL, + number=259441819, + optional=True, + ) + icmp_idle_timeout_sec = proto.Field( + proto.INT32, + number=3647562, + optional=True, ) - icmp_idle_timeout_sec = proto.Field(proto.INT32, number=3647562, optional=True,) log_config = proto.Field( - proto.MESSAGE, number=351299741, optional=True, message="RouterNatLogConfig", + proto.MESSAGE, + number=351299741, + optional=True, + message="RouterNatLogConfig", + ) + max_ports_per_vm = proto.Field( + proto.INT32, + number=250062049, + optional=True, + ) + min_ports_per_vm = proto.Field( + proto.INT32, + number=186193587, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + nat_ip_allocate_option = proto.Field( + proto.STRING, + number=429726845, + optional=True, + ) + nat_ips = proto.RepeatedField( + proto.STRING, + number=117635086, ) - max_ports_per_vm = proto.Field(proto.INT32, number=250062049, optional=True,) - min_ports_per_vm = proto.Field(proto.INT32, number=186193587, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - nat_ip_allocate_option = proto.Field(proto.STRING, number=429726845, optional=True,) - nat_ips = proto.RepeatedField(proto.STRING, number=117635086,) rules = proto.RepeatedField( - proto.MESSAGE, number=108873975, message="RouterNatRule", + proto.MESSAGE, + number=108873975, + message="RouterNatRule", ) source_subnetwork_ip_ranges_to_nat = proto.Field( - proto.STRING, number=252213211, optional=True, + proto.STRING, + number=252213211, + optional=True, ) subnetworks = proto.RepeatedField( - proto.MESSAGE, number=415853125, message="RouterNatSubnetworkToNat", + proto.MESSAGE, + number=415853125, + message="RouterNatSubnetworkToNat", ) tcp_established_idle_timeout_sec = proto.Field( - proto.INT32, number=223098349, optional=True, + proto.INT32, + number=223098349, + optional=True, ) tcp_time_wait_timeout_sec = proto.Field( - proto.INT32, number=513596925, optional=True, + proto.INT32, + number=513596925, + optional=True, ) tcp_transitory_idle_timeout_sec = proto.Field( - proto.INT32, number=205028774, optional=True, + proto.INT32, + number=205028774, + optional=True, + ) + udp_idle_timeout_sec = proto.Field( + proto.INT32, + number=64919878, + optional=True, ) - udp_idle_timeout_sec = proto.Field(proto.INT32, number=64919878, optional=True,) class RouterNatLogConfig(proto.Message): @@ -46981,8 +61698,16 @@ class Filter(proto.Enum): ERRORS_ONLY = 307484672 TRANSLATIONS_ONLY = 357212649 - enable = proto.Field(proto.BOOL, number=311764355, optional=True,) - filter = proto.Field(proto.STRING, number=336120696, optional=True,) + enable = proto.Field( + proto.BOOL, + number=311764355, + optional=True, + ) + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) class RouterNatRule(proto.Message): @@ -47021,11 +61746,26 @@ class RouterNatRule(proto.Message): """ action = proto.Field( - proto.MESSAGE, number=187661878, optional=True, message="RouterNatRuleAction", + proto.MESSAGE, + number=187661878, + optional=True, + message="RouterNatRuleAction", + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + match = proto.Field( + proto.STRING, + number=103668165, + optional=True, + ) + rule_number = proto.Field( + proto.UINT32, + number=535211500, + optional=True, ) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - match = proto.Field(proto.STRING, number=103668165, optional=True,) - rule_number = proto.Field(proto.UINT32, number=535211500, optional=True,) class RouterNatRuleAction(proto.Message): @@ -47045,8 +61785,14 @@ class RouterNatRuleAction(proto.Message): rule only. This field is used for public NAT. """ - source_nat_active_ips = proto.RepeatedField(proto.STRING, number=210378229,) - source_nat_drain_ips = proto.RepeatedField(proto.STRING, number=340812451,) + source_nat_active_ips = proto.RepeatedField( + proto.STRING, + number=210378229, + ) + source_nat_drain_ips = proto.RepeatedField( + proto.STRING, + number=340812451, + ) class RouterNatSubnetworkToNat(proto.Message): @@ -47080,9 +61826,19 @@ class SourceIpRangesToNat(proto.Enum): LIST_OF_SECONDARY_IP_RANGES = 192289308 PRIMARY_IP_RANGE = 297109954 - name = proto.Field(proto.STRING, number=3373707, optional=True,) - secondary_ip_range_names = proto.RepeatedField(proto.STRING, number=264315097,) - source_ip_ranges_to_nat = proto.RepeatedField(proto.STRING, number=388310386,) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + secondary_ip_range_names = proto.RepeatedField( + proto.STRING, + number=264315097, + ) + source_ip_ranges_to_nat = proto.RepeatedField( + proto.STRING, + number=388310386, + ) class RouterStatus(proto.Message): @@ -47104,17 +61860,31 @@ class RouterStatus(proto.Message): This field is a member of `oneof`_ ``_network``. """ - best_routes = proto.RepeatedField(proto.MESSAGE, number=395826693, message="Route",) + best_routes = proto.RepeatedField( + proto.MESSAGE, + number=395826693, + message="Route", + ) best_routes_for_router = proto.RepeatedField( - proto.MESSAGE, number=119389689, message="Route", + proto.MESSAGE, + number=119389689, + message="Route", ) bgp_peer_status = proto.RepeatedField( - proto.MESSAGE, number=218459131, message="RouterStatusBgpPeerStatus", + proto.MESSAGE, + number=218459131, + message="RouterStatusBgpPeerStatus", ) nat_status = proto.RepeatedField( - proto.MESSAGE, number=63098064, message="RouterStatusNatStatus", + proto.MESSAGE, + number=63098064, + message="RouterStatusNatStatus", + ) + network = proto.Field( + proto.STRING, + number=232872494, + optional=True, ) - network = proto.Field(proto.STRING, number=232872494, optional=True,) class RouterStatusBgpPeerStatus(proto.Message): @@ -47188,23 +61958,66 @@ class Status(proto.Enum): UP = 2715 advertised_routes = proto.RepeatedField( - proto.MESSAGE, number=333393068, message="Route", + proto.MESSAGE, + number=333393068, + message="Route", ) bfd_status = proto.Field( - proto.MESSAGE, number=395631729, optional=True, message="BfdStatus", + proto.MESSAGE, + number=395631729, + optional=True, + message="BfdStatus", + ) + ip_address = proto.Field( + proto.STRING, + number=406272220, + optional=True, + ) + linked_vpn_tunnel = proto.Field( + proto.STRING, + number=352296953, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + num_learned_routes = proto.Field( + proto.UINT32, + number=135457535, + optional=True, + ) + peer_ip_address = proto.Field( + proto.STRING, + number=207735769, + optional=True, ) - ip_address = proto.Field(proto.STRING, number=406272220, optional=True,) - linked_vpn_tunnel = proto.Field(proto.STRING, number=352296953, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - num_learned_routes = proto.Field(proto.UINT32, number=135457535, optional=True,) - peer_ip_address = proto.Field(proto.STRING, number=207735769, optional=True,) router_appliance_instance = proto.Field( - proto.STRING, number=468312989, optional=True, + proto.STRING, + number=468312989, + optional=True, + ) + state = proto.Field( + proto.STRING, + number=109757585, + optional=True, + ) + status = proto.Field( + proto.STRING, + number=181260274, + optional=True, + ) + uptime = proto.Field( + proto.STRING, + number=235379688, + optional=True, + ) + uptime_seconds = proto.Field( + proto.STRING, + number=104736040, + optional=True, ) - state = proto.Field(proto.STRING, number=109757585, optional=True,) - status = proto.Field(proto.STRING, number=181260274, optional=True,) - uptime = proto.Field(proto.STRING, number=235379688, optional=True,) - uptime_seconds = proto.Field(proto.STRING, number=104736040, optional=True,) class RouterStatusNatStatus(proto.Message): @@ -47246,23 +62059,46 @@ class RouterStatusNatStatus(proto.Message): will be raw IP strings like "179.12.26.133". """ - auto_allocated_nat_ips = proto.RepeatedField(proto.STRING, number=510794246,) - drain_auto_allocated_nat_ips = proto.RepeatedField(proto.STRING, number=309184557,) - drain_user_allocated_nat_ips = proto.RepeatedField(proto.STRING, number=305268553,) + auto_allocated_nat_ips = proto.RepeatedField( + proto.STRING, + number=510794246, + ) + drain_auto_allocated_nat_ips = proto.RepeatedField( + proto.STRING, + number=309184557, + ) + drain_user_allocated_nat_ips = proto.RepeatedField( + proto.STRING, + number=305268553, + ) min_extra_nat_ips_needed = proto.Field( - proto.INT32, number=365786338, optional=True, + proto.INT32, + number=365786338, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, ) - name = proto.Field(proto.STRING, number=3373707, optional=True,) num_vm_endpoints_with_nat_mappings = proto.Field( - proto.INT32, number=512367468, optional=True, + proto.INT32, + number=512367468, + optional=True, ) rule_status = proto.RepeatedField( - proto.MESSAGE, number=140223125, message="RouterStatusNatStatusNatRuleStatus", + proto.MESSAGE, + number=140223125, + message="RouterStatusNatStatusNatRuleStatus", ) user_allocated_nat_ip_resources = proto.RepeatedField( - proto.STRING, number=212776151, + proto.STRING, + number=212776151, + ) + user_allocated_nat_ips = proto.RepeatedField( + proto.STRING, + number=506878242, ) - user_allocated_nat_ips = proto.RepeatedField(proto.STRING, number=506878242,) class RouterStatusNatStatusNatRuleStatus(proto.Message): @@ -47293,13 +62129,29 @@ class RouterStatusNatStatusNatRuleStatus(proto.Message): This field is a member of `oneof`_ ``_rule_number``. """ - active_nat_ips = proto.RepeatedField(proto.STRING, number=208517077,) - drain_nat_ips = proto.RepeatedField(proto.STRING, number=504078535,) - min_extra_ips_needed = proto.Field(proto.INT32, number=353002756, optional=True,) + active_nat_ips = proto.RepeatedField( + proto.STRING, + number=208517077, + ) + drain_nat_ips = proto.RepeatedField( + proto.STRING, + number=504078535, + ) + min_extra_ips_needed = proto.Field( + proto.INT32, + number=353002756, + optional=True, + ) num_vm_endpoints_with_nat_mappings = proto.Field( - proto.INT32, number=512367468, optional=True, + proto.INT32, + number=512367468, + optional=True, + ) + rule_number = proto.Field( + proto.INT32, + number=535211500, + optional=True, ) - rule_number = proto.Field(proto.INT32, number=535211500, optional=True,) class RouterStatusResponse(proto.Message): @@ -47315,9 +62167,16 @@ class RouterStatusResponse(proto.Message): This field is a member of `oneof`_ ``_result``. """ - kind = proto.Field(proto.STRING, number=3292052, optional=True,) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) result = proto.Field( - proto.MESSAGE, number=139315229, optional=True, message="RouterStatus", + proto.MESSAGE, + number=139315229, + optional=True, + message="RouterStatus", ) @@ -47332,7 +62191,10 @@ class RoutersPreviewResponse(proto.Message): """ resource = proto.Field( - proto.MESSAGE, number=195806222, optional=True, message="Router", + proto.MESSAGE, + number=195806222, + optional=True, + message="Router", ) @@ -47349,9 +62211,16 @@ class RoutersScopedList(proto.Message): This field is a member of `oneof`_ ``_warning``. """ - routers = proto.RepeatedField(proto.MESSAGE, number=311906890, message="Router",) + routers = proto.RepeatedField( + proto.MESSAGE, + number=311906890, + message="Router", + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -47397,17 +62266,38 @@ class Action(proto.Enum): LOG = 75556 NO_ACTION = 260643444 - action = proto.Field(proto.STRING, number=187661878, optional=True,) + action = proto.Field( + proto.STRING, + number=187661878, + optional=True, + ) conditions = proto.RepeatedField( - proto.MESSAGE, number=142882488, message="Condition", + proto.MESSAGE, + number=142882488, + message="Condition", + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + ins = proto.RepeatedField( + proto.STRING, + number=104430, ) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - ins = proto.RepeatedField(proto.STRING, number=104430,) log_configs = proto.RepeatedField( - proto.MESSAGE, number=152873846, message="LogConfig", + proto.MESSAGE, + number=152873846, + message="LogConfig", + ) + not_ins = proto.RepeatedField( + proto.STRING, + number=518443138, + ) + permissions = proto.RepeatedField( + proto.STRING, + number=59962500, ) - not_ins = proto.RepeatedField(proto.STRING, number=518443138,) - permissions = proto.RepeatedField(proto.STRING, number=59962500,) class SSLHealthCheck(proto.Message): @@ -47487,12 +62377,36 @@ class ProxyHeader(proto.Enum): NONE = 2402104 PROXY_V1 = 334352940 - port = proto.Field(proto.INT32, number=3446913, optional=True,) - port_name = proto.Field(proto.STRING, number=41534345, optional=True,) - port_specification = proto.Field(proto.STRING, number=51590597, optional=True,) - proxy_header = proto.Field(proto.STRING, number=160374142, optional=True,) - request = proto.Field(proto.STRING, number=21951119, optional=True,) - response = proto.Field(proto.STRING, number=196547649, optional=True,) + port = proto.Field( + proto.INT32, + number=3446913, + optional=True, + ) + port_name = proto.Field( + proto.STRING, + number=41534345, + optional=True, + ) + port_specification = proto.Field( + proto.STRING, + number=51590597, + optional=True, + ) + proxy_header = proto.Field( + proto.STRING, + number=160374142, + optional=True, + ) + request = proto.Field( + proto.STRING, + number=21951119, + optional=True, + ) + response = proto.Field( + proto.STRING, + number=196547649, + optional=True, + ) class SavedAttachedDisk(proto.Message): @@ -47624,26 +62538,86 @@ class Type(proto.Enum): PERSISTENT = 460683927 SCRATCH = 496778970 - auto_delete = proto.Field(proto.BOOL, number=464761403, optional=True,) - boot = proto.Field(proto.BOOL, number=3029746, optional=True,) - device_name = proto.Field(proto.STRING, number=67541716, optional=True,) + auto_delete = proto.Field( + proto.BOOL, + number=464761403, + optional=True, + ) + boot = proto.Field( + proto.BOOL, + number=3029746, + optional=True, + ) + device_name = proto.Field( + proto.STRING, + number=67541716, + optional=True, + ) disk_encryption_key = proto.Field( - proto.MESSAGE, number=271660677, optional=True, message="CustomerEncryptionKey", + proto.MESSAGE, + number=271660677, + optional=True, + message="CustomerEncryptionKey", + ) + disk_size_gb = proto.Field( + proto.INT64, + number=316263735, + optional=True, + ) + disk_type = proto.Field( + proto.STRING, + number=93009052, + optional=True, ) - disk_size_gb = proto.Field(proto.INT64, number=316263735, optional=True,) - disk_type = proto.Field(proto.STRING, number=93009052, optional=True,) guest_os_features = proto.RepeatedField( - proto.MESSAGE, number=79294545, message="GuestOsFeature", + proto.MESSAGE, + number=79294545, + message="GuestOsFeature", + ) + index = proto.Field( + proto.INT32, + number=100346066, + optional=True, + ) + interface = proto.Field( + proto.STRING, + number=502623545, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + licenses = proto.RepeatedField( + proto.STRING, + number=337642578, + ) + mode = proto.Field( + proto.STRING, + number=3357091, + optional=True, + ) + source = proto.Field( + proto.STRING, + number=177235995, + optional=True, + ) + storage_bytes = proto.Field( + proto.INT64, + number=424631719, + optional=True, + ) + storage_bytes_status = proto.Field( + proto.STRING, + number=490739082, + optional=True, + ) + type_ = proto.Field( + proto.STRING, + number=3575610, + optional=True, ) - index = proto.Field(proto.INT32, number=100346066, optional=True,) - interface = proto.Field(proto.STRING, number=502623545, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - licenses = proto.RepeatedField(proto.STRING, number=337642578,) - mode = proto.Field(proto.STRING, number=3357091, optional=True,) - source = proto.Field(proto.STRING, number=177235995, optional=True,) - storage_bytes = proto.Field(proto.INT64, number=424631719, optional=True,) - storage_bytes_status = proto.Field(proto.STRING, number=490739082, optional=True,) - type_ = proto.Field(proto.STRING, number=3575610, optional=True,) class SavedDisk(proto.Message): @@ -47688,10 +62662,26 @@ class StorageBytesStatus(proto.Enum): UPDATING = 494614342 UP_TO_DATE = 101306702 - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - source_disk = proto.Field(proto.STRING, number=451753793, optional=True,) - storage_bytes = proto.Field(proto.INT64, number=424631719, optional=True,) - storage_bytes_status = proto.Field(proto.STRING, number=490739082, optional=True,) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + source_disk = proto.Field( + proto.STRING, + number=451753793, + optional=True, + ) + storage_bytes = proto.Field( + proto.INT64, + number=424631719, + optional=True, + ) + storage_bytes_status = proto.Field( + proto.STRING, + number=490739082, + optional=True, + ) class ScalingScheduleStatus(proto.Message): @@ -47727,9 +62717,21 @@ class State(proto.Enum): OBSOLETE = 66532761 READY = 77848963 - last_start_time = proto.Field(proto.STRING, number=34545107, optional=True,) - next_start_time = proto.Field(proto.STRING, number=97270102, optional=True,) - state = proto.Field(proto.STRING, number=109757585, optional=True,) + last_start_time = proto.Field( + proto.STRING, + number=34545107, + optional=True, + ) + next_start_time = proto.Field( + proto.STRING, + number=97270102, + optional=True, + ) + state = proto.Field( + proto.STRING, + number=109757585, + optional=True, + ) class Scheduling(proto.Message): @@ -47822,18 +62824,46 @@ class ProvisioningModel(proto.Enum): SPOT = 2552066 STANDARD = 484642493 - automatic_restart = proto.Field(proto.BOOL, number=350821371, optional=True,) + automatic_restart = proto.Field( + proto.BOOL, + number=350821371, + optional=True, + ) instance_termination_action = proto.Field( - proto.STRING, number=107380667, optional=True, + proto.STRING, + number=107380667, + optional=True, + ) + location_hint = proto.Field( + proto.STRING, + number=350519505, + optional=True, + ) + min_node_cpus = proto.Field( + proto.INT32, + number=317231675, + optional=True, ) - location_hint = proto.Field(proto.STRING, number=350519505, optional=True,) - min_node_cpus = proto.Field(proto.INT32, number=317231675, optional=True,) node_affinities = proto.RepeatedField( - proto.MESSAGE, number=461799971, message="SchedulingNodeAffinity", + proto.MESSAGE, + number=461799971, + message="SchedulingNodeAffinity", + ) + on_host_maintenance = proto.Field( + proto.STRING, + number=64616796, + optional=True, + ) + preemptible = proto.Field( + proto.BOOL, + number=324203169, + optional=True, + ) + provisioning_model = proto.Field( + proto.STRING, + number=494423, + optional=True, ) - on_host_maintenance = proto.Field(proto.STRING, number=64616796, optional=True,) - preemptible = proto.Field(proto.BOOL, number=324203169, optional=True,) - provisioning_model = proto.Field(proto.STRING, number=494423, optional=True,) class SchedulingNodeAffinity(proto.Message): @@ -47866,9 +62896,20 @@ class Operator(proto.Enum): NOT_IN = 161144369 OPERATOR_UNSPECIFIED = 128892924 - key = proto.Field(proto.STRING, number=106079, optional=True,) - operator = proto.Field(proto.STRING, number=36317348, optional=True,) - values = proto.RepeatedField(proto.STRING, number=249928994,) + key = proto.Field( + proto.STRING, + number=106079, + optional=True, + ) + operator = proto.Field( + proto.STRING, + number=36317348, + optional=True, + ) + values = proto.RepeatedField( + proto.STRING, + number=249928994, + ) class ScratchDisks(proto.Message): @@ -47881,7 +62922,11 @@ class ScratchDisks(proto.Message): This field is a member of `oneof`_ ``_disk_gb``. """ - disk_gb = proto.Field(proto.INT32, number=60990141, optional=True,) + disk_gb = proto.Field( + proto.INT32, + number=60990141, + optional=True, + ) class Screenshot(proto.Message): @@ -47899,8 +62944,16 @@ class Screenshot(proto.Message): This field is a member of `oneof`_ ``_kind``. """ - contents = proto.Field(proto.STRING, number=506419994, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) + contents = proto.Field( + proto.STRING, + number=506419994, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) class SecurityPoliciesListPreconfiguredExpressionSetsResponse(proto.Message): @@ -47930,7 +62983,10 @@ class SecurityPoliciesWafConfig(proto.Message): """ waf_rules = proto.Field( - proto.MESSAGE, number=74899924, optional=True, message="PreconfiguredWafSet", + proto.MESSAGE, + number=74899924, + optional=True, + message="PreconfiguredWafSet", ) @@ -48047,12 +63103,36 @@ class Type(proto.Enum): optional=True, message="SecurityPolicyAdvancedOptionsConfig", ) - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + fingerprint = proto.Field( + proto.STRING, + number=234678500, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) recaptcha_options_config = proto.Field( proto.MESSAGE, number=519006811, @@ -48060,10 +63140,20 @@ class Type(proto.Enum): message="SecurityPolicyRecaptchaOptionsConfig", ) rules = proto.RepeatedField( - proto.MESSAGE, number=108873975, message="SecurityPolicyRule", + proto.MESSAGE, + number=108873975, + message="SecurityPolicyRule", + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + type_ = proto.Field( + proto.STRING, + number=3575610, + optional=True, ) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - type_ = proto.Field(proto.STRING, number=3575610, optional=True,) class SecurityPolicyAdaptiveProtectionConfig(proto.Message): @@ -48112,8 +63202,16 @@ class RuleVisibility(proto.Enum): PREMIUM = 399530551 STANDARD = 484642493 - enable = proto.Field(proto.BOOL, number=311764355, optional=True,) - rule_visibility = proto.Field(proto.STRING, number=453258293, optional=True,) + enable = proto.Field( + proto.BOOL, + number=311764355, + optional=True, + ) + rule_visibility = proto.Field( + proto.STRING, + number=453258293, + optional=True, + ) class SecurityPolicyAdvancedOptionsConfig(proto.Message): @@ -48144,8 +63242,16 @@ class LogLevel(proto.Enum): NORMAL = 161067239 VERBOSE = 532219234 - json_parsing = proto.Field(proto.STRING, number=282493529, optional=True,) - log_level = proto.Field(proto.STRING, number=140582601, optional=True,) + json_parsing = proto.Field( + proto.STRING, + number=282493529, + optional=True, + ) + log_level = proto.Field( + proto.STRING, + number=140582601, + optional=True, + ) class SecurityPolicyList(proto.Message): @@ -48183,14 +63289,31 @@ class SecurityPolicyList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="SecurityPolicy", + proto.MESSAGE, + number=100526016, + message="SecurityPolicy", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -48209,7 +63332,11 @@ class SecurityPolicyRecaptchaOptionsConfig(proto.Message): This field is a member of `oneof`_ ``_redirect_site_key``. """ - redirect_site_key = proto.Field(proto.STRING, number=447677034, optional=True,) + redirect_site_key = proto.Field( + proto.STRING, + number=447677034, + optional=True, + ) class SecurityPolicyReference(proto.Message): @@ -48221,7 +63348,11 @@ class SecurityPolicyReference(proto.Message): This field is a member of `oneof`_ ``_security_policy``. """ - security_policy = proto.Field(proto.STRING, number=171082513, optional=True,) + security_policy = proto.Field( + proto.STRING, + number=171082513, + optional=True, + ) class SecurityPolicyRule(proto.Message): @@ -48296,23 +63427,43 @@ class SecurityPolicyRule(proto.Message): This field is a member of `oneof`_ ``_redirect_options``. """ - action = proto.Field(proto.STRING, number=187661878, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) + action = proto.Field( + proto.STRING, + number=187661878, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) header_action = proto.Field( proto.MESSAGE, number=328077352, optional=True, message="SecurityPolicyRuleHttpHeaderAction", ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) match = proto.Field( proto.MESSAGE, number=103668165, optional=True, message="SecurityPolicyRuleMatcher", ) - preview = proto.Field(proto.BOOL, number=218686408, optional=True,) - priority = proto.Field(proto.INT32, number=445151652, optional=True,) + preview = proto.Field( + proto.BOOL, + number=218686408, + optional=True, + ) + priority = proto.Field( + proto.INT32, + number=445151652, + optional=True, + ) rate_limit_options = proto.Field( proto.MESSAGE, number=67544315, @@ -48357,8 +63508,16 @@ class SecurityPolicyRuleHttpHeaderActionHttpHeaderOption(proto.Message): This field is a member of `oneof`_ ``_header_value``. """ - header_name = proto.Field(proto.STRING, number=110223613, optional=True,) - header_value = proto.Field(proto.STRING, number=203094335, optional=True,) + header_name = proto.Field( + proto.STRING, + number=110223613, + optional=True, + ) + header_value = proto.Field( + proto.STRING, + number=203094335, + optional=True, + ) class SecurityPolicyRuleMatcher(proto.Message): @@ -48405,8 +63564,17 @@ class VersionedExpr(proto.Enum): optional=True, message="SecurityPolicyRuleMatcherConfig", ) - expr = proto.Field(proto.MESSAGE, number=3127797, optional=True, message="Expr",) - versioned_expr = proto.Field(proto.STRING, number=322286013, optional=True,) + expr = proto.Field( + proto.MESSAGE, + number=3127797, + optional=True, + message="Expr", + ) + versioned_expr = proto.Field( + proto.STRING, + number=322286013, + optional=True, + ) class SecurityPolicyRuleMatcherConfig(proto.Message): @@ -48418,7 +63586,10 @@ class SecurityPolicyRuleMatcherConfig(proto.Message): allowed is 10. """ - src_ip_ranges = proto.RepeatedField(proto.STRING, number=432128083,) + src_ip_ranges = proto.RepeatedField( + proto.STRING, + number=432128083, + ) class SecurityPolicyRuleRateLimitOptions(proto.Message): @@ -48522,17 +63693,37 @@ class EnforceOnKey(proto.Enum): IP = 2343 XFF_IP = 438707118 - ban_duration_sec = proto.Field(proto.INT32, number=42896726, optional=True,) + ban_duration_sec = proto.Field( + proto.INT32, + number=42896726, + optional=True, + ) ban_threshold = proto.Field( proto.MESSAGE, number=501208123, optional=True, message="SecurityPolicyRuleRateLimitOptionsThreshold", ) - conform_action = proto.Field(proto.STRING, number=517612367, optional=True,) - enforce_on_key = proto.Field(proto.STRING, number=416648956, optional=True,) - enforce_on_key_name = proto.Field(proto.STRING, number=132555246, optional=True,) - exceed_action = proto.Field(proto.STRING, number=167159073, optional=True,) + conform_action = proto.Field( + proto.STRING, + number=517612367, + optional=True, + ) + enforce_on_key = proto.Field( + proto.STRING, + number=416648956, + optional=True, + ) + enforce_on_key_name = proto.Field( + proto.STRING, + number=132555246, + optional=True, + ) + exceed_action = proto.Field( + proto.STRING, + number=167159073, + optional=True, + ) exceed_redirect_options = proto.Field( proto.MESSAGE, number=473646694, @@ -48563,8 +63754,16 @@ class SecurityPolicyRuleRateLimitOptionsThreshold(proto.Message): This field is a member of `oneof`_ ``_interval_sec``. """ - count = proto.Field(proto.INT32, number=94851343, optional=True,) - interval_sec = proto.Field(proto.INT32, number=41084375, optional=True,) + count = proto.Field( + proto.INT32, + number=94851343, + optional=True, + ) + interval_sec = proto.Field( + proto.INT32, + number=41084375, + optional=True, + ) class SecurityPolicyRuleRedirectOptions(proto.Message): @@ -48591,8 +63790,16 @@ class Type(proto.Enum): EXTERNAL_302 = 395733761 GOOGLE_RECAPTCHA = 518803009 - target = proto.Field(proto.STRING, number=192835985, optional=True,) - type_ = proto.Field(proto.STRING, number=3575610, optional=True,) + target = proto.Field( + proto.STRING, + number=192835985, + optional=True, + ) + type_ = proto.Field( + proto.STRING, + number=3575610, + optional=True, + ) class SecuritySettings(proto.Message): @@ -48629,8 +63836,15 @@ class SecuritySettings(proto.Message): mode). Note: This field currently has no impact. """ - client_tls_policy = proto.Field(proto.STRING, number=462325226, optional=True,) - subject_alt_names = proto.RepeatedField(proto.STRING, number=330029535,) + client_tls_policy = proto.Field( + proto.STRING, + number=462325226, + optional=True, + ) + subject_alt_names = proto.RepeatedField( + proto.STRING, + number=330029535, + ) class SendDiagnosticInterruptInstanceRequest(proto.Message): @@ -48646,9 +63860,18 @@ class SendDiagnosticInterruptInstanceRequest(proto.Message): The name of the zone for this request. """ - instance = proto.Field(proto.STRING, number=18257045,) - project = proto.Field(proto.STRING, number=227560217,) - zone = proto.Field(proto.STRING, number=3744684,) + instance = proto.Field( + proto.STRING, + number=18257045, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class SendDiagnosticInterruptInstanceResponse(proto.Message): @@ -48694,11 +63917,31 @@ class SerialPortOutput(proto.Message): This field is a member of `oneof`_ ``_start``. """ - contents = proto.Field(proto.STRING, number=506419994, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_ = proto.Field(proto.INT64, number=3377907, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - start = proto.Field(proto.INT64, number=109757538, optional=True,) + contents = proto.Field( + proto.STRING, + number=506419994, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_ = proto.Field( + proto.INT64, + number=3377907, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + start = proto.Field( + proto.INT64, + number=109757538, + optional=True, + ) class ServerBinding(proto.Message): @@ -48719,7 +63962,11 @@ class Type(proto.Enum): RESTART_NODE_ON_MINIMAL_SERVERS = 204166495 SERVER_BINDING_TYPE_UNSPECIFIED = 180825512 - type_ = proto.Field(proto.STRING, number=3575610, optional=True,) + type_ = proto.Field( + proto.STRING, + number=3575610, + optional=True, + ) class ServiceAccount(proto.Message): @@ -48735,8 +63982,15 @@ class ServiceAccount(proto.Message): this service account. """ - email = proto.Field(proto.STRING, number=96619420, optional=True,) - scopes = proto.RepeatedField(proto.STRING, number=165973151,) + email = proto.Field( + proto.STRING, + number=96619420, + optional=True, + ) + scopes = proto.RepeatedField( + proto.STRING, + number=165973151, + ) class ServiceAttachment(proto.Message): @@ -48868,33 +64122,93 @@ class ConnectionPreference(proto.Enum): CONNECTION_PREFERENCE_UNSPECIFIED = 34590772 connected_endpoints = proto.RepeatedField( - proto.MESSAGE, number=72223688, message="ServiceAttachmentConnectedEndpoint", + proto.MESSAGE, + number=72223688, + message="ServiceAttachmentConnectedEndpoint", + ) + connection_preference = proto.Field( + proto.STRING, + number=285818076, + optional=True, ) - connection_preference = proto.Field(proto.STRING, number=285818076, optional=True,) consumer_accept_lists = proto.RepeatedField( proto.MESSAGE, number=402725703, message="ServiceAttachmentConsumerProjectLimit", ) - consumer_reject_lists = proto.RepeatedField(proto.STRING, number=204033182,) - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - domain_names = proto.RepeatedField(proto.STRING, number=6450189,) - enable_proxy_protocol = proto.Field(proto.BOOL, number=363791237, optional=True,) - fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - nat_subnets = proto.RepeatedField(proto.STRING, number=374785944,) + consumer_reject_lists = proto.RepeatedField( + proto.STRING, + number=204033182, + ) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + domain_names = proto.RepeatedField( + proto.STRING, + number=6450189, + ) + enable_proxy_protocol = proto.Field( + proto.BOOL, + number=363791237, + optional=True, + ) + fingerprint = proto.Field( + proto.STRING, + number=234678500, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + nat_subnets = proto.RepeatedField( + proto.STRING, + number=374785944, + ) producer_forwarding_rule = proto.Field( - proto.STRING, number=247927889, optional=True, + proto.STRING, + number=247927889, + optional=True, ) psc_service_attachment_id = proto.Field( - proto.MESSAGE, number=527695214, optional=True, message="Uint128", + proto.MESSAGE, + number=527695214, + optional=True, + message="Uint128", + ) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + target_service = proto.Field( + proto.STRING, + number=1293831, + optional=True, ) - region = proto.Field(proto.STRING, number=138946292, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - target_service = proto.Field(proto.STRING, number=1293831, optional=True,) class ServiceAttachmentAggregatedList(proto.Message): @@ -48938,19 +64252,41 @@ class ServiceAttachmentAggregatedList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.MapField( proto.STRING, proto.MESSAGE, number=100526016, message="ServiceAttachmentsScopedList", ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - unreachables = proto.RepeatedField(proto.STRING, number=243372063,) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -48986,9 +64322,21 @@ class Status(proto.Enum): REJECTED = 174130302 STATUS_UNSPECIFIED = 42133066 - endpoint = proto.Field(proto.STRING, number=130489749, optional=True,) - psc_connection_id = proto.Field(proto.UINT64, number=292082397, optional=True,) - status = proto.Field(proto.STRING, number=181260274, optional=True,) + endpoint = proto.Field( + proto.STRING, + number=130489749, + optional=True, + ) + psc_connection_id = proto.Field( + proto.UINT64, + number=292082397, + optional=True, + ) + status = proto.Field( + proto.STRING, + number=181260274, + optional=True, + ) class ServiceAttachmentConsumerProjectLimit(proto.Message): @@ -49006,8 +64354,16 @@ class ServiceAttachmentConsumerProjectLimit(proto.Message): This field is a member of `oneof`_ ``_project_id_or_num``. """ - connection_limit = proto.Field(proto.UINT32, number=131403546, optional=True,) - project_id_or_num = proto.Field(proto.STRING, number=349783336, optional=True,) + connection_limit = proto.Field( + proto.UINT32, + number=131403546, + optional=True, + ) + project_id_or_num = proto.Field( + proto.STRING, + number=349783336, + optional=True, + ) class ServiceAttachmentList(proto.Message): @@ -49049,15 +64405,36 @@ class ServiceAttachmentList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="ServiceAttachment", + proto.MESSAGE, + number=100526016, + message="ServiceAttachment", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -49076,10 +64453,15 @@ class ServiceAttachmentsScopedList(proto.Message): """ service_attachments = proto.RepeatedField( - proto.MESSAGE, number=307136806, message="ServiceAttachment", + proto.MESSAGE, + number=307136806, + message="ServiceAttachment", ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -49115,14 +64497,24 @@ class SetBackendServiceTargetSslProxyRequest(proto.Message): BackendService resource is to be set. """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) target_ssl_proxies_set_backend_service_request_resource = proto.Field( proto.MESSAGE, number=139080868, message="TargetSslProxiesSetBackendServiceRequest", ) - target_ssl_proxy = proto.Field(proto.STRING, number=338795853,) + target_ssl_proxy = proto.Field( + proto.STRING, + number=338795853, + ) class SetBackendServiceTargetTcpProxyRequest(proto.Message): @@ -49157,14 +64549,24 @@ class SetBackendServiceTargetTcpProxyRequest(proto.Message): BackendService resource is to be set. """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) target_tcp_proxies_set_backend_service_request_resource = proto.Field( proto.MESSAGE, number=273721583, message="TargetTcpProxiesSetBackendServiceRequest", ) - target_tcp_proxy = proto.Field(proto.STRING, number=503065442,) + target_tcp_proxy = proto.Field( + proto.STRING, + number=503065442, + ) class SetBackupTargetPoolRequest(proto.Message): @@ -49205,13 +64607,32 @@ class SetBackupTargetPoolRequest(proto.Message): The body resource for this request """ - failover_ratio = proto.Field(proto.FLOAT, number=212667006, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - target_pool = proto.Field(proto.STRING, number=62796298,) + failover_ratio = proto.Field( + proto.FLOAT, + number=212667006, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + target_pool = proto.Field( + proto.STRING, + number=62796298, + ) target_reference_resource = proto.Field( - proto.MESSAGE, number=523721712, message="TargetReference", + proto.MESSAGE, + number=523721712, + message="TargetReference", ) @@ -49245,10 +64666,19 @@ class SetCommonInstanceMetadataProjectRequest(proto.Message): """ metadata_resource = proto.Field( - proto.MESSAGE, number=291086110, message="Metadata", + proto.MESSAGE, + number=291086110, + message="Metadata", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class SetDefaultNetworkTierProjectRequest(proto.Message): @@ -49280,11 +64710,20 @@ class SetDefaultNetworkTierProjectRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - project = proto.Field(proto.STRING, number=227560217,) + project = proto.Field( + proto.STRING, + number=227560217, + ) projects_set_default_network_tier_request_resource = proto.Field( - proto.MESSAGE, number=126410762, message="ProjectsSetDefaultNetworkTierRequest", + proto.MESSAGE, + number=126410762, + message="ProjectsSetDefaultNetworkTierRequest", + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class SetDeletionProtectionInstanceRequest(proto.Message): @@ -49323,11 +64762,28 @@ class SetDeletionProtectionInstanceRequest(proto.Message): The name of the zone for this request. """ - deletion_protection = proto.Field(proto.BOOL, number=458014698, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - resource = proto.Field(proto.STRING, number=195806222,) - zone = proto.Field(proto.STRING, number=3744684,) + deletion_protection = proto.Field( + proto.BOOL, + number=458014698, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + resource = proto.Field( + proto.STRING, + number=195806222, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class SetDiskAutoDeleteInstanceRequest(proto.Message): @@ -49368,12 +64824,31 @@ class SetDiskAutoDeleteInstanceRequest(proto.Message): The name of the zone for this request. """ - auto_delete = proto.Field(proto.BOOL, number=464761403,) - device_name = proto.Field(proto.STRING, number=67541716,) - instance = proto.Field(proto.STRING, number=18257045,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + auto_delete = proto.Field( + proto.BOOL, + number=464761403, + ) + device_name = proto.Field( + proto.STRING, + number=67541716, + ) + instance = proto.Field( + proto.STRING, + number=18257045, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class SetEdgeSecurityPolicyBackendBucketRequest(proto.Message): @@ -49409,11 +64884,23 @@ class SetEdgeSecurityPolicyBackendBucketRequest(proto.Message): The body resource for this request """ - backend_bucket = proto.Field(proto.STRING, number=91714037,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + backend_bucket = proto.Field( + proto.STRING, + number=91714037, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) security_policy_reference_resource = proto.Field( - proto.MESSAGE, number=204135024, message="SecurityPolicyReference", + proto.MESSAGE, + number=204135024, + message="SecurityPolicyReference", ) @@ -49450,11 +64937,23 @@ class SetEdgeSecurityPolicyBackendServiceRequest(proto.Message): The body resource for this request """ - backend_service = proto.Field(proto.STRING, number=306946058,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + backend_service = proto.Field( + proto.STRING, + number=306946058, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) security_policy_reference_resource = proto.Field( - proto.MESSAGE, number=204135024, message="SecurityPolicyReference", + proto.MESSAGE, + number=204135024, + message="SecurityPolicyReference", ) @@ -49473,11 +64972,22 @@ class SetIamPolicyDiskRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - resource = proto.Field(proto.STRING, number=195806222,) - zone = proto.Field(proto.STRING, number=3744684,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) zone_set_policy_request_resource = proto.Field( - proto.MESSAGE, number=382082107, message="ZoneSetPolicyRequest", + proto.MESSAGE, + number=382082107, + message="ZoneSetPolicyRequest", ) @@ -49493,9 +65003,14 @@ class SetIamPolicyFirewallPolicyRequest(proto.Message): """ global_organization_set_policy_request_resource = proto.Field( - proto.MESSAGE, number=177408606, message="GlobalOrganizationSetPolicyRequest", + proto.MESSAGE, + number=177408606, + message="GlobalOrganizationSetPolicyRequest", + ) + resource = proto.Field( + proto.STRING, + number=195806222, ) - resource = proto.Field(proto.STRING, number=195806222,) class SetIamPolicyImageRequest(proto.Message): @@ -49512,10 +65027,18 @@ class SetIamPolicyImageRequest(proto.Message): """ global_set_policy_request_resource = proto.Field( - proto.MESSAGE, number=337048498, message="GlobalSetPolicyRequest", + proto.MESSAGE, + number=337048498, + message="GlobalSetPolicyRequest", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, ) - project = proto.Field(proto.STRING, number=227560217,) - resource = proto.Field(proto.STRING, number=195806222,) class SetIamPolicyInstanceRequest(proto.Message): @@ -49533,11 +65056,22 @@ class SetIamPolicyInstanceRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - resource = proto.Field(proto.STRING, number=195806222,) - zone = proto.Field(proto.STRING, number=3744684,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) zone_set_policy_request_resource = proto.Field( - proto.MESSAGE, number=382082107, message="ZoneSetPolicyRequest", + proto.MESSAGE, + number=382082107, + message="ZoneSetPolicyRequest", ) @@ -49555,10 +65089,18 @@ class SetIamPolicyInstanceTemplateRequest(proto.Message): """ global_set_policy_request_resource = proto.Field( - proto.MESSAGE, number=337048498, message="GlobalSetPolicyRequest", + proto.MESSAGE, + number=337048498, + message="GlobalSetPolicyRequest", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, ) - project = proto.Field(proto.STRING, number=227560217,) - resource = proto.Field(proto.STRING, number=195806222,) class SetIamPolicyLicenseRequest(proto.Message): @@ -49575,10 +65117,18 @@ class SetIamPolicyLicenseRequest(proto.Message): """ global_set_policy_request_resource = proto.Field( - proto.MESSAGE, number=337048498, message="GlobalSetPolicyRequest", + proto.MESSAGE, + number=337048498, + message="GlobalSetPolicyRequest", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, ) - project = proto.Field(proto.STRING, number=227560217,) - resource = proto.Field(proto.STRING, number=195806222,) class SetIamPolicyMachineImageRequest(proto.Message): @@ -49595,10 +65145,18 @@ class SetIamPolicyMachineImageRequest(proto.Message): """ global_set_policy_request_resource = proto.Field( - proto.MESSAGE, number=337048498, message="GlobalSetPolicyRequest", + proto.MESSAGE, + number=337048498, + message="GlobalSetPolicyRequest", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, ) - project = proto.Field(proto.STRING, number=227560217,) - resource = proto.Field(proto.STRING, number=195806222,) class SetIamPolicyNodeGroupRequest(proto.Message): @@ -49616,11 +65174,22 @@ class SetIamPolicyNodeGroupRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - resource = proto.Field(proto.STRING, number=195806222,) - zone = proto.Field(proto.STRING, number=3744684,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) zone_set_policy_request_resource = proto.Field( - proto.MESSAGE, number=382082107, message="ZoneSetPolicyRequest", + proto.MESSAGE, + number=382082107, + message="ZoneSetPolicyRequest", ) @@ -49639,12 +65208,23 @@ class SetIamPolicyNodeTemplateRequest(proto.Message): Name or id of the resource for this request. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) region_set_policy_request_resource = proto.Field( - proto.MESSAGE, number=276489091, message="RegionSetPolicyRequest", + proto.MESSAGE, + number=276489091, + message="RegionSetPolicyRequest", + ) + resource = proto.Field( + proto.STRING, + number=195806222, ) - resource = proto.Field(proto.STRING, number=195806222,) class SetIamPolicyRegionDiskRequest(proto.Message): @@ -49662,12 +65242,23 @@ class SetIamPolicyRegionDiskRequest(proto.Message): Name or id of the resource for this request. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) region_set_policy_request_resource = proto.Field( - proto.MESSAGE, number=276489091, message="RegionSetPolicyRequest", + proto.MESSAGE, + number=276489091, + message="RegionSetPolicyRequest", + ) + resource = proto.Field( + proto.STRING, + number=195806222, ) - resource = proto.Field(proto.STRING, number=195806222,) class SetIamPolicyReservationRequest(proto.Message): @@ -49685,11 +65276,22 @@ class SetIamPolicyReservationRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - resource = proto.Field(proto.STRING, number=195806222,) - zone = proto.Field(proto.STRING, number=3744684,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) zone_set_policy_request_resource = proto.Field( - proto.MESSAGE, number=382082107, message="ZoneSetPolicyRequest", + proto.MESSAGE, + number=382082107, + message="ZoneSetPolicyRequest", ) @@ -49708,12 +65310,23 @@ class SetIamPolicyResourcePolicyRequest(proto.Message): Name or id of the resource for this request. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) region_set_policy_request_resource = proto.Field( - proto.MESSAGE, number=276489091, message="RegionSetPolicyRequest", + proto.MESSAGE, + number=276489091, + message="RegionSetPolicyRequest", + ) + resource = proto.Field( + proto.STRING, + number=195806222, ) - resource = proto.Field(proto.STRING, number=195806222,) class SetIamPolicyServiceAttachmentRequest(proto.Message): @@ -49731,12 +65344,23 @@ class SetIamPolicyServiceAttachmentRequest(proto.Message): Name or id of the resource for this request. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) region_set_policy_request_resource = proto.Field( - proto.MESSAGE, number=276489091, message="RegionSetPolicyRequest", + proto.MESSAGE, + number=276489091, + message="RegionSetPolicyRequest", + ) + resource = proto.Field( + proto.STRING, + number=195806222, ) - resource = proto.Field(proto.STRING, number=195806222,) class SetIamPolicySnapshotRequest(proto.Message): @@ -49753,10 +65377,18 @@ class SetIamPolicySnapshotRequest(proto.Message): """ global_set_policy_request_resource = proto.Field( - proto.MESSAGE, number=337048498, message="GlobalSetPolicyRequest", + proto.MESSAGE, + number=337048498, + message="GlobalSetPolicyRequest", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, ) - project = proto.Field(proto.STRING, number=227560217,) - resource = proto.Field(proto.STRING, number=195806222,) class SetIamPolicySubnetworkRequest(proto.Message): @@ -49774,12 +65406,23 @@ class SetIamPolicySubnetworkRequest(proto.Message): Name or id of the resource for this request. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) region_set_policy_request_resource = proto.Field( - proto.MESSAGE, number=276489091, message="RegionSetPolicyRequest", + proto.MESSAGE, + number=276489091, + message="RegionSetPolicyRequest", + ) + resource = proto.Field( + proto.STRING, + number=195806222, ) - resource = proto.Field(proto.STRING, number=195806222,) class SetInstanceTemplateInstanceGroupManagerRequest(proto.Message): @@ -49817,15 +65460,28 @@ class SetInstanceTemplateInstanceGroupManagerRequest(proto.Message): instance group is located. """ - instance_group_manager = proto.Field(proto.STRING, number=249363395,) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) instance_group_managers_set_instance_template_request_resource = proto.Field( proto.MESSAGE, number=9809093, message="InstanceGroupManagersSetInstanceTemplateRequest", ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class SetInstanceTemplateRegionInstanceGroupManagerRequest(proto.Message): @@ -49862,15 +65518,28 @@ class SetInstanceTemplateRegionInstanceGroupManagerRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - instance_group_manager = proto.Field(proto.STRING, number=249363395,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) region_instance_group_managers_set_template_request_resource = proto.Field( proto.MESSAGE, number=187310412, message="RegionInstanceGroupManagersSetTemplateRequest", ) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class SetLabelsDiskRequest(proto.Message): @@ -49906,12 +65575,27 @@ class SetLabelsDiskRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - resource = proto.Field(proto.STRING, number=195806222,) - zone = proto.Field(proto.STRING, number=3744684,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + resource = proto.Field( + proto.STRING, + number=195806222, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) zone_set_labels_request_resource = proto.Field( - proto.MESSAGE, number=364950798, message="ZoneSetLabelsRequest", + proto.MESSAGE, + number=364950798, + message="ZoneSetLabelsRequest", ) @@ -49929,10 +65613,18 @@ class SetLabelsExternalVpnGatewayRequest(proto.Message): """ global_set_labels_request_resource = proto.Field( - proto.MESSAGE, number=319917189, message="GlobalSetLabelsRequest", + proto.MESSAGE, + number=319917189, + message="GlobalSetLabelsRequest", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, ) - project = proto.Field(proto.STRING, number=227560217,) - resource = proto.Field(proto.STRING, number=195806222,) class SetLabelsForwardingRuleRequest(proto.Message): @@ -49968,13 +65660,28 @@ class SetLabelsForwardingRuleRequest(proto.Message): Name or id of the resource for this request. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) region_set_labels_request_resource = proto.Field( - proto.MESSAGE, number=259357782, message="RegionSetLabelsRequest", + proto.MESSAGE, + number=259357782, + message="RegionSetLabelsRequest", + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + resource = proto.Field( + proto.STRING, + number=195806222, ) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - resource = proto.Field(proto.STRING, number=195806222,) class SetLabelsGlobalForwardingRuleRequest(proto.Message): @@ -49991,10 +65698,18 @@ class SetLabelsGlobalForwardingRuleRequest(proto.Message): """ global_set_labels_request_resource = proto.Field( - proto.MESSAGE, number=319917189, message="GlobalSetLabelsRequest", + proto.MESSAGE, + number=319917189, + message="GlobalSetLabelsRequest", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, ) - project = proto.Field(proto.STRING, number=227560217,) - resource = proto.Field(proto.STRING, number=195806222,) class SetLabelsImageRequest(proto.Message): @@ -50011,10 +65726,18 @@ class SetLabelsImageRequest(proto.Message): """ global_set_labels_request_resource = proto.Field( - proto.MESSAGE, number=319917189, message="GlobalSetLabelsRequest", + proto.MESSAGE, + number=319917189, + message="GlobalSetLabelsRequest", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, ) - project = proto.Field(proto.STRING, number=227560217,) - resource = proto.Field(proto.STRING, number=195806222,) class SetLabelsInstanceRequest(proto.Message): @@ -50050,13 +65773,28 @@ class SetLabelsInstanceRequest(proto.Message): The name of the zone for this request. """ - instance = proto.Field(proto.STRING, number=18257045,) + instance = proto.Field( + proto.STRING, + number=18257045, + ) instances_set_labels_request_resource = proto.Field( - proto.MESSAGE, number=207749344, message="InstancesSetLabelsRequest", + proto.MESSAGE, + number=207749344, + message="InstancesSetLabelsRequest", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) class SetLabelsRegionDiskRequest(proto.Message): @@ -50092,13 +65830,28 @@ class SetLabelsRegionDiskRequest(proto.Message): Name or id of the resource for this request. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) region_set_labels_request_resource = proto.Field( - proto.MESSAGE, number=259357782, message="RegionSetLabelsRequest", + proto.MESSAGE, + number=259357782, + message="RegionSetLabelsRequest", + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + resource = proto.Field( + proto.STRING, + number=195806222, ) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - resource = proto.Field(proto.STRING, number=195806222,) class SetLabelsSnapshotRequest(proto.Message): @@ -50115,10 +65868,18 @@ class SetLabelsSnapshotRequest(proto.Message): """ global_set_labels_request_resource = proto.Field( - proto.MESSAGE, number=319917189, message="GlobalSetLabelsRequest", + proto.MESSAGE, + number=319917189, + message="GlobalSetLabelsRequest", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, ) - project = proto.Field(proto.STRING, number=227560217,) - resource = proto.Field(proto.STRING, number=195806222,) class SetLabelsVpnGatewayRequest(proto.Message): @@ -50154,13 +65915,28 @@ class SetLabelsVpnGatewayRequest(proto.Message): Name or id of the resource for this request. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) region_set_labels_request_resource = proto.Field( - proto.MESSAGE, number=259357782, message="RegionSetLabelsRequest", + proto.MESSAGE, + number=259357782, + message="RegionSetLabelsRequest", + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + resource = proto.Field( + proto.STRING, + number=195806222, ) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - resource = proto.Field(proto.STRING, number=195806222,) class SetMachineResourcesInstanceRequest(proto.Message): @@ -50196,13 +65972,28 @@ class SetMachineResourcesInstanceRequest(proto.Message): The name of the zone for this request. """ - instance = proto.Field(proto.STRING, number=18257045,) + instance = proto.Field( + proto.STRING, + number=18257045, + ) instances_set_machine_resources_request_resource = proto.Field( - proto.MESSAGE, number=196286318, message="InstancesSetMachineResourcesRequest", + proto.MESSAGE, + number=196286318, + message="InstancesSetMachineResourcesRequest", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) class SetMachineTypeInstanceRequest(proto.Message): @@ -50238,13 +66029,28 @@ class SetMachineTypeInstanceRequest(proto.Message): The name of the zone for this request. """ - instance = proto.Field(proto.STRING, number=18257045,) + instance = proto.Field( + proto.STRING, + number=18257045, + ) instances_set_machine_type_request_resource = proto.Field( - proto.MESSAGE, number=254157709, message="InstancesSetMachineTypeRequest", + proto.MESSAGE, + number=254157709, + message="InstancesSetMachineTypeRequest", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) class SetMetadataInstanceRequest(proto.Message): @@ -50280,13 +66086,28 @@ class SetMetadataInstanceRequest(proto.Message): The name of the zone for this request. """ - instance = proto.Field(proto.STRING, number=18257045,) + instance = proto.Field( + proto.STRING, + number=18257045, + ) metadata_resource = proto.Field( - proto.MESSAGE, number=291086110, message="Metadata", + proto.MESSAGE, + number=291086110, + message="Metadata", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) class SetMinCpuPlatformInstanceRequest(proto.Message): @@ -50322,13 +66143,28 @@ class SetMinCpuPlatformInstanceRequest(proto.Message): The name of the zone for this request. """ - instance = proto.Field(proto.STRING, number=18257045,) + instance = proto.Field( + proto.STRING, + number=18257045, + ) instances_set_min_cpu_platform_request_resource = proto.Field( - proto.MESSAGE, number=148459368, message="InstancesSetMinCpuPlatformRequest", + proto.MESSAGE, + number=148459368, + message="InstancesSetMinCpuPlatformRequest", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) class SetNamedPortsInstanceGroupRequest(proto.Message): @@ -50366,13 +66202,28 @@ class SetNamedPortsInstanceGroupRequest(proto.Message): is located. """ - instance_group = proto.Field(proto.STRING, number=81095253,) + instance_group = proto.Field( + proto.STRING, + number=81095253, + ) instance_groups_set_named_ports_request_resource = proto.Field( - proto.MESSAGE, number=385151535, message="InstanceGroupsSetNamedPortsRequest", + proto.MESSAGE, + number=385151535, + message="InstanceGroupsSetNamedPortsRequest", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) class SetNamedPortsRegionInstanceGroupRequest(proto.Message): @@ -50409,15 +66260,28 @@ class SetNamedPortsRegionInstanceGroupRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - instance_group = proto.Field(proto.STRING, number=81095253,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + instance_group = proto.Field( + proto.STRING, + number=81095253, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) region_instance_groups_set_named_ports_request_resource = proto.Field( proto.MESSAGE, number=1574938, message="RegionInstanceGroupsSetNamedPortsRequest", ) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class SetNodeTemplateNodeGroupRequest(proto.Message): @@ -50453,13 +66317,28 @@ class SetNodeTemplateNodeGroupRequest(proto.Message): The name of the zone for this request. """ - node_group = proto.Field(proto.STRING, number=469958146,) + node_group = proto.Field( + proto.STRING, + number=469958146, + ) node_groups_set_node_template_request_resource = proto.Field( - proto.MESSAGE, number=117382321, message="NodeGroupsSetNodeTemplateRequest", + proto.MESSAGE, + number=117382321, + message="NodeGroupsSetNodeTemplateRequest", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) class SetPrivateIpGoogleAccessSubnetworkRequest(proto.Message): @@ -50495,10 +66374,23 @@ class SetPrivateIpGoogleAccessSubnetworkRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - subnetwork = proto.Field(proto.STRING, number=307827694,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + subnetwork = proto.Field( + proto.STRING, + number=307827694, + ) subnetworks_set_private_ip_google_access_request_resource = proto.Field( proto.MESSAGE, number=268920696, @@ -50538,14 +66430,24 @@ class SetProxyHeaderTargetSslProxyRequest(proto.Message): ProxyHeader is to be set. """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) target_ssl_proxies_set_proxy_header_request_resource = proto.Field( proto.MESSAGE, number=205284526, message="TargetSslProxiesSetProxyHeaderRequest", ) - target_ssl_proxy = proto.Field(proto.STRING, number=338795853,) + target_ssl_proxy = proto.Field( + proto.STRING, + number=338795853, + ) class SetProxyHeaderTargetTcpProxyRequest(proto.Message): @@ -50580,14 +66482,24 @@ class SetProxyHeaderTargetTcpProxyRequest(proto.Message): ProxyHeader is to be set. """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) target_tcp_proxies_set_proxy_header_request_resource = proto.Field( proto.MESSAGE, number=219958339, message="TargetTcpProxiesSetProxyHeaderRequest", ) - target_tcp_proxy = proto.Field(proto.STRING, number=503065442,) + target_tcp_proxy = proto.Field( + proto.STRING, + number=503065442, + ) class SetQuicOverrideTargetHttpsProxyRequest(proto.Message): @@ -50623,14 +66535,24 @@ class SetQuicOverrideTargetHttpsProxyRequest(proto.Message): conform to RFC1035. """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) target_https_proxies_set_quic_override_request_resource = proto.Field( proto.MESSAGE, number=72940258, message="TargetHttpsProxiesSetQuicOverrideRequest", ) - target_https_proxy = proto.Field(proto.STRING, number=52336748,) + target_https_proxy = proto.Field( + proto.STRING, + number=52336748, + ) class SetSchedulingInstanceRequest(proto.Message): @@ -50666,13 +66588,28 @@ class SetSchedulingInstanceRequest(proto.Message): The name of the zone for this request. """ - instance = proto.Field(proto.STRING, number=18257045,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + instance = proto.Field( + proto.STRING, + number=18257045, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) scheduling_resource = proto.Field( - proto.MESSAGE, number=463181401, message="Scheduling", + proto.MESSAGE, + number=463181401, + message="Scheduling", + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - zone = proto.Field(proto.STRING, number=3744684,) class SetSecurityPolicyBackendServiceRequest(proto.Message): @@ -50708,11 +66645,23 @@ class SetSecurityPolicyBackendServiceRequest(proto.Message): The body resource for this request """ - backend_service = proto.Field(proto.STRING, number=306946058,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + backend_service = proto.Field( + proto.STRING, + number=306946058, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) security_policy_reference_resource = proto.Field( - proto.MESSAGE, number=204135024, message="SecurityPolicyReference", + proto.MESSAGE, + number=204135024, + message="SecurityPolicyReference", ) @@ -50749,13 +66698,28 @@ class SetServiceAccountInstanceRequest(proto.Message): The name of the zone for this request. """ - instance = proto.Field(proto.STRING, number=18257045,) + instance = proto.Field( + proto.STRING, + number=18257045, + ) instances_set_service_account_request_resource = proto.Field( - proto.MESSAGE, number=275550008, message="InstancesSetServiceAccountRequest", + proto.MESSAGE, + number=275550008, + message="InstancesSetServiceAccountRequest", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) class SetShieldedInstanceIntegrityPolicyInstanceRequest(proto.Message): @@ -50793,13 +66757,28 @@ class SetShieldedInstanceIntegrityPolicyInstanceRequest(proto.Message): The name of the zone for this request. """ - instance = proto.Field(proto.STRING, number=18257045,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + instance = proto.Field( + proto.STRING, + number=18257045, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) shielded_instance_integrity_policy_resource = proto.Field( - proto.MESSAGE, number=409169462, message="ShieldedInstanceIntegrityPolicy", + proto.MESSAGE, + number=409169462, + message="ShieldedInstanceIntegrityPolicy", + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - zone = proto.Field(proto.STRING, number=3744684,) class SetSslCertificatesRegionTargetHttpsProxyRequest(proto.Message): @@ -50837,15 +66816,28 @@ class SetSslCertificatesRegionTargetHttpsProxyRequest(proto.Message): an SslCertificates resource for. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) region_target_https_proxies_set_ssl_certificates_request_resource = proto.Field( proto.MESSAGE, number=390693383, message="RegionTargetHttpsProxiesSetSslCertificatesRequest", ) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - target_https_proxy = proto.Field(proto.STRING, number=52336748,) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + target_https_proxy = proto.Field( + proto.STRING, + number=52336748, + ) class SetSslCertificatesTargetHttpsProxyRequest(proto.Message): @@ -50880,14 +66872,24 @@ class SetSslCertificatesTargetHttpsProxyRequest(proto.Message): an SslCertificates resource for. """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) target_https_proxies_set_ssl_certificates_request_resource = proto.Field( proto.MESSAGE, number=223122908, message="TargetHttpsProxiesSetSslCertificatesRequest", ) - target_https_proxy = proto.Field(proto.STRING, number=52336748,) + target_https_proxy = proto.Field( + proto.STRING, + number=52336748, + ) class SetSslCertificatesTargetSslProxyRequest(proto.Message): @@ -50922,14 +66924,24 @@ class SetSslCertificatesTargetSslProxyRequest(proto.Message): SslCertificate resource is to be set. """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) target_ssl_proxies_set_ssl_certificates_request_resource = proto.Field( proto.MESSAGE, number=147940797, message="TargetSslProxiesSetSslCertificatesRequest", ) - target_ssl_proxy = proto.Field(proto.STRING, number=338795853,) + target_ssl_proxy = proto.Field( + proto.STRING, + number=338795853, + ) class SetSslPolicyTargetHttpsProxyRequest(proto.Message): @@ -50965,12 +66977,24 @@ class SetSslPolicyTargetHttpsProxyRequest(proto.Message): characters long, and comply with RFC1035. """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) ssl_policy_reference_resource = proto.Field( - proto.MESSAGE, number=235403836, message="SslPolicyReference", + proto.MESSAGE, + number=235403836, + message="SslPolicyReference", + ) + target_https_proxy = proto.Field( + proto.STRING, + number=52336748, ) - target_https_proxy = proto.Field(proto.STRING, number=52336748,) class SetSslPolicyTargetSslProxyRequest(proto.Message): @@ -51006,12 +67030,24 @@ class SetSslPolicyTargetSslProxyRequest(proto.Message): characters long, and comply with RFC1035. """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) ssl_policy_reference_resource = proto.Field( - proto.MESSAGE, number=235403836, message="SslPolicyReference", + proto.MESSAGE, + number=235403836, + message="SslPolicyReference", + ) + target_ssl_proxy = proto.Field( + proto.STRING, + number=338795853, ) - target_ssl_proxy = proto.Field(proto.STRING, number=338795853,) class SetTagsInstanceRequest(proto.Message): @@ -51047,11 +67083,28 @@ class SetTagsInstanceRequest(proto.Message): The name of the zone for this request. """ - instance = proto.Field(proto.STRING, number=18257045,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - tags_resource = proto.Field(proto.MESSAGE, number=331435380, message="Tags",) - zone = proto.Field(proto.STRING, number=3744684,) + instance = proto.Field( + proto.STRING, + number=18257045, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + tags_resource = proto.Field( + proto.MESSAGE, + number=331435380, + message="Tags", + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class SetTargetForwardingRuleRequest(proto.Message): @@ -51088,12 +67141,27 @@ class SetTargetForwardingRuleRequest(proto.Message): The body resource for this request """ - forwarding_rule = proto.Field(proto.STRING, number=269964030,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + forwarding_rule = proto.Field( + proto.STRING, + number=269964030, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) target_reference_resource = proto.Field( - proto.MESSAGE, number=523721712, message="TargetReference", + proto.MESSAGE, + number=523721712, + message="TargetReference", ) @@ -51129,11 +67197,23 @@ class SetTargetGlobalForwardingRuleRequest(proto.Message): The body resource for this request """ - forwarding_rule = proto.Field(proto.STRING, number=269964030,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + forwarding_rule = proto.Field( + proto.STRING, + number=269964030, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) target_reference_resource = proto.Field( - proto.MESSAGE, number=523721712, message="TargetReference", + proto.MESSAGE, + number=523721712, + message="TargetReference", ) @@ -51171,15 +67251,28 @@ class SetTargetPoolsInstanceGroupManagerRequest(proto.Message): instance group is located. """ - instance_group_manager = proto.Field(proto.STRING, number=249363395,) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) instance_group_managers_set_target_pools_request_resource = proto.Field( proto.MESSAGE, number=281150216, message="InstanceGroupManagersSetTargetPoolsRequest", ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class SetTargetPoolsRegionInstanceGroupManagerRequest(proto.Message): @@ -51216,15 +67309,28 @@ class SetTargetPoolsRegionInstanceGroupManagerRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - instance_group_manager = proto.Field(proto.STRING, number=249363395,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) region_instance_group_managers_set_target_pools_request_resource = proto.Field( proto.MESSAGE, number=78734717, message="RegionInstanceGroupManagersSetTargetPoolsRequest", ) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class SetUrlMapRegionTargetHttpProxyRequest(proto.Message): @@ -51261,12 +67367,27 @@ class SetUrlMapRegionTargetHttpProxyRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - target_http_proxy = proto.Field(proto.STRING, number=206872421,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + target_http_proxy = proto.Field( + proto.STRING, + number=206872421, + ) url_map_reference_resource = proto.Field( - proto.MESSAGE, number=398701333, message="UrlMapReference", + proto.MESSAGE, + number=398701333, + message="UrlMapReference", ) @@ -51304,12 +67425,27 @@ class SetUrlMapRegionTargetHttpsProxyRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - target_https_proxy = proto.Field(proto.STRING, number=52336748,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + target_https_proxy = proto.Field( + proto.STRING, + number=52336748, + ) url_map_reference_resource = proto.Field( - proto.MESSAGE, number=398701333, message="UrlMapReference", + proto.MESSAGE, + number=398701333, + message="UrlMapReference", ) @@ -51345,11 +67481,23 @@ class SetUrlMapTargetHttpProxyRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - target_http_proxy = proto.Field(proto.STRING, number=206872421,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + target_http_proxy = proto.Field( + proto.STRING, + number=206872421, + ) url_map_reference_resource = proto.Field( - proto.MESSAGE, number=398701333, message="UrlMapReference", + proto.MESSAGE, + number=398701333, + message="UrlMapReference", ) @@ -51385,11 +67533,23 @@ class SetUrlMapTargetHttpsProxyRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - target_https_proxy = proto.Field(proto.STRING, number=52336748,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + target_https_proxy = proto.Field( + proto.STRING, + number=52336748, + ) url_map_reference_resource = proto.Field( - proto.MESSAGE, number=398701333, message="UrlMapReference", + proto.MESSAGE, + number=398701333, + message="UrlMapReference", ) @@ -51422,10 +67582,19 @@ class SetUsageExportBucketProjectRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) usage_export_location_resource = proto.Field( - proto.MESSAGE, number=20260459, message="UsageExportLocation", + proto.MESSAGE, + number=20260459, + message="UsageExportLocation", ) @@ -51458,7 +67627,11 @@ class ShareType(proto.Enum): number=134212406, message="ShareSettingsProjectConfig", ) - share_type = proto.Field(proto.STRING, number=359533466, optional=True,) + share_type = proto.Field( + proto.STRING, + number=359533466, + optional=True, + ) class ShareSettingsProjectConfig(proto.Message): @@ -51472,7 +67645,11 @@ class ShareSettingsProjectConfig(proto.Message): This field is a member of `oneof`_ ``_project_id``. """ - project_id = proto.Field(proto.STRING, number=177513473, optional=True,) + project_id = proto.Field( + proto.STRING, + number=177513473, + optional=True, + ) class ShieldedInstanceConfig(proto.Message): @@ -51497,10 +67674,20 @@ class ShieldedInstanceConfig(proto.Message): """ enable_integrity_monitoring = proto.Field( - proto.BOOL, number=409071030, optional=True, + proto.BOOL, + number=409071030, + optional=True, + ) + enable_secure_boot = proto.Field( + proto.BOOL, + number=123568638, + optional=True, + ) + enable_vtpm = proto.Field( + proto.BOOL, + number=181858935, + optional=True, ) - enable_secure_boot = proto.Field(proto.BOOL, number=123568638, optional=True,) - enable_vtpm = proto.Field(proto.BOOL, number=181858935, optional=True,) class ShieldedInstanceIdentity(proto.Message): @@ -51533,7 +67720,11 @@ class ShieldedInstanceIdentity(proto.Message): optional=True, message="ShieldedInstanceIdentityEntry", ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) signing_key = proto.Field( proto.MESSAGE, number=320948261, @@ -51557,8 +67748,16 @@ class ShieldedInstanceIdentityEntry(proto.Message): This field is a member of `oneof`_ ``_ek_pub``. """ - ek_cert = proto.Field(proto.STRING, number=450178589, optional=True,) - ek_pub = proto.Field(proto.STRING, number=308947940, optional=True,) + ek_cert = proto.Field( + proto.STRING, + number=450178589, + optional=True, + ) + ek_pub = proto.Field( + proto.STRING, + number=308947940, + optional=True, + ) class ShieldedInstanceIntegrityPolicy(proto.Message): @@ -51574,7 +67773,11 @@ class ShieldedInstanceIntegrityPolicy(proto.Message): This field is a member of `oneof`_ ``_update_auto_learn_policy``. """ - update_auto_learn_policy = proto.Field(proto.BOOL, number=245490215, optional=True,) + update_auto_learn_policy = proto.Field( + proto.BOOL, + number=245490215, + optional=True, + ) class SignedUrlKey(proto.Message): @@ -51600,8 +67803,16 @@ class SignedUrlKey(proto.Message): This field is a member of `oneof`_ ``_key_value``. """ - key_name = proto.Field(proto.STRING, number=500938859, optional=True,) - key_value = proto.Field(proto.STRING, number=504106897, optional=True,) + key_name = proto.Field( + proto.STRING, + number=500938859, + optional=True, + ) + key_value = proto.Field( + proto.STRING, + number=504106897, + optional=True, + ) class SimulateMaintenanceEventInstanceRequest(proto.Message): @@ -51617,9 +67828,18 @@ class SimulateMaintenanceEventInstanceRequest(proto.Message): The name of the zone for this request. """ - instance = proto.Field(proto.STRING, number=18257045,) - project = proto.Field(proto.STRING, number=227560217,) - zone = proto.Field(proto.STRING, number=3744684,) + instance = proto.Field( + proto.STRING, + number=18257045, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class Snapshot(proto.Message): @@ -51808,34 +68028,125 @@ class StorageBytesStatus(proto.Enum): UPDATING = 494614342 UP_TO_DATE = 101306702 - auto_created = proto.Field(proto.BOOL, number=463922264, optional=True,) - chain_name = proto.Field(proto.STRING, number=68644169, optional=True,) - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - disk_size_gb = proto.Field(proto.INT64, number=316263735, optional=True,) - download_bytes = proto.Field(proto.INT64, number=435054068, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - label_fingerprint = proto.Field(proto.STRING, number=178124825, optional=True,) - labels = proto.MapField(proto.STRING, proto.STRING, number=500195327,) - license_codes = proto.RepeatedField(proto.INT64, number=45482664,) - licenses = proto.RepeatedField(proto.STRING, number=337642578,) - location_hint = proto.Field(proto.STRING, number=350519505, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - satisfies_pzs = proto.Field(proto.BOOL, number=480964267, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + auto_created = proto.Field( + proto.BOOL, + number=463922264, + optional=True, + ) + chain_name = proto.Field( + proto.STRING, + number=68644169, + optional=True, + ) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + disk_size_gb = proto.Field( + proto.INT64, + number=316263735, + optional=True, + ) + download_bytes = proto.Field( + proto.INT64, + number=435054068, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + label_fingerprint = proto.Field( + proto.STRING, + number=178124825, + optional=True, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=500195327, + ) + license_codes = proto.RepeatedField( + proto.INT64, + number=45482664, + ) + licenses = proto.RepeatedField( + proto.STRING, + number=337642578, + ) + location_hint = proto.Field( + proto.STRING, + number=350519505, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + satisfies_pzs = proto.Field( + proto.BOOL, + number=480964267, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) snapshot_encryption_key = proto.Field( - proto.MESSAGE, number=43334526, optional=True, message="CustomerEncryptionKey", + proto.MESSAGE, + number=43334526, + optional=True, + message="CustomerEncryptionKey", + ) + source_disk = proto.Field( + proto.STRING, + number=451753793, + optional=True, ) - source_disk = proto.Field(proto.STRING, number=451753793, optional=True,) source_disk_encryption_key = proto.Field( - proto.MESSAGE, number=531501153, optional=True, message="CustomerEncryptionKey", + proto.MESSAGE, + number=531501153, + optional=True, + message="CustomerEncryptionKey", + ) + source_disk_id = proto.Field( + proto.STRING, + number=454190809, + optional=True, + ) + status = proto.Field( + proto.STRING, + number=181260274, + optional=True, + ) + storage_bytes = proto.Field( + proto.INT64, + number=424631719, + optional=True, + ) + storage_bytes_status = proto.Field( + proto.STRING, + number=490739082, + optional=True, + ) + storage_locations = proto.RepeatedField( + proto.STRING, + number=328005274, ) - source_disk_id = proto.Field(proto.STRING, number=454190809, optional=True,) - status = proto.Field(proto.STRING, number=181260274, optional=True,) - storage_bytes = proto.Field(proto.INT64, number=424631719, optional=True,) - storage_bytes_status = proto.Field(proto.STRING, number=490739082, optional=True,) - storage_locations = proto.RepeatedField(proto.STRING, number=328005274,) class SnapshotList(proto.Message): @@ -51876,13 +68187,36 @@ class SnapshotList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) - items = proto.RepeatedField(proto.MESSAGE, number=100526016, message="Snapshot",) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) + items = proto.RepeatedField( + proto.MESSAGE, + number=100526016, + message="Snapshot", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -51910,9 +68244,16 @@ class SourceDiskEncryptionKey(proto.Message): """ disk_encryption_key = proto.Field( - proto.MESSAGE, number=271660677, optional=True, message="CustomerEncryptionKey", + proto.MESSAGE, + number=271660677, + optional=True, + message="CustomerEncryptionKey", + ) + source_disk = proto.Field( + proto.STRING, + number=451753793, + optional=True, ) - source_disk = proto.Field(proto.STRING, number=451753793, optional=True,) class SourceInstanceParams(proto.Message): @@ -51930,7 +68271,9 @@ class SourceInstanceParams(proto.Message): """ disk_configs = proto.RepeatedField( - proto.MESSAGE, number=235580623, message="DiskInstantiationConfig", + proto.MESSAGE, + number=235580623, + message="DiskInstantiationConfig", ) @@ -52024,31 +68367,74 @@ class SourceInstanceProperties(proto.Message): This field is a member of `oneof`_ ``_tags``. """ - can_ip_forward = proto.Field(proto.BOOL, number=467731324, optional=True,) - deletion_protection = proto.Field(proto.BOOL, number=458014698, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) + can_ip_forward = proto.Field( + proto.BOOL, + number=467731324, + optional=True, + ) + deletion_protection = proto.Field( + proto.BOOL, + number=458014698, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) disks = proto.RepeatedField( - proto.MESSAGE, number=95594102, message="SavedAttachedDisk", + proto.MESSAGE, + number=95594102, + message="SavedAttachedDisk", ) guest_accelerators = proto.RepeatedField( - proto.MESSAGE, number=463595119, message="AcceleratorConfig", + proto.MESSAGE, + number=463595119, + message="AcceleratorConfig", + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=500195327, + ) + machine_type = proto.Field( + proto.STRING, + number=227711026, + optional=True, ) - labels = proto.MapField(proto.STRING, proto.STRING, number=500195327,) - machine_type = proto.Field(proto.STRING, number=227711026, optional=True,) metadata = proto.Field( - proto.MESSAGE, number=86866735, optional=True, message="Metadata", + proto.MESSAGE, + number=86866735, + optional=True, + message="Metadata", + ) + min_cpu_platform = proto.Field( + proto.STRING, + number=242912759, + optional=True, ) - min_cpu_platform = proto.Field(proto.STRING, number=242912759, optional=True,) network_interfaces = proto.RepeatedField( - proto.MESSAGE, number=52735243, message="NetworkInterface", + proto.MESSAGE, + number=52735243, + message="NetworkInterface", ) scheduling = proto.Field( - proto.MESSAGE, number=386688404, optional=True, message="Scheduling", + proto.MESSAGE, + number=386688404, + optional=True, + message="Scheduling", ) service_accounts = proto.RepeatedField( - proto.MESSAGE, number=277537328, message="ServiceAccount", + proto.MESSAGE, + number=277537328, + message="ServiceAccount", + ) + tags = proto.Field( + proto.MESSAGE, + number=3552281, + optional=True, + message="Tags", ) - tags = proto.Field(proto.MESSAGE, number=3552281, optional=True, message="Tags",) class SslCertificate(proto.Message): @@ -52160,30 +68546,77 @@ class Type(proto.Enum): SELF_MANAGED = 434437516 TYPE_UNSPECIFIED = 437714322 - certificate = proto.Field(proto.STRING, number=341787031, optional=True,) - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - expire_time = proto.Field(proto.STRING, number=440691181, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) + certificate = proto.Field( + proto.STRING, + number=341787031, + optional=True, + ) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + expire_time = proto.Field( + proto.STRING, + number=440691181, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) managed = proto.Field( proto.MESSAGE, number=298389407, optional=True, message="SslCertificateManagedSslCertificate", ) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - private_key = proto.Field(proto.STRING, number=361331107, optional=True,) - region = proto.Field(proto.STRING, number=138946292, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + private_key = proto.Field( + proto.STRING, + number=361331107, + optional=True, + ) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) self_managed = proto.Field( proto.MESSAGE, number=329284012, optional=True, message="SslCertificateSelfManagedSslCertificate", ) - subject_alternative_names = proto.RepeatedField(proto.STRING, number=528807907,) - type_ = proto.Field(proto.STRING, number=3575610, optional=True,) + subject_alternative_names = proto.RepeatedField( + proto.STRING, + number=528807907, + ) + type_ = proto.Field( + proto.STRING, + number=3575610, + optional=True, + ) class SslCertificateAggregatedList(proto.Message): @@ -52229,19 +68662,41 @@ class SslCertificateAggregatedList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.MapField( proto.STRING, proto.MESSAGE, number=100526016, message="SslCertificatesScopedList", ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - unreachables = proto.RepeatedField(proto.STRING, number=243372063,) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -52283,15 +68738,36 @@ class SslCertificateList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="SslCertificate", + proto.MESSAGE, + number=100526016, + message="SslCertificate", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -52324,9 +68800,20 @@ class Status(proto.Enum): PROVISIONING_FAILED_PERMANENTLY = 275036203 RENEWAL_FAILED = 434659076 - domain_status = proto.MapField(proto.STRING, proto.STRING, number=360305613,) - domains = proto.RepeatedField(proto.STRING, number=226935855,) - status = proto.Field(proto.STRING, number=181260274, optional=True,) + domain_status = proto.MapField( + proto.STRING, + proto.STRING, + number=360305613, + ) + domains = proto.RepeatedField( + proto.STRING, + number=226935855, + ) + status = proto.Field( + proto.STRING, + number=181260274, + optional=True, + ) class SslCertificateSelfManagedSslCertificate(proto.Message): @@ -52347,8 +68834,16 @@ class SslCertificateSelfManagedSslCertificate(proto.Message): This field is a member of `oneof`_ ``_private_key``. """ - certificate = proto.Field(proto.STRING, number=341787031, optional=True,) - private_key = proto.Field(proto.STRING, number=361331107, optional=True,) + certificate = proto.Field( + proto.STRING, + number=341787031, + optional=True, + ) + private_key = proto.Field( + proto.STRING, + number=361331107, + optional=True, + ) class SslCertificatesScopedList(proto.Message): @@ -52366,10 +68861,15 @@ class SslCertificatesScopedList(proto.Message): """ ssl_certificates = proto.RepeatedField( - proto.MESSAGE, number=366006543, message="SslCertificate", + proto.MESSAGE, + number=366006543, + message="SslCertificate", ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -52412,13 +68912,36 @@ class SslPoliciesList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) - items = proto.RepeatedField(proto.MESSAGE, number=100526016, message="SslPolicy",) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) + items = proto.RepeatedField( + proto.MESSAGE, + number=100526016, + message="SslPolicy", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -52430,7 +68953,10 @@ class SslPoliciesListAvailableFeaturesResponse(proto.Message): """ - features = proto.RepeatedField(proto.STRING, number=246211645,) + features = proto.RepeatedField( + proto.STRING, + number=246211645, + ) class SslPolicy(proto.Message): @@ -52542,18 +69068,64 @@ class Profile(proto.Enum): MODERN = 132013855 RESTRICTED = 261551195 - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - custom_features = proto.RepeatedField(proto.STRING, number=34789707,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - enabled_features = proto.RepeatedField(proto.STRING, number=469017467,) - fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - min_tls_version = proto.Field(proto.STRING, number=8155943, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - profile = proto.Field(proto.STRING, number=227445161, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - warnings = proto.RepeatedField(proto.MESSAGE, number=498091095, message="Warnings",) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + custom_features = proto.RepeatedField( + proto.STRING, + number=34789707, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + enabled_features = proto.RepeatedField( + proto.STRING, + number=469017467, + ) + fingerprint = proto.Field( + proto.STRING, + number=234678500, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + min_tls_version = proto.Field( + proto.STRING, + number=8155943, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + profile = proto.Field( + proto.STRING, + number=227445161, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + warnings = proto.RepeatedField( + proto.MESSAGE, + number=498091095, + message="Warnings", + ) class SslPolicyReference(proto.Message): @@ -52568,7 +69140,11 @@ class SslPolicyReference(proto.Message): This field is a member of `oneof`_ ``_ssl_policy``. """ - ssl_policy = proto.Field(proto.STRING, number=295190213, optional=True,) + ssl_policy = proto.Field( + proto.STRING, + number=295190213, + optional=True, + ) class StartInstanceRequest(proto.Message): @@ -52602,10 +69178,23 @@ class StartInstanceRequest(proto.Message): The name of the zone for this request. """ - instance = proto.Field(proto.STRING, number=18257045,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + instance = proto.Field( + proto.STRING, + number=18257045, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class StartWithEncryptionKeyInstanceRequest(proto.Message): @@ -52641,15 +69230,28 @@ class StartWithEncryptionKeyInstanceRequest(proto.Message): The name of the zone for this request. """ - instance = proto.Field(proto.STRING, number=18257045,) + instance = proto.Field( + proto.STRING, + number=18257045, + ) instances_start_with_encryption_key_request_resource = proto.Field( proto.MESSAGE, number=441712511, message="InstancesStartWithEncryptionKeyRequest", ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class StatefulPolicy(proto.Message): @@ -52715,7 +69317,11 @@ class AutoDelete(proto.Enum): NEVER = 74175084 ON_PERMANENT_INSTANCE_DELETION = 95727719 - auto_delete = proto.Field(proto.STRING, number=464761403, optional=True,) + auto_delete = proto.Field( + proto.STRING, + number=464761403, + optional=True, + ) class StopInstanceRequest(proto.Message): @@ -52749,10 +69355,23 @@ class StopInstanceRequest(proto.Message): The name of the zone for this request. """ - instance = proto.Field(proto.STRING, number=18257045,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + instance = proto.Field( + proto.STRING, + number=18257045, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class Subnetwork(proto.Message): @@ -53021,35 +69640,122 @@ class State(proto.Enum): DRAINING = 480455402 READY = 77848963 - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - enable_flow_logs = proto.Field(proto.BOOL, number=151544420, optional=True,) - external_ipv6_prefix = proto.Field(proto.STRING, number=139299190, optional=True,) - fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) - gateway_address = proto.Field(proto.STRING, number=459867385, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - ip_cidr_range = proto.Field(proto.STRING, number=98117322, optional=True,) - ipv6_access_type = proto.Field(proto.STRING, number=504658653, optional=True,) - ipv6_cidr_range = proto.Field(proto.STRING, number=273141258, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + enable_flow_logs = proto.Field( + proto.BOOL, + number=151544420, + optional=True, + ) + external_ipv6_prefix = proto.Field( + proto.STRING, + number=139299190, + optional=True, + ) + fingerprint = proto.Field( + proto.STRING, + number=234678500, + optional=True, + ) + gateway_address = proto.Field( + proto.STRING, + number=459867385, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + ip_cidr_range = proto.Field( + proto.STRING, + number=98117322, + optional=True, + ) + ipv6_access_type = proto.Field( + proto.STRING, + number=504658653, + optional=True, + ) + ipv6_cidr_range = proto.Field( + proto.STRING, + number=273141258, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) log_config = proto.Field( - proto.MESSAGE, number=351299741, optional=True, message="SubnetworkLogConfig", + proto.MESSAGE, + number=351299741, + optional=True, + message="SubnetworkLogConfig", + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + network = proto.Field( + proto.STRING, + number=232872494, + optional=True, + ) + private_ip_google_access = proto.Field( + proto.BOOL, + number=421491790, + optional=True, ) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - network = proto.Field(proto.STRING, number=232872494, optional=True,) - private_ip_google_access = proto.Field(proto.BOOL, number=421491790, optional=True,) private_ipv6_google_access = proto.Field( - proto.STRING, number=48277006, optional=True, + proto.STRING, + number=48277006, + optional=True, + ) + purpose = proto.Field( + proto.STRING, + number=316407070, + optional=True, + ) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) + role = proto.Field( + proto.STRING, + number=3506294, + optional=True, ) - purpose = proto.Field(proto.STRING, number=316407070, optional=True,) - region = proto.Field(proto.STRING, number=138946292, optional=True,) - role = proto.Field(proto.STRING, number=3506294, optional=True,) secondary_ip_ranges = proto.RepeatedField( - proto.MESSAGE, number=136658915, message="SubnetworkSecondaryRange", + proto.MESSAGE, + number=136658915, + message="SubnetworkSecondaryRange", + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + stack_type = proto.Field( + proto.STRING, + number=425908881, + optional=True, + ) + state = proto.Field( + proto.STRING, + number=109757585, + optional=True, ) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - stack_type = proto.Field(proto.STRING, number=425908881, optional=True,) - state = proto.Field(proto.STRING, number=109757585, optional=True,) class SubnetworkAggregatedList(proto.Message): @@ -53094,16 +69800,41 @@ class SubnetworkAggregatedList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.MapField( - proto.STRING, proto.MESSAGE, number=100526016, message="SubnetworksScopedList", + proto.STRING, + proto.MESSAGE, + number=100526016, + message="SubnetworksScopedList", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - unreachables = proto.RepeatedField(proto.STRING, number=243372063,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -53146,13 +69877,36 @@ class SubnetworkList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) - items = proto.RepeatedField(proto.MESSAGE, number=100526016, message="Subnetwork",) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) + items = proto.RepeatedField( + proto.MESSAGE, + number=100526016, + message="Subnetwork", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -53235,12 +69989,35 @@ class Metadata(proto.Enum): EXCLUDE_ALL_METADATA = 334519954 INCLUDE_ALL_METADATA = 164619908 - aggregation_interval = proto.Field(proto.STRING, number=174919042, optional=True,) - enable = proto.Field(proto.BOOL, number=311764355, optional=True,) - filter_expr = proto.Field(proto.STRING, number=183374428, optional=True,) - flow_sampling = proto.Field(proto.FLOAT, number=530150360, optional=True,) - metadata = proto.Field(proto.STRING, number=86866735, optional=True,) - metadata_fields = proto.RepeatedField(proto.STRING, number=378461641,) + aggregation_interval = proto.Field( + proto.STRING, + number=174919042, + optional=True, + ) + enable = proto.Field( + proto.BOOL, + number=311764355, + optional=True, + ) + filter_expr = proto.Field( + proto.STRING, + number=183374428, + optional=True, + ) + flow_sampling = proto.Field( + proto.FLOAT, + number=530150360, + optional=True, + ) + metadata = proto.Field( + proto.STRING, + number=86866735, + optional=True, + ) + metadata_fields = proto.RepeatedField( + proto.STRING, + number=378461641, + ) class SubnetworkSecondaryRange(proto.Message): @@ -53267,8 +70044,16 @@ class SubnetworkSecondaryRange(proto.Message): This field is a member of `oneof`_ ``_range_name``. """ - ip_cidr_range = proto.Field(proto.STRING, number=98117322, optional=True,) - range_name = proto.Field(proto.STRING, number=332216397, optional=True,) + ip_cidr_range = proto.Field( + proto.STRING, + number=98117322, + optional=True, + ) + range_name = proto.Field( + proto.STRING, + number=332216397, + optional=True, + ) class SubnetworksExpandIpCidrRangeRequest(proto.Message): @@ -53287,7 +70072,11 @@ class SubnetworksExpandIpCidrRangeRequest(proto.Message): This field is a member of `oneof`_ ``_ip_cidr_range``. """ - ip_cidr_range = proto.Field(proto.STRING, number=98117322, optional=True,) + ip_cidr_range = proto.Field( + proto.STRING, + number=98117322, + optional=True, + ) class SubnetworksScopedList(proto.Message): @@ -53305,10 +70094,15 @@ class SubnetworksScopedList(proto.Message): """ subnetworks = proto.RepeatedField( - proto.MESSAGE, number=415853125, message="Subnetwork", + proto.MESSAGE, + number=415853125, + message="Subnetwork", ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -53321,7 +70115,11 @@ class SubnetworksSetPrivateIpGoogleAccessRequest(proto.Message): This field is a member of `oneof`_ ``_private_ip_google_access``. """ - private_ip_google_access = proto.Field(proto.BOOL, number=421491790, optional=True,) + private_ip_google_access = proto.Field( + proto.BOOL, + number=421491790, + optional=True, + ) class Subsetting(proto.Message): @@ -53343,7 +70141,11 @@ class Policy(proto.Enum): CONSISTENT_HASH_SUBSETTING = 108989492 NONE = 2402104 - policy = proto.Field(proto.STRING, number=91071794, optional=True,) + policy = proto.Field( + proto.STRING, + number=91071794, + optional=True, + ) class SuspendInstanceRequest(proto.Message): @@ -53377,10 +70179,23 @@ class SuspendInstanceRequest(proto.Message): The name of the zone for this request. """ - instance = proto.Field(proto.STRING, number=18257045,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + instance = proto.Field( + proto.STRING, + number=18257045, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class SwitchToCustomModeNetworkRequest(proto.Message): @@ -53412,9 +70227,19 @@ class SwitchToCustomModeNetworkRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - network = proto.Field(proto.STRING, number=232872494,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + network = proto.Field( + proto.STRING, + number=232872494, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class TCPHealthCheck(proto.Message): @@ -53494,12 +70319,36 @@ class ProxyHeader(proto.Enum): NONE = 2402104 PROXY_V1 = 334352940 - port = proto.Field(proto.INT32, number=3446913, optional=True,) - port_name = proto.Field(proto.STRING, number=41534345, optional=True,) - port_specification = proto.Field(proto.STRING, number=51590597, optional=True,) - proxy_header = proto.Field(proto.STRING, number=160374142, optional=True,) - request = proto.Field(proto.STRING, number=21951119, optional=True,) - response = proto.Field(proto.STRING, number=196547649, optional=True,) + port = proto.Field( + proto.INT32, + number=3446913, + optional=True, + ) + port_name = proto.Field( + proto.STRING, + number=41534345, + optional=True, + ) + port_specification = proto.Field( + proto.STRING, + number=51590597, + optional=True, + ) + proxy_header = proto.Field( + proto.STRING, + number=160374142, + optional=True, + ) + request = proto.Field( + proto.STRING, + number=21951119, + optional=True, + ) + response = proto.Field( + proto.STRING, + number=196547649, + optional=True, + ) class Tags(proto.Message): @@ -53523,8 +70372,15 @@ class Tags(proto.Message): characters long, and comply with RFC1035. """ - fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) - items = proto.RepeatedField(proto.STRING, number=100526016,) + fingerprint = proto.Field( + proto.STRING, + number=234678500, + optional=True, + ) + items = proto.RepeatedField( + proto.STRING, + number=100526016, + ) class TargetGrpcProxy(proto.Message): @@ -53613,16 +70469,56 @@ class TargetGrpcProxy(proto.Message): This field is a member of `oneof`_ ``_validate_for_proxyless``. """ - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - self_link_with_id = proto.Field(proto.STRING, number=44520962, optional=True,) - url_map = proto.Field(proto.STRING, number=367020684, optional=True,) - validate_for_proxyless = proto.Field(proto.BOOL, number=101822888, optional=True,) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + fingerprint = proto.Field( + proto.STRING, + number=234678500, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + self_link_with_id = proto.Field( + proto.STRING, + number=44520962, + optional=True, + ) + url_map = proto.Field( + proto.STRING, + number=367020684, + optional=True, + ) + validate_for_proxyless = proto.Field( + proto.BOOL, + number=101822888, + optional=True, + ) class TargetGrpcProxyList(proto.Message): @@ -53664,15 +70560,36 @@ class TargetGrpcProxyList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="TargetGrpcProxy", + proto.MESSAGE, + number=100526016, + message="TargetGrpcProxy", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -53691,10 +70608,15 @@ class TargetHttpProxiesScopedList(proto.Message): """ target_http_proxies = proto.RepeatedField( - proto.MESSAGE, number=162147011, message="TargetHttpProxy", + proto.MESSAGE, + number=162147011, + message="TargetHttpProxy", ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -53785,16 +70707,56 @@ class TargetHttpProxy(proto.Message): This field is a member of `oneof`_ ``_url_map``. """ - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - proxy_bind = proto.Field(proto.BOOL, number=286025582, optional=True,) - region = proto.Field(proto.STRING, number=138946292, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - url_map = proto.Field(proto.STRING, number=367020684, optional=True,) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + fingerprint = proto.Field( + proto.STRING, + number=234678500, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + proxy_bind = proto.Field( + proto.BOOL, + number=286025582, + optional=True, + ) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + url_map = proto.Field( + proto.STRING, + number=367020684, + optional=True, + ) class TargetHttpProxyAggregatedList(proto.Message): @@ -53836,17 +70798,36 @@ class TargetHttpProxyAggregatedList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.MapField( proto.STRING, proto.MESSAGE, number=100526016, message="TargetHttpProxiesScopedList", ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - unreachables = proto.RepeatedField(proto.STRING, number=243372063,) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, + ) class TargetHttpProxyList(proto.Message): @@ -53889,15 +70870,36 @@ class TargetHttpProxyList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="TargetHttpProxy", + proto.MESSAGE, + number=100526016, + message="TargetHttpProxy", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -53916,10 +70918,15 @@ class TargetHttpsProxiesScopedList(proto.Message): """ target_https_proxies = proto.RepeatedField( - proto.MESSAGE, number=366607882, message="TargetHttpsProxy", + proto.MESSAGE, + number=366607882, + message="TargetHttpsProxy", ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -53942,7 +70949,11 @@ class QuicOverride(proto.Enum): ENABLE = 438835587 NONE = 2402104 - quic_override = proto.Field(proto.STRING, number=456577197, optional=True,) + quic_override = proto.Field( + proto.STRING, + number=456577197, + optional=True, + ) class TargetHttpsProxiesSetSslCertificatesRequest(proto.Message): @@ -53957,7 +70968,10 @@ class TargetHttpsProxiesSetSslCertificatesRequest(proto.Message): certificates. """ - ssl_certificates = proto.RepeatedField(proto.STRING, number=366006543,) + ssl_certificates = proto.RepeatedField( + proto.STRING, + number=366006543, + ) class TargetHttpsProxy(proto.Message): @@ -54123,21 +71137,80 @@ class QuicOverride(proto.Enum): ENABLE = 438835587 NONE = 2402104 - authorization_policy = proto.Field(proto.STRING, number=33945528, optional=True,) - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - proxy_bind = proto.Field(proto.BOOL, number=286025582, optional=True,) - quic_override = proto.Field(proto.STRING, number=456577197, optional=True,) - region = proto.Field(proto.STRING, number=138946292, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - server_tls_policy = proto.Field(proto.STRING, number=295825266, optional=True,) - ssl_certificates = proto.RepeatedField(proto.STRING, number=366006543,) - ssl_policy = proto.Field(proto.STRING, number=295190213, optional=True,) - url_map = proto.Field(proto.STRING, number=367020684, optional=True,) + authorization_policy = proto.Field( + proto.STRING, + number=33945528, + optional=True, + ) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + fingerprint = proto.Field( + proto.STRING, + number=234678500, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + proxy_bind = proto.Field( + proto.BOOL, + number=286025582, + optional=True, + ) + quic_override = proto.Field( + proto.STRING, + number=456577197, + optional=True, + ) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + server_tls_policy = proto.Field( + proto.STRING, + number=295825266, + optional=True, + ) + ssl_certificates = proto.RepeatedField( + proto.STRING, + number=366006543, + ) + ssl_policy = proto.Field( + proto.STRING, + number=295190213, + optional=True, + ) + url_map = proto.Field( + proto.STRING, + number=367020684, + optional=True, + ) class TargetHttpsProxyAggregatedList(proto.Message): @@ -54183,19 +71256,41 @@ class TargetHttpsProxyAggregatedList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.MapField( proto.STRING, proto.MESSAGE, number=100526016, message="TargetHttpsProxiesScopedList", ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - unreachables = proto.RepeatedField(proto.STRING, number=243372063,) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -54239,15 +71334,36 @@ class TargetHttpsProxyList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="TargetHttpsProxy", + proto.MESSAGE, + number=100526016, + message="TargetHttpsProxy", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -54336,16 +71452,56 @@ class NatPolicy(proto.Enum): UNDEFINED_NAT_POLICY = 0 NO_NAT = 161455491 - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - instance = proto.Field(proto.STRING, number=18257045, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - nat_policy = proto.Field(proto.STRING, number=509780496, optional=True,) - network = proto.Field(proto.STRING, number=232872494, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - zone = proto.Field(proto.STRING, number=3744684, optional=True,) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + instance = proto.Field( + proto.STRING, + number=18257045, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + nat_policy = proto.Field( + proto.STRING, + number=509780496, + optional=True, + ) + network = proto.Field( + proto.STRING, + number=232872494, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + optional=True, + ) class TargetInstanceAggregatedList(proto.Message): @@ -54388,19 +71544,41 @@ class TargetInstanceAggregatedList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.MapField( proto.STRING, proto.MESSAGE, number=100526016, message="TargetInstancesScopedList", ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - unreachables = proto.RepeatedField(proto.STRING, number=243372063,) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -54442,15 +71620,36 @@ class TargetInstanceList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="TargetInstance", + proto.MESSAGE, + number=100526016, + message="TargetInstance", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -54469,10 +71668,15 @@ class TargetInstancesScopedList(proto.Message): """ target_instances = proto.RepeatedField( - proto.MESSAGE, number=392915280, message="TargetInstance", + proto.MESSAGE, + number=392915280, + message="TargetInstance", ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -54602,18 +71806,64 @@ class SessionAffinity(proto.Enum): HTTP_COOKIE = 494981627 NONE = 2402104 - backup_pool = proto.Field(proto.STRING, number=45884537, optional=True,) - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - failover_ratio = proto.Field(proto.FLOAT, number=212667006, optional=True,) - health_checks = proto.RepeatedField(proto.STRING, number=448370606,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - instances = proto.RepeatedField(proto.STRING, number=29097598,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - region = proto.Field(proto.STRING, number=138946292, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - session_affinity = proto.Field(proto.STRING, number=463888561, optional=True,) + backup_pool = proto.Field( + proto.STRING, + number=45884537, + optional=True, + ) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + failover_ratio = proto.Field( + proto.FLOAT, + number=212667006, + optional=True, + ) + health_checks = proto.RepeatedField( + proto.STRING, + number=448370606, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + instances = proto.RepeatedField( + proto.STRING, + number=29097598, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + session_affinity = proto.Field( + proto.STRING, + number=463888561, + optional=True, + ) class TargetPoolAggregatedList(proto.Message): @@ -54658,16 +71908,41 @@ class TargetPoolAggregatedList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.MapField( - proto.STRING, proto.MESSAGE, number=100526016, message="TargetPoolsScopedList", + proto.STRING, + proto.MESSAGE, + number=100526016, + message="TargetPoolsScopedList", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - unreachables = proto.RepeatedField(proto.STRING, number=243372063,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -54686,9 +71961,15 @@ class TargetPoolInstanceHealth(proto.Message): """ health_status = proto.RepeatedField( - proto.MESSAGE, number=380545845, message="HealthStatus", + proto.MESSAGE, + number=380545845, + message="HealthStatus", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) class TargetPoolList(proto.Message): @@ -54730,13 +72011,36 @@ class TargetPoolList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) - items = proto.RepeatedField(proto.MESSAGE, number=100526016, message="TargetPool",) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) + items = proto.RepeatedField( + proto.MESSAGE, + number=100526016, + message="TargetPool", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -54750,7 +72054,9 @@ class TargetPoolsAddHealthCheckRequest(proto.Message): """ health_checks = proto.RepeatedField( - proto.MESSAGE, number=448370606, message="HealthCheckReference", + proto.MESSAGE, + number=448370606, + message="HealthCheckReference", ) @@ -54770,7 +72076,9 @@ class TargetPoolsAddInstanceRequest(proto.Message): """ instances = proto.RepeatedField( - proto.MESSAGE, number=29097598, message="InstanceReference", + proto.MESSAGE, + number=29097598, + message="InstanceReference", ) @@ -54789,7 +72097,9 @@ class TargetPoolsRemoveHealthCheckRequest(proto.Message): """ health_checks = proto.RepeatedField( - proto.MESSAGE, number=448370606, message="HealthCheckReference", + proto.MESSAGE, + number=448370606, + message="HealthCheckReference", ) @@ -54803,7 +72113,9 @@ class TargetPoolsRemoveInstanceRequest(proto.Message): """ instances = proto.RepeatedField( - proto.MESSAGE, number=29097598, message="InstanceReference", + proto.MESSAGE, + number=29097598, + message="InstanceReference", ) @@ -54822,10 +72134,15 @@ class TargetPoolsScopedList(proto.Message): """ target_pools = proto.RepeatedField( - proto.MESSAGE, number=336072617, message="TargetPool", + proto.MESSAGE, + number=336072617, + message="TargetPool", ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -54838,7 +72155,11 @@ class TargetReference(proto.Message): This field is a member of `oneof`_ ``_target``. """ - target = proto.Field(proto.STRING, number=192835985, optional=True,) + target = proto.Field( + proto.STRING, + number=192835985, + optional=True, + ) class TargetSslProxiesSetBackendServiceRequest(proto.Message): @@ -54852,7 +72173,11 @@ class TargetSslProxiesSetBackendServiceRequest(proto.Message): This field is a member of `oneof`_ ``_service``. """ - service = proto.Field(proto.STRING, number=373540533, optional=True,) + service = proto.Field( + proto.STRING, + number=373540533, + optional=True, + ) class TargetSslProxiesSetProxyHeaderRequest(proto.Message): @@ -54875,7 +72200,11 @@ class ProxyHeader(proto.Enum): NONE = 2402104 PROXY_V1 = 334352940 - proxy_header = proto.Field(proto.STRING, number=160374142, optional=True,) + proxy_header = proto.Field( + proto.STRING, + number=160374142, + optional=True, + ) class TargetSslProxiesSetSslCertificatesRequest(proto.Message): @@ -54890,7 +72219,10 @@ class TargetSslProxiesSetSslCertificatesRequest(proto.Message): certificates. """ - ssl_certificates = proto.RepeatedField(proto.STRING, number=366006543,) + ssl_certificates = proto.RepeatedField( + proto.STRING, + number=366006543, + ) class TargetSslProxy(proto.Message): @@ -54970,16 +72302,55 @@ class ProxyHeader(proto.Enum): NONE = 2402104 PROXY_V1 = 334352940 - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - proxy_header = proto.Field(proto.STRING, number=160374142, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - service = proto.Field(proto.STRING, number=373540533, optional=True,) - ssl_certificates = proto.RepeatedField(proto.STRING, number=366006543,) - ssl_policy = proto.Field(proto.STRING, number=295190213, optional=True,) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + proxy_header = proto.Field( + proto.STRING, + number=160374142, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + service = proto.Field( + proto.STRING, + number=373540533, + optional=True, + ) + ssl_certificates = proto.RepeatedField( + proto.STRING, + number=366006543, + ) + ssl_policy = proto.Field( + proto.STRING, + number=295190213, + optional=True, + ) class TargetSslProxyList(proto.Message): @@ -55020,15 +72391,36 @@ class TargetSslProxyList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="TargetSslProxy", + proto.MESSAGE, + number=100526016, + message="TargetSslProxy", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -55043,7 +72435,11 @@ class TargetTcpProxiesSetBackendServiceRequest(proto.Message): This field is a member of `oneof`_ ``_service``. """ - service = proto.Field(proto.STRING, number=373540533, optional=True,) + service = proto.Field( + proto.STRING, + number=373540533, + optional=True, + ) class TargetTcpProxiesSetProxyHeaderRequest(proto.Message): @@ -55066,7 +72462,11 @@ class ProxyHeader(proto.Enum): NONE = 2402104 PROXY_V1 = 334352940 - proxy_header = proto.Field(proto.STRING, number=160374142, optional=True,) + proxy_header = proto.Field( + proto.STRING, + number=160374142, + optional=True, + ) class TargetTcpProxy(proto.Message): @@ -55146,15 +72546,51 @@ class ProxyHeader(proto.Enum): NONE = 2402104 PROXY_V1 = 334352940 - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - proxy_bind = proto.Field(proto.BOOL, number=286025582, optional=True,) - proxy_header = proto.Field(proto.STRING, number=160374142, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - service = proto.Field(proto.STRING, number=373540533, optional=True,) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + proxy_bind = proto.Field( + proto.BOOL, + number=286025582, + optional=True, + ) + proxy_header = proto.Field( + proto.STRING, + number=160374142, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + service = proto.Field( + proto.STRING, + number=373540533, + optional=True, + ) class TargetTcpProxyList(proto.Message): @@ -55195,15 +72631,36 @@ class TargetTcpProxyList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="TargetTcpProxy", + proto.MESSAGE, + number=100526016, + message="TargetTcpProxy", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -55288,17 +72745,59 @@ class Status(proto.Enum): FAILED = 455706685 READY = 77848963 - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - forwarding_rules = proto.RepeatedField(proto.STRING, number=315821365,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - network = proto.Field(proto.STRING, number=232872494, optional=True,) - region = proto.Field(proto.STRING, number=138946292, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - status = proto.Field(proto.STRING, number=181260274, optional=True,) - tunnels = proto.RepeatedField(proto.STRING, number=104561931,) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + forwarding_rules = proto.RepeatedField( + proto.STRING, + number=315821365, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + network = proto.Field( + proto.STRING, + number=232872494, + optional=True, + ) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + status = proto.Field( + proto.STRING, + number=181260274, + optional=True, + ) + tunnels = proto.RepeatedField( + proto.STRING, + number=104561931, + ) class TargetVpnGatewayAggregatedList(proto.Message): @@ -55342,19 +72841,41 @@ class TargetVpnGatewayAggregatedList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.MapField( proto.STRING, proto.MESSAGE, number=100526016, message="TargetVpnGatewaysScopedList", ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - unreachables = proto.RepeatedField(proto.STRING, number=243372063,) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -55397,15 +72918,36 @@ class TargetVpnGatewayList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="TargetVpnGateway", + proto.MESSAGE, + number=100526016, + message="TargetVpnGateway", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -55424,10 +72966,15 @@ class TargetVpnGatewaysScopedList(proto.Message): """ target_vpn_gateways = proto.RepeatedField( - proto.MESSAGE, number=401770888, message="TargetVpnGateway", + proto.MESSAGE, + number=401770888, + message="TargetVpnGateway", ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -55480,21 +73027,51 @@ class TestFailure(proto.Message): This field is a member of `oneof`_ ``_path``. """ - actual_output_url = proto.Field(proto.STRING, number=287075458, optional=True,) + actual_output_url = proto.Field( + proto.STRING, + number=287075458, + optional=True, + ) actual_redirect_response_code = proto.Field( - proto.INT32, number=42926553, optional=True, + proto.INT32, + number=42926553, + optional=True, + ) + actual_service = proto.Field( + proto.STRING, + number=440379652, + optional=True, + ) + expected_output_url = proto.Field( + proto.STRING, + number=433967384, + optional=True, ) - actual_service = proto.Field(proto.STRING, number=440379652, optional=True,) - expected_output_url = proto.Field(proto.STRING, number=433967384, optional=True,) expected_redirect_response_code = proto.Field( - proto.INT32, number=18888047, optional=True, + proto.INT32, + number=18888047, + optional=True, + ) + expected_service = proto.Field( + proto.STRING, + number=133987374, + optional=True, ) - expected_service = proto.Field(proto.STRING, number=133987374, optional=True,) headers = proto.RepeatedField( - proto.MESSAGE, number=258436998, message="UrlMapTestHeader", + proto.MESSAGE, + number=258436998, + message="UrlMapTestHeader", + ) + host = proto.Field( + proto.STRING, + number=3208616, + optional=True, + ) + path = proto.Field( + proto.STRING, + number=3433509, + optional=True, ) - host = proto.Field(proto.STRING, number=3208616, optional=True,) - path = proto.Field(proto.STRING, number=3433509, optional=True,) class TestIamPermissionsDiskRequest(proto.Message): @@ -55512,12 +73089,23 @@ class TestIamPermissionsDiskRequest(proto.Message): The name of the zone for this request. """ - project = proto.Field(proto.STRING, number=227560217,) - resource = proto.Field(proto.STRING, number=195806222,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, + ) test_permissions_request_resource = proto.Field( - proto.MESSAGE, number=439214758, message="TestPermissionsRequest", + proto.MESSAGE, + number=439214758, + message="TestPermissionsRequest", + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - zone = proto.Field(proto.STRING, number=3744684,) class TestIamPermissionsExternalVpnGatewayRequest(proto.Message): @@ -55533,10 +73121,18 @@ class TestIamPermissionsExternalVpnGatewayRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - resource = proto.Field(proto.STRING, number=195806222,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, + ) test_permissions_request_resource = proto.Field( - proto.MESSAGE, number=439214758, message="TestPermissionsRequest", + proto.MESSAGE, + number=439214758, + message="TestPermissionsRequest", ) @@ -55551,9 +73147,14 @@ class TestIamPermissionsFirewallPolicyRequest(proto.Message): The body resource for this request """ - resource = proto.Field(proto.STRING, number=195806222,) + resource = proto.Field( + proto.STRING, + number=195806222, + ) test_permissions_request_resource = proto.Field( - proto.MESSAGE, number=439214758, message="TestPermissionsRequest", + proto.MESSAGE, + number=439214758, + message="TestPermissionsRequest", ) @@ -55570,10 +73171,18 @@ class TestIamPermissionsImageRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - resource = proto.Field(proto.STRING, number=195806222,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, + ) test_permissions_request_resource = proto.Field( - proto.MESSAGE, number=439214758, message="TestPermissionsRequest", + proto.MESSAGE, + number=439214758, + message="TestPermissionsRequest", ) @@ -55592,12 +73201,23 @@ class TestIamPermissionsInstanceRequest(proto.Message): The name of the zone for this request. """ - project = proto.Field(proto.STRING, number=227560217,) - resource = proto.Field(proto.STRING, number=195806222,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, + ) test_permissions_request_resource = proto.Field( - proto.MESSAGE, number=439214758, message="TestPermissionsRequest", + proto.MESSAGE, + number=439214758, + message="TestPermissionsRequest", + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - zone = proto.Field(proto.STRING, number=3744684,) class TestIamPermissionsInstanceTemplateRequest(proto.Message): @@ -55613,10 +73233,18 @@ class TestIamPermissionsInstanceTemplateRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - resource = proto.Field(proto.STRING, number=195806222,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, + ) test_permissions_request_resource = proto.Field( - proto.MESSAGE, number=439214758, message="TestPermissionsRequest", + proto.MESSAGE, + number=439214758, + message="TestPermissionsRequest", ) @@ -55633,10 +73261,18 @@ class TestIamPermissionsLicenseCodeRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - resource = proto.Field(proto.STRING, number=195806222,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, + ) test_permissions_request_resource = proto.Field( - proto.MESSAGE, number=439214758, message="TestPermissionsRequest", + proto.MESSAGE, + number=439214758, + message="TestPermissionsRequest", ) @@ -55653,10 +73289,18 @@ class TestIamPermissionsLicenseRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - resource = proto.Field(proto.STRING, number=195806222,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, + ) test_permissions_request_resource = proto.Field( - proto.MESSAGE, number=439214758, message="TestPermissionsRequest", + proto.MESSAGE, + number=439214758, + message="TestPermissionsRequest", ) @@ -55673,10 +73317,18 @@ class TestIamPermissionsMachineImageRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - resource = proto.Field(proto.STRING, number=195806222,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, + ) test_permissions_request_resource = proto.Field( - proto.MESSAGE, number=439214758, message="TestPermissionsRequest", + proto.MESSAGE, + number=439214758, + message="TestPermissionsRequest", ) @@ -55696,12 +73348,23 @@ class TestIamPermissionsNetworkEndpointGroupRequest(proto.Message): The name of the zone for this request. """ - project = proto.Field(proto.STRING, number=227560217,) - resource = proto.Field(proto.STRING, number=195806222,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, + ) test_permissions_request_resource = proto.Field( - proto.MESSAGE, number=439214758, message="TestPermissionsRequest", + proto.MESSAGE, + number=439214758, + message="TestPermissionsRequest", + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - zone = proto.Field(proto.STRING, number=3744684,) class TestIamPermissionsNodeGroupRequest(proto.Message): @@ -55719,12 +73382,23 @@ class TestIamPermissionsNodeGroupRequest(proto.Message): The name of the zone for this request. """ - project = proto.Field(proto.STRING, number=227560217,) - resource = proto.Field(proto.STRING, number=195806222,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, + ) test_permissions_request_resource = proto.Field( - proto.MESSAGE, number=439214758, message="TestPermissionsRequest", + proto.MESSAGE, + number=439214758, + message="TestPermissionsRequest", + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - zone = proto.Field(proto.STRING, number=3744684,) class TestIamPermissionsNodeTemplateRequest(proto.Message): @@ -55742,11 +73416,22 @@ class TestIamPermissionsNodeTemplateRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - resource = proto.Field(proto.STRING, number=195806222,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + resource = proto.Field( + proto.STRING, + number=195806222, + ) test_permissions_request_resource = proto.Field( - proto.MESSAGE, number=439214758, message="TestPermissionsRequest", + proto.MESSAGE, + number=439214758, + message="TestPermissionsRequest", ) @@ -55765,11 +73450,22 @@ class TestIamPermissionsPacketMirroringRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - resource = proto.Field(proto.STRING, number=195806222,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + resource = proto.Field( + proto.STRING, + number=195806222, + ) test_permissions_request_resource = proto.Field( - proto.MESSAGE, number=439214758, message="TestPermissionsRequest", + proto.MESSAGE, + number=439214758, + message="TestPermissionsRequest", ) @@ -55788,11 +73484,22 @@ class TestIamPermissionsRegionDiskRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - resource = proto.Field(proto.STRING, number=195806222,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + resource = proto.Field( + proto.STRING, + number=195806222, + ) test_permissions_request_resource = proto.Field( - proto.MESSAGE, number=439214758, message="TestPermissionsRequest", + proto.MESSAGE, + number=439214758, + message="TestPermissionsRequest", ) @@ -55811,12 +73518,23 @@ class TestIamPermissionsReservationRequest(proto.Message): The name of the zone for this request. """ - project = proto.Field(proto.STRING, number=227560217,) - resource = proto.Field(proto.STRING, number=195806222,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, + ) test_permissions_request_resource = proto.Field( - proto.MESSAGE, number=439214758, message="TestPermissionsRequest", + proto.MESSAGE, + number=439214758, + message="TestPermissionsRequest", + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - zone = proto.Field(proto.STRING, number=3744684,) class TestIamPermissionsResourcePolicyRequest(proto.Message): @@ -55834,11 +73552,22 @@ class TestIamPermissionsResourcePolicyRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - resource = proto.Field(proto.STRING, number=195806222,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + resource = proto.Field( + proto.STRING, + number=195806222, + ) test_permissions_request_resource = proto.Field( - proto.MESSAGE, number=439214758, message="TestPermissionsRequest", + proto.MESSAGE, + number=439214758, + message="TestPermissionsRequest", ) @@ -55857,11 +73586,22 @@ class TestIamPermissionsServiceAttachmentRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - resource = proto.Field(proto.STRING, number=195806222,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + resource = proto.Field( + proto.STRING, + number=195806222, + ) test_permissions_request_resource = proto.Field( - proto.MESSAGE, number=439214758, message="TestPermissionsRequest", + proto.MESSAGE, + number=439214758, + message="TestPermissionsRequest", ) @@ -55878,10 +73618,18 @@ class TestIamPermissionsSnapshotRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - resource = proto.Field(proto.STRING, number=195806222,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, + ) test_permissions_request_resource = proto.Field( - proto.MESSAGE, number=439214758, message="TestPermissionsRequest", + proto.MESSAGE, + number=439214758, + message="TestPermissionsRequest", ) @@ -55900,11 +73648,22 @@ class TestIamPermissionsSubnetworkRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - resource = proto.Field(proto.STRING, number=195806222,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + resource = proto.Field( + proto.STRING, + number=195806222, + ) test_permissions_request_resource = proto.Field( - proto.MESSAGE, number=439214758, message="TestPermissionsRequest", + proto.MESSAGE, + number=439214758, + message="TestPermissionsRequest", ) @@ -55923,11 +73682,22 @@ class TestIamPermissionsVpnGatewayRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - resource = proto.Field(proto.STRING, number=195806222,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + resource = proto.Field( + proto.STRING, + number=195806222, + ) test_permissions_request_resource = proto.Field( - proto.MESSAGE, number=439214758, message="TestPermissionsRequest", + proto.MESSAGE, + number=439214758, + message="TestPermissionsRequest", ) @@ -55941,7 +73711,10 @@ class TestPermissionsRequest(proto.Message): not allowed. """ - permissions = proto.RepeatedField(proto.STRING, number=59962500,) + permissions = proto.RepeatedField( + proto.STRING, + number=59962500, + ) class TestPermissionsResponse(proto.Message): @@ -55953,7 +73726,10 @@ class TestPermissionsResponse(proto.Message): caller is allowed. """ - permissions = proto.RepeatedField(proto.STRING, number=59962500,) + permissions = proto.RepeatedField( + proto.STRING, + number=59962500, + ) class Uint128(proto.Message): @@ -55968,8 +73744,16 @@ class Uint128(proto.Message): This field is a member of `oneof`_ ``_low``. """ - high = proto.Field(proto.UINT64, number=3202466, optional=True,) - low = proto.Field(proto.UINT64, number=107348, optional=True,) + high = proto.Field( + proto.UINT64, + number=3202466, + optional=True, + ) + low = proto.Field( + proto.UINT64, + number=107348, + optional=True, + ) class UpdateAccessConfigInstanceRequest(proto.Message): @@ -56009,13 +73793,31 @@ class UpdateAccessConfigInstanceRequest(proto.Message): """ access_config_resource = proto.Field( - proto.MESSAGE, number=387825552, message="AccessConfig", + proto.MESSAGE, + number=387825552, + message="AccessConfig", + ) + instance = proto.Field( + proto.STRING, + number=18257045, + ) + network_interface = proto.Field( + proto.STRING, + number=365387880, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - instance = proto.Field(proto.STRING, number=18257045,) - network_interface = proto.Field(proto.STRING, number=365387880,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) class UpdateAutoscalerRequest(proto.Message): @@ -56053,13 +73855,29 @@ class UpdateAutoscalerRequest(proto.Message): Name of the zone for this request. """ - autoscaler = proto.Field(proto.STRING, number=517258967, optional=True,) + autoscaler = proto.Field( + proto.STRING, + number=517258967, + optional=True, + ) autoscaler_resource = proto.Field( - proto.MESSAGE, number=207616118, message="Autoscaler", + proto.MESSAGE, + number=207616118, + message="Autoscaler", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) class UpdateBackendBucketRequest(proto.Message): @@ -56093,131 +73911,184 @@ class UpdateBackendBucketRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - backend_bucket = proto.Field(proto.STRING, number=91714037,) - backend_bucket_resource = proto.Field( - proto.MESSAGE, number=380757784, message="BackendBucket", + backend_bucket = proto.Field( + proto.STRING, + number=91714037, + ) + backend_bucket_resource = proto.Field( + proto.MESSAGE, + number=380757784, + message="BackendBucket", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + + +class UpdateBackendServiceRequest(proto.Message): + r"""A request message for BackendServices.Update. See the method + description for details. + + Attributes: + backend_service (str): + Name of the BackendService resource to + update. + backend_service_resource (google.cloud.compute_v1.types.BackendService): + The body resource for this request + project (str): + Project ID for this request. + request_id (str): + An optional request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. For example, consider a situation + where you make an initial request and the + request times out. If you make the request again + with the same request ID, the server can check + if original operation with the same request ID + was received, and if so, will ignore the second + request. This prevents clients from accidentally + creating duplicate commitments. The request ID + must be a valid UUID with the exception that + zero UUID is not supported ( + 00000000-0000-0000-0000-000000000000). + + This field is a member of `oneof`_ ``_request_id``. + """ + + backend_service = proto.Field( + proto.STRING, + number=306946058, + ) + backend_service_resource = proto.Field( + proto.MESSAGE, + number=347586723, + message="BackendService", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + + +class UpdateDisplayDeviceInstanceRequest(proto.Message): + r"""A request message for Instances.UpdateDisplayDevice. See the + method description for details. + + Attributes: + display_device_resource (google.cloud.compute_v1.types.DisplayDevice): + The body resource for this request + instance (str): + Name of the instance scoping this request. + project (str): + Project ID for this request. + request_id (str): + An optional request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. For example, consider a situation + where you make an initial request and the + request times out. If you make the request again + with the same request ID, the server can check + if original operation with the same request ID + was received, and if so, will ignore the second + request. This prevents clients from accidentally + creating duplicate commitments. The request ID + must be a valid UUID with the exception that + zero UUID is not supported ( + 00000000-0000-0000-0000-000000000000). + + This field is a member of `oneof`_ ``_request_id``. + zone (str): + The name of the zone for this request. + """ + + display_device_resource = proto.Field( + proto.MESSAGE, + number=289686106, + message="DisplayDevice", + ) + instance = proto.Field( + proto.STRING, + number=18257045, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) + + +class UpdateFirewallRequest(proto.Message): + r"""A request message for Firewalls.Update. See the method + description for details. + + Attributes: + firewall (str): + Name of the firewall rule to update. + firewall_resource (google.cloud.compute_v1.types.Firewall): + The body resource for this request + project (str): + Project ID for this request. + request_id (str): + An optional request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. For example, consider a situation + where you make an initial request and the + request times out. If you make the request again + with the same request ID, the server can check + if original operation with the same request ID + was received, and if so, will ignore the second + request. This prevents clients from accidentally + creating duplicate commitments. The request ID + must be a valid UUID with the exception that + zero UUID is not supported ( + 00000000-0000-0000-0000-000000000000). + + This field is a member of `oneof`_ ``_request_id``. + """ + + firewall = proto.Field( + proto.STRING, + number=511016192, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - - -class UpdateBackendServiceRequest(proto.Message): - r"""A request message for BackendServices.Update. See the method - description for details. - - Attributes: - backend_service (str): - Name of the BackendService resource to - update. - backend_service_resource (google.cloud.compute_v1.types.BackendService): - The body resource for this request - project (str): - Project ID for this request. - request_id (str): - An optional request ID to identify requests. - Specify a unique request ID so that if you must - retry your request, the server will know to - ignore the request if it has already been - completed. For example, consider a situation - where you make an initial request and the - request times out. If you make the request again - with the same request ID, the server can check - if original operation with the same request ID - was received, and if so, will ignore the second - request. This prevents clients from accidentally - creating duplicate commitments. The request ID - must be a valid UUID with the exception that - zero UUID is not supported ( - 00000000-0000-0000-0000-000000000000). - - This field is a member of `oneof`_ ``_request_id``. - """ - - backend_service = proto.Field(proto.STRING, number=306946058,) - backend_service_resource = proto.Field( - proto.MESSAGE, number=347586723, message="BackendService", + firewall_resource = proto.Field( + proto.MESSAGE, + number=41425005, + message="Firewall", ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - - -class UpdateDisplayDeviceInstanceRequest(proto.Message): - r"""A request message for Instances.UpdateDisplayDevice. See the - method description for details. - - Attributes: - display_device_resource (google.cloud.compute_v1.types.DisplayDevice): - The body resource for this request - instance (str): - Name of the instance scoping this request. - project (str): - Project ID for this request. - request_id (str): - An optional request ID to identify requests. - Specify a unique request ID so that if you must - retry your request, the server will know to - ignore the request if it has already been - completed. For example, consider a situation - where you make an initial request and the - request times out. If you make the request again - with the same request ID, the server can check - if original operation with the same request ID - was received, and if so, will ignore the second - request. This prevents clients from accidentally - creating duplicate commitments. The request ID - must be a valid UUID with the exception that - zero UUID is not supported ( - 00000000-0000-0000-0000-000000000000). - - This field is a member of `oneof`_ ``_request_id``. - zone (str): - The name of the zone for this request. - """ - - display_device_resource = proto.Field( - proto.MESSAGE, number=289686106, message="DisplayDevice", + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - instance = proto.Field(proto.STRING, number=18257045,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) - - -class UpdateFirewallRequest(proto.Message): - r"""A request message for Firewalls.Update. See the method - description for details. - - Attributes: - firewall (str): - Name of the firewall rule to update. - firewall_resource (google.cloud.compute_v1.types.Firewall): - The body resource for this request - project (str): - Project ID for this request. - request_id (str): - An optional request ID to identify requests. - Specify a unique request ID so that if you must - retry your request, the server will know to - ignore the request if it has already been - completed. For example, consider a situation - where you make an initial request and the - request times out. If you make the request again - with the same request ID, the server can check - if original operation with the same request ID - was received, and if so, will ignore the second - request. This prevents clients from accidentally - creating duplicate commitments. The request ID - must be a valid UUID with the exception that - zero UUID is not supported ( - 00000000-0000-0000-0000-000000000000). - - This field is a member of `oneof`_ ``_request_id``. - """ - - firewall = proto.Field(proto.STRING, number=511016192,) - firewall_resource = proto.Field(proto.MESSAGE, number=41425005, message="Firewall",) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class UpdateHealthCheckRequest(proto.Message): @@ -56251,12 +74122,24 @@ class UpdateHealthCheckRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - health_check = proto.Field(proto.STRING, number=308876645,) + health_check = proto.Field( + proto.STRING, + number=308876645, + ) health_check_resource = proto.Field( - proto.MESSAGE, number=201925032, message="HealthCheck", + proto.MESSAGE, + number=201925032, + message="HealthCheck", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class UpdateInstanceRequest(proto.Message): @@ -56309,17 +74192,38 @@ class UpdateInstanceRequest(proto.Message): The name of the zone for this request. """ - instance = proto.Field(proto.STRING, number=18257045,) + instance = proto.Field( + proto.STRING, + number=18257045, + ) instance_resource = proto.Field( - proto.MESSAGE, number=215988344, message="Instance", + proto.MESSAGE, + number=215988344, + message="Instance", + ) + minimal_action = proto.Field( + proto.STRING, + number=270567060, + optional=True, ) - minimal_action = proto.Field(proto.STRING, number=270567060, optional=True,) most_disruptive_allowed_action = proto.Field( - proto.STRING, number=66103053, optional=True, + proto.STRING, + number=66103053, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) class UpdateNetworkInterfaceInstanceRequest(proto.Message): @@ -56357,14 +74261,32 @@ class UpdateNetworkInterfaceInstanceRequest(proto.Message): The name of the zone for this request. """ - instance = proto.Field(proto.STRING, number=18257045,) - network_interface = proto.Field(proto.STRING, number=365387880,) + instance = proto.Field( + proto.STRING, + number=18257045, + ) + network_interface = proto.Field( + proto.STRING, + number=365387880, + ) network_interface_resource = proto.Field( - proto.MESSAGE, number=325814789, message="NetworkInterface", + proto.MESSAGE, + number=325814789, + message="NetworkInterface", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) class UpdatePeeringNetworkRequest(proto.Message): @@ -56399,12 +74321,24 @@ class UpdatePeeringNetworkRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - network = proto.Field(proto.STRING, number=232872494,) + network = proto.Field( + proto.STRING, + number=232872494, + ) networks_update_peering_request_resource = proto.Field( - proto.MESSAGE, number=224433497, message="NetworksUpdatePeeringRequest", + proto.MESSAGE, + number=224433497, + message="NetworksUpdatePeeringRequest", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class UpdatePerInstanceConfigsInstanceGroupManagerRequest(proto.Message): @@ -56444,15 +74378,28 @@ class UpdatePerInstanceConfigsInstanceGroupManagerRequest(proto.Message): RFC1035. """ - instance_group_manager = proto.Field(proto.STRING, number=249363395,) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) instance_group_managers_update_per_instance_configs_req_resource = proto.Field( proto.MESSAGE, number=141402302, message="InstanceGroupManagersUpdatePerInstanceConfigsReq", ) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class UpdatePerInstanceConfigsRegionInstanceGroupManagerRequest(proto.Message): @@ -56491,15 +74438,28 @@ class UpdatePerInstanceConfigsRegionInstanceGroupManagerRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - instance_group_manager = proto.Field(proto.STRING, number=249363395,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) region_instance_group_manager_update_instance_config_req_resource = proto.Field( proto.MESSAGE, number=89036583, message="RegionInstanceGroupManagerUpdateInstanceConfigReq", ) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) class UpdateRegionAutoscalerRequest(proto.Message): @@ -56537,13 +74497,29 @@ class UpdateRegionAutoscalerRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - autoscaler = proto.Field(proto.STRING, number=517258967, optional=True,) + autoscaler = proto.Field( + proto.STRING, + number=517258967, + optional=True, + ) autoscaler_resource = proto.Field( - proto.MESSAGE, number=207616118, message="Autoscaler", + proto.MESSAGE, + number=207616118, + message="Autoscaler", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class UpdateRegionBackendServiceRequest(proto.Message): @@ -56580,13 +74556,28 @@ class UpdateRegionBackendServiceRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - backend_service = proto.Field(proto.STRING, number=306946058,) + backend_service = proto.Field( + proto.STRING, + number=306946058, + ) backend_service_resource = proto.Field( - proto.MESSAGE, number=347586723, message="BackendService", + proto.MESSAGE, + number=347586723, + message="BackendService", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class UpdateRegionCommitmentRequest(proto.Message): @@ -56631,15 +74622,38 @@ class UpdateRegionCommitmentRequest(proto.Message): This field is a member of `oneof`_ ``_update_mask``. """ - commitment = proto.Field(proto.STRING, number=482134805,) + commitment = proto.Field( + proto.STRING, + number=482134805, + ) commitment_resource = proto.Field( - proto.MESSAGE, number=244240888, message="Commitment", + proto.MESSAGE, + number=244240888, + message="Commitment", + ) + paths = proto.Field( + proto.STRING, + number=106438894, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + update_mask = proto.Field( + proto.STRING, + number=500079778, + optional=True, ) - paths = proto.Field(proto.STRING, number=106438894, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - update_mask = proto.Field(proto.STRING, number=500079778, optional=True,) class UpdateRegionHealthCheckRequest(proto.Message): @@ -56675,13 +74689,28 @@ class UpdateRegionHealthCheckRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - health_check = proto.Field(proto.STRING, number=308876645,) + health_check = proto.Field( + proto.STRING, + number=308876645, + ) health_check_resource = proto.Field( - proto.MESSAGE, number=201925032, message="HealthCheck", + proto.MESSAGE, + number=201925032, + message="HealthCheck", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) class UpdateRegionUrlMapRequest(proto.Message): @@ -56704,11 +74733,28 @@ class UpdateRegionUrlMapRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - url_map = proto.Field(proto.STRING, number=367020684,) - url_map_resource = proto.Field(proto.MESSAGE, number=168675425, message="UrlMap",) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + url_map = proto.Field( + proto.STRING, + number=367020684, + ) + url_map_resource = proto.Field( + proto.MESSAGE, + number=168675425, + message="UrlMap", + ) class UpdateReservationRequest(proto.Message): @@ -56752,15 +74798,38 @@ class UpdateReservationRequest(proto.Message): Name of the zone for this request. """ - paths = proto.Field(proto.STRING, number=106438894, optional=True,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - reservation = proto.Field(proto.STRING, number=47530956,) + paths = proto.Field( + proto.STRING, + number=106438894, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + reservation = proto.Field( + proto.STRING, + number=47530956, + ) reservation_resource = proto.Field( - proto.MESSAGE, number=285030177, message="Reservation", + proto.MESSAGE, + number=285030177, + message="Reservation", + ) + update_mask = proto.Field( + proto.STRING, + number=500079778, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - update_mask = proto.Field(proto.STRING, number=500079778, optional=True,) - zone = proto.Field(proto.STRING, number=3744684,) class UpdateRouterRequest(proto.Message): @@ -56796,11 +74865,28 @@ class UpdateRouterRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - router = proto.Field(proto.STRING, number=148608841,) - router_resource = proto.Field(proto.MESSAGE, number=155222084, message="Router",) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + router = proto.Field( + proto.STRING, + number=148608841, + ) + router_resource = proto.Field( + proto.MESSAGE, + number=155222084, + message="Router", + ) class UpdateShieldedInstanceConfigInstanceRequest(proto.Message): @@ -56837,13 +74923,28 @@ class UpdateShieldedInstanceConfigInstanceRequest(proto.Message): The name of the zone for this request. """ - instance = proto.Field(proto.STRING, number=18257045,) - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) + instance = proto.Field( + proto.STRING, + number=18257045, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) shielded_instance_config_resource = proto.Field( - proto.MESSAGE, number=272059224, message="ShieldedInstanceConfig", + proto.MESSAGE, + number=272059224, + message="ShieldedInstanceConfig", + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) - zone = proto.Field(proto.STRING, number=3744684,) class UpdateUrlMapRequest(proto.Message): @@ -56877,10 +74978,24 @@ class UpdateUrlMapRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - request_id = proto.Field(proto.STRING, number=37109963, optional=True,) - url_map = proto.Field(proto.STRING, number=367020684,) - url_map_resource = proto.Field(proto.MESSAGE, number=168675425, message="UrlMap",) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + url_map = proto.Field( + proto.STRING, + number=367020684, + ) + url_map_resource = proto.Field( + proto.MESSAGE, + number=168675425, + message="UrlMap", + ) class UrlMap(proto.Message): @@ -57033,31 +75148,84 @@ class UrlMap(proto.Message): validateForProxyless field set to true. """ - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) default_route_action = proto.Field( - proto.MESSAGE, number=378919466, optional=True, message="HttpRouteAction", + proto.MESSAGE, + number=378919466, + optional=True, + message="HttpRouteAction", + ) + default_service = proto.Field( + proto.STRING, + number=370242231, + optional=True, ) - default_service = proto.Field(proto.STRING, number=370242231, optional=True,) default_url_redirect = proto.Field( - proto.MESSAGE, number=359503338, optional=True, message="HttpRedirectAction", + proto.MESSAGE, + number=359503338, + optional=True, + message="HttpRedirectAction", + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + fingerprint = proto.Field( + proto.STRING, + number=234678500, + optional=True, ) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) header_action = proto.Field( - proto.MESSAGE, number=328077352, optional=True, message="HttpHeaderAction", + proto.MESSAGE, + number=328077352, + optional=True, + message="HttpHeaderAction", ) host_rules = proto.RepeatedField( - proto.MESSAGE, number=311804832, message="HostRule", + proto.MESSAGE, + number=311804832, + message="HostRule", + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, ) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) path_matchers = proto.RepeatedField( - proto.MESSAGE, number=271664219, message="PathMatcher", + proto.MESSAGE, + number=271664219, + message="PathMatcher", + ) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + tests = proto.RepeatedField( + proto.MESSAGE, + number=110251553, + message="UrlMapTest", ) - region = proto.Field(proto.STRING, number=138946292, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - tests = proto.RepeatedField(proto.MESSAGE, number=110251553, message="UrlMapTest",) class UrlMapList(proto.Message): @@ -57098,13 +75266,36 @@ class UrlMapList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) - items = proto.RepeatedField(proto.MESSAGE, number=100526016, message="UrlMap",) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) + items = proto.RepeatedField( + proto.MESSAGE, + number=100526016, + message="UrlMap", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -57117,7 +75308,11 @@ class UrlMapReference(proto.Message): This field is a member of `oneof`_ ``_url_map``. """ - url_map = proto.Field(proto.STRING, number=367020684, optional=True,) + url_map = proto.Field( + proto.STRING, + number=367020684, + optional=True, + ) class UrlMapTest(proto.Message): @@ -57178,17 +75373,41 @@ class UrlMapTest(proto.Message): This field is a member of `oneof`_ ``_service``. """ - description = proto.Field(proto.STRING, number=422937596, optional=True,) - expected_output_url = proto.Field(proto.STRING, number=433967384, optional=True,) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + expected_output_url = proto.Field( + proto.STRING, + number=433967384, + optional=True, + ) expected_redirect_response_code = proto.Field( - proto.INT32, number=18888047, optional=True, + proto.INT32, + number=18888047, + optional=True, ) headers = proto.RepeatedField( - proto.MESSAGE, number=258436998, message="UrlMapTestHeader", + proto.MESSAGE, + number=258436998, + message="UrlMapTestHeader", + ) + host = proto.Field( + proto.STRING, + number=3208616, + optional=True, + ) + path = proto.Field( + proto.STRING, + number=3433509, + optional=True, + ) + service = proto.Field( + proto.STRING, + number=373540533, + optional=True, ) - host = proto.Field(proto.STRING, number=3208616, optional=True,) - path = proto.Field(proto.STRING, number=3433509, optional=True,) - service = proto.Field(proto.STRING, number=373540533, optional=True,) class UrlMapTestHeader(proto.Message): @@ -57205,8 +75424,16 @@ class UrlMapTestHeader(proto.Message): This field is a member of `oneof`_ ``_value``. """ - name = proto.Field(proto.STRING, number=3373707, optional=True,) - value = proto.Field(proto.STRING, number=111972721, optional=True,) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + value = proto.Field( + proto.STRING, + number=111972721, + optional=True, + ) class UrlMapValidationResult(proto.Message): @@ -57231,12 +75458,25 @@ class UrlMapValidationResult(proto.Message): This field is a member of `oneof`_ ``_test_passed``. """ - load_errors = proto.RepeatedField(proto.STRING, number=310147300,) - load_succeeded = proto.Field(proto.BOOL, number=128326216, optional=True,) + load_errors = proto.RepeatedField( + proto.STRING, + number=310147300, + ) + load_succeeded = proto.Field( + proto.BOOL, + number=128326216, + optional=True, + ) test_failures = proto.RepeatedField( - proto.MESSAGE, number=505934134, message="TestFailure", + proto.MESSAGE, + number=505934134, + message="TestFailure", + ) + test_passed = proto.Field( + proto.BOOL, + number=192708797, + optional=True, ) - test_passed = proto.Field(proto.BOOL, number=192708797, optional=True,) class UrlMapsAggregatedList(proto.Message): @@ -57279,16 +75519,41 @@ class UrlMapsAggregatedList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.MapField( - proto.STRING, proto.MESSAGE, number=100526016, message="UrlMapsScopedList", + proto.STRING, + proto.MESSAGE, + number=100526016, + message="UrlMapsScopedList", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - unreachables = proto.RepeatedField(proto.STRING, number=243372063,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -57305,9 +75570,16 @@ class UrlMapsScopedList(proto.Message): This field is a member of `oneof`_ ``_warning``. """ - url_maps = proto.RepeatedField(proto.MESSAGE, number=103352167, message="UrlMap",) + url_maps = proto.RepeatedField( + proto.MESSAGE, + number=103352167, + message="UrlMap", + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -57322,7 +75594,10 @@ class UrlMapsValidateRequest(proto.Message): """ resource = proto.Field( - proto.MESSAGE, number=195806222, optional=True, message="UrlMap", + proto.MESSAGE, + number=195806222, + optional=True, + message="UrlMap", ) @@ -57364,8 +75639,16 @@ class UrlRewrite(proto.Message): This field is a member of `oneof`_ ``_path_prefix_rewrite``. """ - host_rewrite = proto.Field(proto.STRING, number=159819253, optional=True,) - path_prefix_rewrite = proto.Field(proto.STRING, number=41186361, optional=True,) + host_rewrite = proto.Field( + proto.STRING, + number=159819253, + optional=True, + ) + path_prefix_rewrite = proto.Field( + proto.STRING, + number=41186361, + optional=True, + ) class UsableSubnetwork(proto.Message): @@ -57390,12 +75673,26 @@ class UsableSubnetwork(proto.Message): This field is a member of `oneof`_ ``_subnetwork``. """ - ip_cidr_range = proto.Field(proto.STRING, number=98117322, optional=True,) - network = proto.Field(proto.STRING, number=232872494, optional=True,) + ip_cidr_range = proto.Field( + proto.STRING, + number=98117322, + optional=True, + ) + network = proto.Field( + proto.STRING, + number=232872494, + optional=True, + ) secondary_ip_ranges = proto.RepeatedField( - proto.MESSAGE, number=136658915, message="UsableSubnetworkSecondaryRange", + proto.MESSAGE, + number=136658915, + message="UsableSubnetworkSecondaryRange", + ) + subnetwork = proto.Field( + proto.STRING, + number=307827694, + optional=True, ) - subnetwork = proto.Field(proto.STRING, number=307827694, optional=True,) class UsableSubnetworkSecondaryRange(proto.Message): @@ -57417,8 +75714,16 @@ class UsableSubnetworkSecondaryRange(proto.Message): This field is a member of `oneof`_ ``_range_name``. """ - ip_cidr_range = proto.Field(proto.STRING, number=98117322, optional=True,) - range_name = proto.Field(proto.STRING, number=332216397, optional=True,) + ip_cidr_range = proto.Field( + proto.STRING, + number=98117322, + optional=True, + ) + range_name = proto.Field( + proto.STRING, + number=332216397, + optional=True, + ) class UsableSubnetworksAggregatedList(proto.Message): @@ -57463,15 +75768,36 @@ class UsableSubnetworksAggregatedList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.RepeatedField( - proto.MESSAGE, number=100526016, message="UsableSubnetwork", + proto.MESSAGE, + number=100526016, + message="UsableSubnetwork", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -57503,8 +75829,16 @@ class UsageExportLocation(proto.Message): This field is a member of `oneof`_ ``_report_name_prefix``. """ - bucket_name = proto.Field(proto.STRING, number=283610048, optional=True,) - report_name_prefix = proto.Field(proto.STRING, number=320198715, optional=True,) + bucket_name = proto.Field( + proto.STRING, + number=283610048, + optional=True, + ) + report_name_prefix = proto.Field( + proto.STRING, + number=320198715, + optional=True, + ) class ValidateRegionUrlMapRequest(proto.Message): @@ -57523,12 +75857,23 @@ class ValidateRegionUrlMapRequest(proto.Message): as. """ - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) region_url_maps_validate_request_resource = proto.Field( - proto.MESSAGE, number=56632858, message="RegionUrlMapsValidateRequest", + proto.MESSAGE, + number=56632858, + message="RegionUrlMapsValidateRequest", + ) + url_map = proto.Field( + proto.STRING, + number=367020684, ) - url_map = proto.Field(proto.STRING, number=367020684,) class ValidateUrlMapRequest(proto.Message): @@ -57545,10 +75890,18 @@ class ValidateUrlMapRequest(proto.Message): The body resource for this request """ - project = proto.Field(proto.STRING, number=227560217,) - url_map = proto.Field(proto.STRING, number=367020684,) + project = proto.Field( + proto.STRING, + number=227560217, + ) + url_map = proto.Field( + proto.STRING, + number=367020684, + ) url_maps_validate_request_resource = proto.Field( - proto.MESSAGE, number=395913455, message="UrlMapsValidateRequest", + proto.MESSAGE, + number=395913455, + message="UrlMapsValidateRequest", ) @@ -57566,7 +75919,11 @@ class VmEndpointNatMappings(proto.Message): """ - instance_name = proto.Field(proto.STRING, number=227947509, optional=True,) + instance_name = proto.Field( + proto.STRING, + number=227947509, + optional=True, + ) interface_nat_mappings = proto.RepeatedField( proto.MESSAGE, number=256196617, @@ -57613,14 +75970,34 @@ class VmEndpointNatMappingsInterfaceNatMappings(proto.Message): This field is a member of `oneof`_ ``_source_virtual_ip``. """ - drain_nat_ip_port_ranges = proto.RepeatedField(proto.STRING, number=395440577,) - nat_ip_port_ranges = proto.RepeatedField(proto.STRING, number=531830810,) + drain_nat_ip_port_ranges = proto.RepeatedField( + proto.STRING, + number=395440577, + ) + nat_ip_port_ranges = proto.RepeatedField( + proto.STRING, + number=531830810, + ) num_total_drain_nat_ports = proto.Field( - proto.INT32, number=335532793, optional=True, + proto.INT32, + number=335532793, + optional=True, + ) + num_total_nat_ports = proto.Field( + proto.INT32, + number=299904384, + optional=True, + ) + source_alias_ip_range = proto.Field( + proto.STRING, + number=440340952, + optional=True, + ) + source_virtual_ip = proto.Field( + proto.STRING, + number=149836159, + optional=True, ) - num_total_nat_ports = proto.Field(proto.INT32, number=299904384, optional=True,) - source_alias_ip_range = proto.Field(proto.STRING, number=440340952, optional=True,) - source_virtual_ip = proto.Field(proto.STRING, number=149836159, optional=True,) class VmEndpointNatMappingsList(proto.Message): @@ -57664,15 +76041,36 @@ class VmEndpointNatMappingsList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) result = proto.RepeatedField( - proto.MESSAGE, number=139315229, message="VmEndpointNatMappings", + proto.MESSAGE, + number=139315229, + message="VmEndpointNatMappings", + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, ) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -57770,19 +76168,65 @@ class StackType(proto.Enum): IPV4_IPV6 = 22197249 IPV4_ONLY = 22373798 - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - label_fingerprint = proto.Field(proto.STRING, number=178124825, optional=True,) - labels = proto.MapField(proto.STRING, proto.STRING, number=500195327,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - network = proto.Field(proto.STRING, number=232872494, optional=True,) - region = proto.Field(proto.STRING, number=138946292, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - stack_type = proto.Field(proto.STRING, number=425908881, optional=True,) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + label_fingerprint = proto.Field( + proto.STRING, + number=178124825, + optional=True, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=500195327, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + network = proto.Field( + proto.STRING, + number=232872494, + optional=True, + ) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + stack_type = proto.Field( + proto.STRING, + number=425908881, + optional=True, + ) vpn_interfaces = proto.RepeatedField( - proto.MESSAGE, number=91842181, message="VpnGatewayVpnGatewayInterface", + proto.MESSAGE, + number=91842181, + message="VpnGatewayVpnGatewayInterface", ) @@ -57827,16 +76271,41 @@ class VpnGatewayAggregatedList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.MapField( - proto.STRING, proto.MESSAGE, number=100526016, message="VpnGatewaysScopedList", + proto.STRING, + proto.MESSAGE, + number=100526016, + message="VpnGatewaysScopedList", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - unreachables = proto.RepeatedField(proto.STRING, number=243372063,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -57879,13 +76348,36 @@ class VpnGatewayList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) - items = proto.RepeatedField(proto.MESSAGE, number=100526016, message="VpnGateway",) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) + items = proto.RepeatedField( + proto.MESSAGE, + number=100526016, + message="VpnGateway", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -57898,7 +76390,9 @@ class VpnGatewayStatus(proto.Message): """ vpn_connections = proto.RepeatedField( - proto.MESSAGE, number=439334538, message="VpnGatewayStatusVpnConnection", + proto.MESSAGE, + number=439334538, + message="VpnGatewayStatusVpnConnection", ) @@ -57940,8 +76434,16 @@ class UnsatisfiedReason(proto.Enum): UNDEFINED_UNSATISFIED_REASON = 0 INCOMPLETE_TUNNELS_COVERAGE = 55917437 - state = proto.Field(proto.STRING, number=109757585, optional=True,) - unsatisfied_reason = proto.Field(proto.STRING, number=55016330, optional=True,) + state = proto.Field( + proto.STRING, + number=109757585, + optional=True, + ) + unsatisfied_reason = proto.Field( + proto.STRING, + number=55016330, + optional=True, + ) class VpnGatewayStatusTunnel(proto.Message): @@ -57966,10 +76468,20 @@ class VpnGatewayStatusTunnel(proto.Message): """ local_gateway_interface = proto.Field( - proto.UINT32, number=158764330, optional=True, + proto.UINT32, + number=158764330, + optional=True, + ) + peer_gateway_interface = proto.Field( + proto.UINT32, + number=214380385, + optional=True, + ) + tunnel_url = proto.Field( + proto.STRING, + number=78975256, + optional=True, ) - peer_gateway_interface = proto.Field(proto.UINT32, number=214380385, optional=True,) - tunnel_url = proto.Field(proto.STRING, number=78975256, optional=True,) class VpnGatewayStatusVpnConnection(proto.Message): @@ -58000,8 +76512,16 @@ class VpnGatewayStatusVpnConnection(proto.Message): connection. """ - peer_external_gateway = proto.Field(proto.STRING, number=384956173, optional=True,) - peer_gcp_gateway = proto.Field(proto.STRING, number=281867452, optional=True,) + peer_external_gateway = proto.Field( + proto.STRING, + number=384956173, + optional=True, + ) + peer_gcp_gateway = proto.Field( + proto.STRING, + number=281867452, + optional=True, + ) state = proto.Field( proto.MESSAGE, number=109757585, @@ -58009,7 +76529,9 @@ class VpnGatewayStatusVpnConnection(proto.Message): message="VpnGatewayStatusHighAvailabilityRequirementState", ) tunnels = proto.RepeatedField( - proto.MESSAGE, number=104561931, message="VpnGatewayStatusTunnel", + proto.MESSAGE, + number=104561931, + message="VpnGatewayStatusTunnel", ) @@ -58051,11 +76573,21 @@ class VpnGatewayVpnGatewayInterface(proto.Message): This field is a member of `oneof`_ ``_ip_address``. """ - id = proto.Field(proto.UINT32, number=3355, optional=True,) + id = proto.Field( + proto.UINT32, + number=3355, + optional=True, + ) interconnect_attachment = proto.Field( - proto.STRING, number=308135284, optional=True, + proto.STRING, + number=308135284, + optional=True, + ) + ip_address = proto.Field( + proto.STRING, + number=406272220, + optional=True, ) - ip_address = proto.Field(proto.STRING, number=406272220, optional=True,) class VpnGatewaysGetStatusResponse(proto.Message): @@ -58068,7 +76600,10 @@ class VpnGatewaysGetStatusResponse(proto.Message): """ result = proto.Field( - proto.MESSAGE, number=139315229, optional=True, message="VpnGatewayStatus", + proto.MESSAGE, + number=139315229, + optional=True, + message="VpnGatewayStatus", ) @@ -58087,10 +76622,15 @@ class VpnGatewaysScopedList(proto.Message): """ vpn_gateways = proto.RepeatedField( - proto.MESSAGE, number=259177882, message="VpnGateway", + proto.MESSAGE, + number=259177882, + message="VpnGateway", ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -58296,30 +76836,114 @@ class Status(proto.Enum): STOPPED = 444276141 WAITING_FOR_FULL_CONFIG = 41640522 - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - detailed_status = proto.Field(proto.STRING, number=333501025, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - ike_version = proto.Field(proto.INT32, number=218376220, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - local_traffic_selector = proto.RepeatedField(proto.STRING, number=317314613,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - peer_external_gateway = proto.Field(proto.STRING, number=384956173, optional=True,) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + detailed_status = proto.Field( + proto.STRING, + number=333501025, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + ike_version = proto.Field( + proto.INT32, + number=218376220, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + local_traffic_selector = proto.RepeatedField( + proto.STRING, + number=317314613, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + peer_external_gateway = proto.Field( + proto.STRING, + number=384956173, + optional=True, + ) peer_external_gateway_interface = proto.Field( - proto.INT32, number=452768391, optional=True, - ) - peer_gcp_gateway = proto.Field(proto.STRING, number=281867452, optional=True,) - peer_ip = proto.Field(proto.STRING, number=383249700, optional=True,) - region = proto.Field(proto.STRING, number=138946292, optional=True,) - remote_traffic_selector = proto.RepeatedField(proto.STRING, number=358887098,) - router = proto.Field(proto.STRING, number=148608841, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - shared_secret = proto.Field(proto.STRING, number=381932490, optional=True,) - shared_secret_hash = proto.Field(proto.STRING, number=398881891, optional=True,) - status = proto.Field(proto.STRING, number=181260274, optional=True,) - target_vpn_gateway = proto.Field(proto.STRING, number=532512843, optional=True,) - vpn_gateway = proto.Field(proto.STRING, number=406684153, optional=True,) - vpn_gateway_interface = proto.Field(proto.INT32, number=95979123, optional=True,) + proto.INT32, + number=452768391, + optional=True, + ) + peer_gcp_gateway = proto.Field( + proto.STRING, + number=281867452, + optional=True, + ) + peer_ip = proto.Field( + proto.STRING, + number=383249700, + optional=True, + ) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) + remote_traffic_selector = proto.RepeatedField( + proto.STRING, + number=358887098, + ) + router = proto.Field( + proto.STRING, + number=148608841, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + shared_secret = proto.Field( + proto.STRING, + number=381932490, + optional=True, + ) + shared_secret_hash = proto.Field( + proto.STRING, + number=398881891, + optional=True, + ) + status = proto.Field( + proto.STRING, + number=181260274, + optional=True, + ) + target_vpn_gateway = proto.Field( + proto.STRING, + number=532512843, + optional=True, + ) + vpn_gateway = proto.Field( + proto.STRING, + number=406684153, + optional=True, + ) + vpn_gateway_interface = proto.Field( + proto.INT32, + number=95979123, + optional=True, + ) class VpnTunnelAggregatedList(proto.Message): @@ -58363,16 +76987,41 @@ class VpnTunnelAggregatedList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) items = proto.MapField( - proto.STRING, proto.MESSAGE, number=100526016, message="VpnTunnelsScopedList", + proto.STRING, + proto.MESSAGE, + number=100526016, + message="VpnTunnelsScopedList", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, ) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - unreachables = proto.RepeatedField(proto.STRING, number=243372063,) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -58415,13 +77064,36 @@ class VpnTunnelList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) - items = proto.RepeatedField(proto.MESSAGE, number=100526016, message="VpnTunnel",) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) + items = proto.RepeatedField( + proto.MESSAGE, + number=100526016, + message="VpnTunnel", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -58440,10 +77112,15 @@ class VpnTunnelsScopedList(proto.Message): """ vpn_tunnels = proto.RepeatedField( - proto.MESSAGE, number=163494080, message="VpnTunnel", + proto.MESSAGE, + number=163494080, + message="VpnTunnel", ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -58467,11 +77144,20 @@ class WafExpressionSet(proto.Message): This field is a member of `oneof`_ ``_id``. """ - aliases = proto.RepeatedField(proto.STRING, number=159207166,) + aliases = proto.RepeatedField( + proto.STRING, + number=159207166, + ) expressions = proto.RepeatedField( - proto.MESSAGE, number=175554779, message="WafExpressionSetExpression", + proto.MESSAGE, + number=175554779, + message="WafExpressionSetExpression", + ) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, ) - id = proto.Field(proto.STRING, number=3355, optional=True,) class WafExpressionSetExpression(proto.Message): @@ -58491,7 +77177,11 @@ class WafExpressionSetExpression(proto.Message): This field is a member of `oneof`_ ``_id``. """ - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) class WaitGlobalOperationRequest(proto.Message): @@ -58505,8 +77195,14 @@ class WaitGlobalOperationRequest(proto.Message): Project ID for this request. """ - operation = proto.Field(proto.STRING, number=52090215,) - project = proto.Field(proto.STRING, number=227560217,) + operation = proto.Field( + proto.STRING, + number=52090215, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) class WaitRegionOperationRequest(proto.Message): @@ -58522,9 +77218,18 @@ class WaitRegionOperationRequest(proto.Message): Name of the region for this request. """ - operation = proto.Field(proto.STRING, number=52090215,) - project = proto.Field(proto.STRING, number=227560217,) - region = proto.Field(proto.STRING, number=138946292,) + operation = proto.Field( + proto.STRING, + number=52090215, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) class WaitZoneOperationRequest(proto.Message): @@ -58540,9 +77245,18 @@ class WaitZoneOperationRequest(proto.Message): Name of the zone for this request. """ - operation = proto.Field(proto.STRING, number=52090215,) - project = proto.Field(proto.STRING, number=227560217,) - zone = proto.Field(proto.STRING, number=3744684,) + operation = proto.Field( + proto.STRING, + number=52090215, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) class Warning(proto.Message): @@ -58599,9 +77313,21 @@ class Code(proto.Enum): UNDECLARED_PROPERTIES = 390513439 UNREACHABLE = 13328052 - code = proto.Field(proto.STRING, number=3059181, optional=True,) - data = proto.RepeatedField(proto.MESSAGE, number=3076010, message="Data",) - message = proto.Field(proto.STRING, number=418054151, optional=True,) + code = proto.Field( + proto.STRING, + number=3059181, + optional=True, + ) + data = proto.RepeatedField( + proto.MESSAGE, + number=3076010, + message="Data", + ) + message = proto.Field( + proto.STRING, + number=418054151, + optional=True, + ) class Warnings(proto.Message): @@ -58658,9 +77384,21 @@ class Code(proto.Enum): UNDECLARED_PROPERTIES = 390513439 UNREACHABLE = 13328052 - code = proto.Field(proto.STRING, number=3059181, optional=True,) - data = proto.RepeatedField(proto.MESSAGE, number=3076010, message="Data",) - message = proto.Field(proto.STRING, number=418054151, optional=True,) + code = proto.Field( + proto.STRING, + number=3059181, + optional=True, + ) + data = proto.RepeatedField( + proto.MESSAGE, + number=3076010, + message="Data", + ) + message = proto.Field( + proto.STRING, + number=418054151, + optional=True, + ) class WeightedBackendService(proto.Message): @@ -58708,11 +77446,22 @@ class WeightedBackendService(proto.Message): This field is a member of `oneof`_ ``_weight``. """ - backend_service = proto.Field(proto.STRING, number=306946058, optional=True,) + backend_service = proto.Field( + proto.STRING, + number=306946058, + optional=True, + ) header_action = proto.Field( - proto.MESSAGE, number=328077352, optional=True, message="HttpHeaderAction", + proto.MESSAGE, + number=328077352, + optional=True, + message="HttpHeaderAction", + ) + weight = proto.Field( + proto.UINT32, + number=282149496, + optional=True, ) - weight = proto.Field(proto.UINT32, number=282149496, optional=True,) class XpnHostList(proto.Message): @@ -58754,13 +77503,36 @@ class XpnHostList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) - items = proto.RepeatedField(proto.MESSAGE, number=100526016, message="Project",) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) + items = proto.RepeatedField( + proto.MESSAGE, + number=100526016, + message="Project", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -58789,8 +77561,16 @@ class Type(proto.Enum): PROJECT = 408671993 XPN_RESOURCE_TYPE_UNSPECIFIED = 151607034 - id = proto.Field(proto.STRING, number=3355, optional=True,) - type_ = proto.Field(proto.STRING, number=3575610, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) + type_ = proto.Field( + proto.STRING, + number=3575610, + optional=True, + ) class Zone(proto.Message): @@ -58856,19 +77636,61 @@ class Status(proto.Enum): DOWN = 2104482 UP = 2715 - available_cpu_platforms = proto.RepeatedField(proto.STRING, number=175536531,) - creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) + available_cpu_platforms = proto.RepeatedField( + proto.STRING, + number=175536531, + ) + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) deprecated = proto.Field( - proto.MESSAGE, number=515138995, optional=True, message="DeprecationStatus", + proto.MESSAGE, + number=515138995, + optional=True, + message="DeprecationStatus", + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + status = proto.Field( + proto.STRING, + number=181260274, + optional=True, + ) + supports_pzs = proto.Field( + proto.BOOL, + number=83983214, + optional=True, ) - description = proto.Field(proto.STRING, number=422937596, optional=True,) - id = proto.Field(proto.UINT64, number=3355, optional=True,) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - name = proto.Field(proto.STRING, number=3373707, optional=True,) - region = proto.Field(proto.STRING, number=138946292, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - status = proto.Field(proto.STRING, number=181260274, optional=True,) - supports_pzs = proto.Field(proto.BOOL, number=83983214, optional=True,) class ZoneList(proto.Message): @@ -58909,13 +77731,36 @@ class ZoneList(proto.Message): def raw_page(self): return self - id = proto.Field(proto.STRING, number=3355, optional=True,) - items = proto.RepeatedField(proto.MESSAGE, number=100526016, message="Zone",) - kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_page_token = proto.Field(proto.STRING, number=79797525, optional=True,) - self_link = proto.Field(proto.STRING, number=456214797, optional=True,) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) + items = proto.RepeatedField( + proto.MESSAGE, + number=100526016, + message="Zone", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) warning = proto.Field( - proto.MESSAGE, number=50704284, optional=True, message="Warning", + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", ) @@ -58938,8 +77783,16 @@ class ZoneSetLabelsRequest(proto.Message): The labels to set for this resource. """ - label_fingerprint = proto.Field(proto.STRING, number=178124825, optional=True,) - labels = proto.MapField(proto.STRING, proto.STRING, number=500195327,) + label_fingerprint = proto.Field( + proto.STRING, + number=178124825, + optional=True, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=500195327, + ) class ZoneSetPolicyRequest(proto.Message): @@ -58966,10 +77819,21 @@ class ZoneSetPolicyRequest(proto.Message): This field is a member of `oneof`_ ``_policy``. """ - bindings = proto.RepeatedField(proto.MESSAGE, number=403251854, message="Binding",) - etag = proto.Field(proto.STRING, number=3123477, optional=True,) + bindings = proto.RepeatedField( + proto.MESSAGE, + number=403251854, + message="Binding", + ) + etag = proto.Field( + proto.STRING, + number=3123477, + optional=True, + ) policy = proto.Field( - proto.MESSAGE, number=91071794, optional=True, message="Policy", + proto.MESSAGE, + number=91071794, + optional=True, + message="Policy", ) diff --git a/noxfile.py b/noxfile.py index f041f1f5a..6f280fbbb 100644 --- a/noxfile.py +++ b/noxfile.py @@ -24,7 +24,7 @@ import nox -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" @@ -57,7 +57,9 @@ def lint(session): """ session.install("flake8", BLACK_VERSION) session.run( - "black", "--check", *BLACK_PATHS, + "black", + "--check", + *BLACK_PATHS, ) session.run("flake8", "google", "tests") @@ -67,7 +69,8 @@ def blacken(session): """Run black. Format code to uniform standard.""" session.install(BLACK_VERSION) session.run( - "black", *BLACK_PATHS, + "black", + *BLACK_PATHS, ) diff --git a/samples/noxfile.py b/samples/noxfile.py index 85f5836db..25f87a215 100644 --- a/samples/noxfile.py +++ b/samples/noxfile.py @@ -29,7 +29,7 @@ # WARNING - WARNING - WARNING - WARNING - WARNING # WARNING - WARNING - WARNING - WARNING - WARNING -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" # Copy `noxfile_config.py` to your directory and modify it instead. @@ -253,7 +253,7 @@ def py(session: nox.sessions.Session) -> None: def _get_repo_root() -> Optional[str]: - """ Returns the root folder of the project. """ + """Returns the root folder of the project.""" # Get root of this repository. Assume we don't have directories nested deeper than 10 items. p = Path(os.getcwd()) for i in range(10): diff --git a/samples/requirements.txt b/samples/requirements.txt index c0be0f7c6..a6a43c7f8 100644 --- a/samples/requirements.txt +++ b/samples/requirements.txt @@ -1,3 +1,3 @@ isort==5.10.1 -black==22.1.0 -google-cloud-compute==1.1.0 \ No newline at end of file +black==22.3.0 +google-cloud-compute==1.1.0 diff --git a/tests/unit/gapic/compute_v1/test_accelerator_types.py b/tests/unit/gapic/compute_v1/test_accelerator_types.py index 410619e99..0904fa39f 100644 --- a/tests/unit/gapic/compute_v1/test_accelerator_types.py +++ b/tests/unit/gapic/compute_v1/test_accelerator_types.py @@ -90,7 +90,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(AcceleratorTypesClient, "rest"),] + "client_class,transport_name", + [ + (AcceleratorTypesClient, "rest"), + ], ) def test_accelerator_types_client_from_service_account_info( client_class, transport_name @@ -114,7 +117,9 @@ def test_accelerator_types_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.AcceleratorTypesRestTransport, "rest"),], + [ + (transports.AcceleratorTypesRestTransport, "rest"), + ], ) def test_accelerator_types_client_service_account_always_use_jwt( transport_class, transport_name @@ -135,7 +140,10 @@ def test_accelerator_types_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(AcceleratorTypesClient, "rest"),] + "client_class,transport_name", + [ + (AcceleratorTypesClient, "rest"), + ], ) def test_accelerator_types_client_from_service_account_file( client_class, transport_name @@ -177,7 +185,9 @@ def test_accelerator_types_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(AcceleratorTypesClient, transports.AcceleratorTypesRestTransport, "rest"),], + [ + (AcceleratorTypesClient, transports.AcceleratorTypesRestTransport, "rest"), + ], ) @mock.patch.object( AcceleratorTypesClient, @@ -470,13 +480,17 @@ def test_accelerator_types_client_get_mtls_endpoint_and_cert_source(client_class @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(AcceleratorTypesClient, transports.AcceleratorTypesRestTransport, "rest"),], + [ + (AcceleratorTypesClient, transports.AcceleratorTypesRestTransport, "rest"), + ], ) def test_accelerator_types_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -494,7 +508,14 @@ def test_accelerator_types_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(AcceleratorTypesClient, transports.AcceleratorTypesRestTransport, "rest", None),], + [ + ( + AcceleratorTypesClient, + transports.AcceleratorTypesRestTransport, + "rest", + None, + ), + ], ) def test_accelerator_types_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -518,11 +539,16 @@ def test_accelerator_types_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.AggregatedListAcceleratorTypesRequest, dict,] + "request_type", + [ + compute.AggregatedListAcceleratorTypesRequest, + dict, + ], ) def test_aggregated_list_rest(request_type): client = AcceleratorTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -603,7 +629,8 @@ def test_aggregated_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = AcceleratorTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -704,7 +731,11 @@ def test_aggregated_list_rest_interceptors(null_interceptor): post.return_value = compute.AcceleratorTypeAggregatedList client.aggregated_list( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -715,7 +746,8 @@ def test_aggregated_list_rest_bad_request( transport: str = "rest", request_type=compute.AggregatedListAcceleratorTypesRequest ): client = AcceleratorTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -736,7 +768,8 @@ def test_aggregated_list_rest_bad_request( def test_aggregated_list_rest_flattened(): client = AcceleratorTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -748,7 +781,9 @@ def test_aggregated_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -774,20 +809,23 @@ def test_aggregated_list_rest_flattened(): def test_aggregated_list_rest_flattened_error(transport: str = "rest"): client = AcceleratorTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.aggregated_list( - compute.AggregatedListAcceleratorTypesRequest(), project="project_value", + compute.AggregatedListAcceleratorTypesRequest(), + project="project_value", ) def test_aggregated_list_rest_pager(transport: str = "rest"): client = AcceleratorTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -804,9 +842,14 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): }, next_page_token="abc", ), - compute.AcceleratorTypeAggregatedList(items={}, next_page_token="def",), compute.AcceleratorTypeAggregatedList( - items={"g": compute.AcceleratorTypesScopedList(),}, + items={}, + next_page_token="def", + ), + compute.AcceleratorTypeAggregatedList( + items={ + "g": compute.AcceleratorTypesScopedList(), + }, next_page_token="ghi", ), compute.AcceleratorTypeAggregatedList( @@ -854,10 +897,17 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.GetAcceleratorTypeRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetAcceleratorTypeRequest, + dict, + ], +) def test_get_rest(request_type): client = AcceleratorTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -943,7 +993,8 @@ def test_get_rest_required_fields(request_type=compute.GetAcceleratorTypeRequest assert jsonified_request["zone"] == "zone_value" client = AcceleratorTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -983,7 +1034,16 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("acceleratorType", "project", "zone",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "acceleratorType", + "project", + "zone", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1029,7 +1089,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.AcceleratorType - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1039,7 +1105,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetAcceleratorTypeRequest ): client = AcceleratorTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1064,7 +1131,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = AcceleratorTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1110,7 +1178,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = AcceleratorTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1130,10 +1199,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListAcceleratorTypesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListAcceleratorTypesRequest, + dict, + ], +) def test_list_rest(request_type): client = AcceleratorTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1196,7 +1272,13 @@ def test_list_rest_required_fields(request_type=compute.ListAcceleratorTypesRequ ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1207,7 +1289,8 @@ def test_list_rest_required_fields(request_type=compute.ListAcceleratorTypesRequ assert jsonified_request["zone"] == "zone_value" client = AcceleratorTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1248,8 +1331,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "zone",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "zone", + ) + ) ) @@ -1296,7 +1392,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.AcceleratorTypeList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1306,7 +1408,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListAcceleratorTypesRequest ): client = AcceleratorTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1327,7 +1430,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = AcceleratorTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1339,7 +1443,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "zone": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", zone="zone_value",) + mock_args = dict( + project="project_value", + zone="zone_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1365,7 +1472,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = AcceleratorTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1380,7 +1488,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = AcceleratorTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1397,12 +1506,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.AcceleratorTypeList(items=[], next_page_token="def",), compute.AcceleratorTypeList( - items=[compute.AcceleratorType(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.AcceleratorTypeList( - items=[compute.AcceleratorType(), compute.AcceleratorType(),], + items=[ + compute.AcceleratorType(), + ], + next_page_token="ghi", + ), + compute.AcceleratorTypeList( + items=[ + compute.AcceleratorType(), + compute.AcceleratorType(), + ], ), ) # Two responses for two calls @@ -1436,7 +1554,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = AcceleratorTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1456,7 +1575,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = AcceleratorTypesClient(client_options=options, transport=transport,) + client = AcceleratorTypesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1472,7 +1594,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = AcceleratorTypesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1485,7 +1608,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.AcceleratorTypesRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.AcceleratorTypesRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -1538,7 +1666,8 @@ def test_accelerator_types_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.AcceleratorTypesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1590,7 +1719,12 @@ def test_accelerator_types_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_accelerator_types_host_no_port(transport_name): client = AcceleratorTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1606,7 +1740,12 @@ def test_accelerator_types_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_accelerator_types_host_with_port(transport_name): client = AcceleratorTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1644,7 +1783,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = AcceleratorTypesClient.common_folder_path(folder) assert expected == actual @@ -1662,7 +1803,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = AcceleratorTypesClient.common_organization_path(organization) assert expected == actual @@ -1680,7 +1823,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = AcceleratorTypesClient.common_project_path(project) assert expected == actual @@ -1700,7 +1845,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = AcceleratorTypesClient.common_location_path(project, location) assert expected == actual @@ -1725,7 +1871,8 @@ def test_client_with_default_client_info(): transports.AcceleratorTypesTransport, "_prep_wrapped_messages" ) as prep: client = AcceleratorTypesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1734,7 +1881,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = AcceleratorTypesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1774,7 +1922,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(AcceleratorTypesClient, transports.AcceleratorTypesRestTransport),], + [ + (AcceleratorTypesClient, transports.AcceleratorTypesRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_addresses.py b/tests/unit/gapic/compute_v1/test_addresses.py index dfa2f12d5..20d37de8e 100644 --- a/tests/unit/gapic/compute_v1/test_addresses.py +++ b/tests/unit/gapic/compute_v1/test_addresses.py @@ -83,7 +83,12 @@ def test__get_default_mtls_endpoint(): assert AddressesClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class,transport_name", [(AddressesClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (AddressesClient, "rest"), + ], +) def test_addresses_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -103,7 +108,10 @@ def test_addresses_client_from_service_account_info(client_class, transport_name @pytest.mark.parametrize( - "transport_class,transport_name", [(transports.AddressesRestTransport, "rest"),] + "transport_class,transport_name", + [ + (transports.AddressesRestTransport, "rest"), + ], ) def test_addresses_client_service_account_always_use_jwt( transport_class, transport_name @@ -123,7 +131,12 @@ def test_addresses_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class,transport_name", [(AddressesClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (AddressesClient, "rest"), + ], +) def test_addresses_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -162,7 +175,9 @@ def test_addresses_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(AddressesClient, transports.AddressesRestTransport, "rest"),], + [ + (AddressesClient, transports.AddressesRestTransport, "rest"), + ], ) @mock.patch.object( AddressesClient, "DEFAULT_ENDPOINT", modify_default_endpoint(AddressesClient) @@ -437,13 +452,17 @@ def test_addresses_client_get_mtls_endpoint_and_cert_source(client_class): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(AddressesClient, transports.AddressesRestTransport, "rest"),], + [ + (AddressesClient, transports.AddressesRestTransport, "rest"), + ], ) def test_addresses_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -461,7 +480,9 @@ def test_addresses_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(AddressesClient, transports.AddressesRestTransport, "rest", None),], + [ + (AddressesClient, transports.AddressesRestTransport, "rest", None), + ], ) def test_addresses_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -485,11 +506,16 @@ def test_addresses_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.AggregatedListAddressesRequest, dict,] + "request_type", + [ + compute.AggregatedListAddressesRequest, + dict, + ], ) def test_aggregated_list_rest(request_type): client = AddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -570,7 +596,8 @@ def test_aggregated_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = AddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -667,7 +694,11 @@ def test_aggregated_list_rest_interceptors(null_interceptor): post.return_value = compute.AddressAggregatedList client.aggregated_list( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -678,7 +709,8 @@ def test_aggregated_list_rest_bad_request( transport: str = "rest", request_type=compute.AggregatedListAddressesRequest ): client = AddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -699,7 +731,8 @@ def test_aggregated_list_rest_bad_request( def test_aggregated_list_rest_flattened(): client = AddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -711,7 +744,9 @@ def test_aggregated_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -737,20 +772,23 @@ def test_aggregated_list_rest_flattened(): def test_aggregated_list_rest_flattened_error(transport: str = "rest"): client = AddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.aggregated_list( - compute.AggregatedListAddressesRequest(), project="project_value", + compute.AggregatedListAddressesRequest(), + project="project_value", ) def test_aggregated_list_rest_pager(transport: str = "rest"): client = AddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -767,9 +805,15 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): }, next_page_token="abc", ), - compute.AddressAggregatedList(items={}, next_page_token="def",), compute.AddressAggregatedList( - items={"g": compute.AddressesScopedList(),}, next_page_token="ghi", + items={}, + next_page_token="def", + ), + compute.AddressAggregatedList( + items={ + "g": compute.AddressesScopedList(), + }, + next_page_token="ghi", ), compute.AddressAggregatedList( items={ @@ -811,10 +855,17 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.DeleteAddressRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteAddressRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = AddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -926,7 +977,8 @@ def test_delete_unary_rest_required_fields(request_type=compute.DeleteAddressReq assert jsonified_request["region"] == "region_value" client = AddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -967,7 +1019,14 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("address", "project", "region",)) + set(("requestId",)) + & set( + ( + "address", + "project", + "region", + ) + ) ) @@ -1011,7 +1070,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1022,7 +1085,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteAddressRequest ): client = AddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1043,7 +1107,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = AddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1060,7 +1125,9 @@ def test_delete_unary_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", region="region_value", address="address_value", + project="project_value", + region="region_value", + address="address_value", ) mock_args.update(sample_request) @@ -1087,7 +1154,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = AddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1107,10 +1175,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetAddressRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetAddressRequest, + dict, + ], +) def test_get_rest(request_type): client = AddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1210,7 +1285,8 @@ def test_get_rest_required_fields(request_type=compute.GetAddressRequest): assert jsonified_request["region"] == "region_value" client = AddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1250,7 +1326,16 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("address", "project", "region",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "address", + "project", + "region", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1292,7 +1377,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Address - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1302,7 +1393,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetAddressRequest ): client = AddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1323,7 +1415,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = AddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1340,7 +1433,9 @@ def test_get_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", region="region_value", address="address_value", + project="project_value", + region="region_value", + address="address_value", ) mock_args.update(sample_request) @@ -1367,7 +1462,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = AddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1387,10 +1483,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertAddressRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertAddressRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = AddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1517,7 +1620,8 @@ def test_insert_unary_rest_required_fields(request_type=compute.InsertAddressReq assert jsonified_request["region"] == "region_value" client = AddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1559,7 +1663,14 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("addressResource", "project", "region",)) + set(("requestId",)) + & set( + ( + "addressResource", + "project", + "region", + ) + ) ) @@ -1603,7 +1714,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1614,7 +1729,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertAddressRequest ): client = AddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1654,7 +1770,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = AddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1696,7 +1813,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = AddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1716,10 +1834,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListAddressesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListAddressesRequest, + dict, + ], +) def test_list_rest(request_type): client = AddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1782,7 +1907,13 @@ def test_list_rest_required_fields(request_type=compute.ListAddressesRequest): ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1793,7 +1924,8 @@ def test_list_rest_required_fields(request_type=compute.ListAddressesRequest): assert jsonified_request["region"] == "region_value" client = AddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1834,8 +1966,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "region",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "region", + ) + ) ) @@ -1878,7 +2023,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.AddressList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1888,7 +2039,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListAddressesRequest ): client = AddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1909,7 +2061,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = AddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1921,7 +2074,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "region": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", region="region_value",) + mock_args = dict( + project="project_value", + region="region_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1947,7 +2103,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = AddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1962,7 +2119,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = AddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1972,12 +2130,29 @@ def test_list_rest_pager(transport: str = "rest"): # Set the response as a series of pages response = ( compute.AddressList( - items=[compute.Address(), compute.Address(), compute.Address(),], + items=[ + compute.Address(), + compute.Address(), + compute.Address(), + ], next_page_token="abc", ), - compute.AddressList(items=[], next_page_token="def",), - compute.AddressList(items=[compute.Address(),], next_page_token="ghi",), - compute.AddressList(items=[compute.Address(), compute.Address(),],), + compute.AddressList( + items=[], + next_page_token="def", + ), + compute.AddressList( + items=[ + compute.Address(), + ], + next_page_token="ghi", + ), + compute.AddressList( + items=[ + compute.Address(), + compute.Address(), + ], + ), ) # Two responses for two calls response = response + response @@ -2010,7 +2185,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = AddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2030,7 +2206,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = AddressesClient(client_options=options, transport=transport,) + client = AddressesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2046,7 +2225,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = AddressesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2059,7 +2239,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.AddressesRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.AddressesRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -2114,7 +2299,8 @@ def test_addresses_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.AddressesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2164,7 +2350,12 @@ def test_addresses_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_addresses_host_no_port(transport_name): client = AddressesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2180,7 +2371,12 @@ def test_addresses_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_addresses_host_with_port(transport_name): client = AddressesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2218,7 +2414,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = AddressesClient.common_folder_path(folder) assert expected == actual @@ -2236,7 +2434,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = AddressesClient.common_organization_path(organization) assert expected == actual @@ -2254,7 +2454,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = AddressesClient.common_project_path(project) assert expected == actual @@ -2274,7 +2476,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = AddressesClient.common_location_path(project, location) assert expected == actual @@ -2299,7 +2502,8 @@ def test_client_with_default_client_info(): transports.AddressesTransport, "_prep_wrapped_messages" ) as prep: client = AddressesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2308,7 +2512,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = AddressesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2348,7 +2553,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(AddressesClient, transports.AddressesRestTransport),], + [ + (AddressesClient, transports.AddressesRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_autoscalers.py b/tests/unit/gapic/compute_v1/test_autoscalers.py index 2d265aeaf..a022f71b2 100644 --- a/tests/unit/gapic/compute_v1/test_autoscalers.py +++ b/tests/unit/gapic/compute_v1/test_autoscalers.py @@ -85,7 +85,12 @@ def test__get_default_mtls_endpoint(): assert AutoscalersClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class,transport_name", [(AutoscalersClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (AutoscalersClient, "rest"), + ], +) def test_autoscalers_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -105,7 +110,10 @@ def test_autoscalers_client_from_service_account_info(client_class, transport_na @pytest.mark.parametrize( - "transport_class,transport_name", [(transports.AutoscalersRestTransport, "rest"),] + "transport_class,transport_name", + [ + (transports.AutoscalersRestTransport, "rest"), + ], ) def test_autoscalers_client_service_account_always_use_jwt( transport_class, transport_name @@ -125,7 +133,12 @@ def test_autoscalers_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class,transport_name", [(AutoscalersClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (AutoscalersClient, "rest"), + ], +) def test_autoscalers_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -164,7 +177,9 @@ def test_autoscalers_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(AutoscalersClient, transports.AutoscalersRestTransport, "rest"),], + [ + (AutoscalersClient, transports.AutoscalersRestTransport, "rest"), + ], ) @mock.patch.object( AutoscalersClient, "DEFAULT_ENDPOINT", modify_default_endpoint(AutoscalersClient) @@ -441,13 +456,17 @@ def test_autoscalers_client_get_mtls_endpoint_and_cert_source(client_class): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(AutoscalersClient, transports.AutoscalersRestTransport, "rest"),], + [ + (AutoscalersClient, transports.AutoscalersRestTransport, "rest"), + ], ) def test_autoscalers_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -465,7 +484,9 @@ def test_autoscalers_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(AutoscalersClient, transports.AutoscalersRestTransport, "rest", None),], + [ + (AutoscalersClient, transports.AutoscalersRestTransport, "rest", None), + ], ) def test_autoscalers_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -489,11 +510,16 @@ def test_autoscalers_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.AggregatedListAutoscalersRequest, dict,] + "request_type", + [ + compute.AggregatedListAutoscalersRequest, + dict, + ], ) def test_aggregated_list_rest(request_type): client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -574,7 +600,8 @@ def test_aggregated_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -673,7 +700,11 @@ def test_aggregated_list_rest_interceptors(null_interceptor): post.return_value = compute.AutoscalerAggregatedList client.aggregated_list( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -684,7 +715,8 @@ def test_aggregated_list_rest_bad_request( transport: str = "rest", request_type=compute.AggregatedListAutoscalersRequest ): client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -705,7 +737,8 @@ def test_aggregated_list_rest_bad_request( def test_aggregated_list_rest_flattened(): client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -717,7 +750,9 @@ def test_aggregated_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -743,20 +778,23 @@ def test_aggregated_list_rest_flattened(): def test_aggregated_list_rest_flattened_error(transport: str = "rest"): client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.aggregated_list( - compute.AggregatedListAutoscalersRequest(), project="project_value", + compute.AggregatedListAutoscalersRequest(), + project="project_value", ) def test_aggregated_list_rest_pager(transport: str = "rest"): client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -773,9 +811,15 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): }, next_page_token="abc", ), - compute.AutoscalerAggregatedList(items={}, next_page_token="def",), compute.AutoscalerAggregatedList( - items={"g": compute.AutoscalersScopedList(),}, next_page_token="ghi", + items={}, + next_page_token="def", + ), + compute.AutoscalerAggregatedList( + items={ + "g": compute.AutoscalersScopedList(), + }, + next_page_token="ghi", ), compute.AutoscalerAggregatedList( items={ @@ -820,10 +864,17 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.DeleteAutoscalerRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteAutoscalerRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -937,7 +988,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -978,7 +1030,14 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("autoscaler", "project", "zone",)) + set(("requestId",)) + & set( + ( + "autoscaler", + "project", + "zone", + ) + ) ) @@ -1024,7 +1083,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1035,7 +1098,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteAutoscalerRequest ): client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1056,7 +1120,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1073,7 +1138,9 @@ def test_delete_unary_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", zone="zone_value", autoscaler="autoscaler_value", + project="project_value", + zone="zone_value", + autoscaler="autoscaler_value", ) mock_args.update(sample_request) @@ -1100,7 +1167,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1120,10 +1188,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetAutoscalerRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetAutoscalerRequest, + dict, + ], +) def test_get_rest(request_type): client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1211,7 +1286,8 @@ def test_get_rest_required_fields(request_type=compute.GetAutoscalerRequest): assert jsonified_request["zone"] == "zone_value" client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1251,7 +1327,16 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("autoscaler", "project", "zone",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "autoscaler", + "project", + "zone", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1295,7 +1380,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Autoscaler - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1305,7 +1396,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetAutoscalerRequest ): client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1326,7 +1418,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1343,7 +1436,9 @@ def test_get_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", zone="zone_value", autoscaler="autoscaler_value", + project="project_value", + zone="zone_value", + autoscaler="autoscaler_value", ) mock_args.update(sample_request) @@ -1370,7 +1465,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1390,10 +1486,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertAutoscalerRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertAutoscalerRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1547,7 +1650,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1589,7 +1693,14 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("autoscalerResource", "project", "zone",)) + set(("requestId",)) + & set( + ( + "autoscalerResource", + "project", + "zone", + ) + ) ) @@ -1635,7 +1746,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1646,7 +1761,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertAutoscalerRequest ): client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1711,7 +1827,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1755,7 +1872,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1777,10 +1895,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListAutoscalersRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListAutoscalersRequest, + dict, + ], +) def test_list_rest(request_type): client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1843,7 +1968,13 @@ def test_list_rest_required_fields(request_type=compute.ListAutoscalersRequest): ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1854,7 +1985,8 @@ def test_list_rest_required_fields(request_type=compute.ListAutoscalersRequest): assert jsonified_request["zone"] == "zone_value" client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1895,8 +2027,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "zone",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "zone", + ) + ) ) @@ -1943,7 +2088,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.AutoscalerList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1953,7 +2104,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListAutoscalersRequest ): client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1974,7 +2126,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1986,7 +2139,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "zone": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", zone="zone_value",) + mock_args = dict( + project="project_value", + zone="zone_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2012,7 +2168,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2027,7 +2184,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2044,12 +2202,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.AutoscalerList(items=[], next_page_token="def",), compute.AutoscalerList( - items=[compute.Autoscaler(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.AutoscalerList( - items=[compute.Autoscaler(), compute.Autoscaler(),], + items=[ + compute.Autoscaler(), + ], + next_page_token="ghi", + ), + compute.AutoscalerList( + items=[ + compute.Autoscaler(), + compute.Autoscaler(), + ], ), ) # Two responses for two calls @@ -2076,10 +2243,17 @@ def test_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.PatchAutoscalerRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.PatchAutoscalerRequest, + dict, + ], +) def test_patch_unary_rest(request_type): client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2221,7 +2395,12 @@ def test_patch_unary_rest_required_fields(request_type=compute.PatchAutoscalerRe credentials=ga_credentials.AnonymousCredentials() ).patch._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("autoscaler", "request_id",)) + assert not set(unset_fields) - set( + ( + "autoscaler", + "request_id", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -2231,7 +2410,8 @@ def test_patch_unary_rest_required_fields(request_type=compute.PatchAutoscalerRe assert jsonified_request["zone"] == "zone_value" client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2273,8 +2453,19 @@ def test_patch_unary_rest_unset_required_fields(): unset_fields = transport.patch._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("autoscaler", "requestId",)) - & set(("autoscalerResource", "project", "zone",)) + set( + ( + "autoscaler", + "requestId", + ) + ) + & set( + ( + "autoscalerResource", + "project", + "zone", + ) + ) ) @@ -2319,7 +2510,13 @@ def test_patch_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.patch_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2329,7 +2526,8 @@ def test_patch_unary_rest_bad_request( transport: str = "rest", request_type=compute.PatchAutoscalerRequest ): client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2394,7 +2592,8 @@ def test_patch_unary_rest_bad_request( def test_patch_unary_rest_flattened(): client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2438,7 +2637,8 @@ def test_patch_unary_rest_flattened(): def test_patch_unary_rest_flattened_error(transport: str = "rest"): client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2460,10 +2660,17 @@ def test_patch_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.UpdateAutoscalerRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.UpdateAutoscalerRequest, + dict, + ], +) def test_update_unary_rest(request_type): client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2607,7 +2814,12 @@ def test_update_unary_rest_required_fields( credentials=ga_credentials.AnonymousCredentials() ).update._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("autoscaler", "request_id",)) + assert not set(unset_fields) - set( + ( + "autoscaler", + "request_id", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -2617,7 +2829,8 @@ def test_update_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2659,8 +2872,19 @@ def test_update_unary_rest_unset_required_fields(): unset_fields = transport.update._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("autoscaler", "requestId",)) - & set(("autoscalerResource", "project", "zone",)) + set( + ( + "autoscaler", + "requestId", + ) + ) + & set( + ( + "autoscalerResource", + "project", + "zone", + ) + ) ) @@ -2706,7 +2930,11 @@ def test_update_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.update_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2717,7 +2945,8 @@ def test_update_unary_rest_bad_request( transport: str = "rest", request_type=compute.UpdateAutoscalerRequest ): client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2782,7 +3011,8 @@ def test_update_unary_rest_bad_request( def test_update_unary_rest_flattened(): client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2826,7 +3056,8 @@ def test_update_unary_rest_flattened(): def test_update_unary_rest_flattened_error(transport: str = "rest"): client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2855,7 +3086,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2875,7 +3107,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = AutoscalersClient(client_options=options, transport=transport,) + client = AutoscalersClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2891,7 +3126,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = AutoscalersClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2904,7 +3140,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.AutoscalersRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.AutoscalersRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -2961,7 +3202,8 @@ def test_autoscalers_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.AutoscalersTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -3011,7 +3253,12 @@ def test_autoscalers_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_autoscalers_host_no_port(transport_name): client = AutoscalersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3027,7 +3274,12 @@ def test_autoscalers_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_autoscalers_host_with_port(transport_name): client = AutoscalersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3065,7 +3317,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = AutoscalersClient.common_folder_path(folder) assert expected == actual @@ -3083,7 +3337,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = AutoscalersClient.common_organization_path(organization) assert expected == actual @@ -3101,7 +3357,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = AutoscalersClient.common_project_path(project) assert expected == actual @@ -3121,7 +3379,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = AutoscalersClient.common_location_path(project, location) assert expected == actual @@ -3146,7 +3405,8 @@ def test_client_with_default_client_info(): transports.AutoscalersTransport, "_prep_wrapped_messages" ) as prep: client = AutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3155,7 +3415,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = AutoscalersClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3195,7 +3456,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(AutoscalersClient, transports.AutoscalersRestTransport),], + [ + (AutoscalersClient, transports.AutoscalersRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_backend_buckets.py b/tests/unit/gapic/compute_v1/test_backend_buckets.py index f17bb4053..9e89c6dd0 100644 --- a/tests/unit/gapic/compute_v1/test_backend_buckets.py +++ b/tests/unit/gapic/compute_v1/test_backend_buckets.py @@ -89,7 +89,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(BackendBucketsClient, "rest"),] + "client_class,transport_name", + [ + (BackendBucketsClient, "rest"), + ], ) def test_backend_buckets_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() @@ -111,7 +114,9 @@ def test_backend_buckets_client_from_service_account_info(client_class, transpor @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.BackendBucketsRestTransport, "rest"),], + [ + (transports.BackendBucketsRestTransport, "rest"), + ], ) def test_backend_buckets_client_service_account_always_use_jwt( transport_class, transport_name @@ -132,7 +137,10 @@ def test_backend_buckets_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(BackendBucketsClient, "rest"),] + "client_class,transport_name", + [ + (BackendBucketsClient, "rest"), + ], ) def test_backend_buckets_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() @@ -172,7 +180,9 @@ def test_backend_buckets_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(BackendBucketsClient, transports.BackendBucketsRestTransport, "rest"),], + [ + (BackendBucketsClient, transports.BackendBucketsRestTransport, "rest"), + ], ) @mock.patch.object( BackendBucketsClient, @@ -455,13 +465,17 @@ def test_backend_buckets_client_get_mtls_endpoint_and_cert_source(client_class): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(BackendBucketsClient, transports.BackendBucketsRestTransport, "rest"),], + [ + (BackendBucketsClient, transports.BackendBucketsRestTransport, "rest"), + ], ) def test_backend_buckets_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -479,7 +493,9 @@ def test_backend_buckets_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(BackendBucketsClient, transports.BackendBucketsRestTransport, "rest", None),], + [ + (BackendBucketsClient, transports.BackendBucketsRestTransport, "rest", None), + ], ) def test_backend_buckets_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -503,11 +519,16 @@ def test_backend_buckets_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.AddSignedUrlKeyBackendBucketRequest, dict,] + "request_type", + [ + compute.AddSignedUrlKeyBackendBucketRequest, + dict, + ], ) def test_add_signed_url_key_unary_rest(request_type): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -621,7 +642,8 @@ def test_add_signed_url_key_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -663,7 +685,14 @@ def test_add_signed_url_key_unary_rest_unset_required_fields(): unset_fields = transport.add_signed_url_key._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("backendBucket", "project", "signedUrlKeyResource",)) + set(("requestId",)) + & set( + ( + "backendBucket", + "project", + "signedUrlKeyResource", + ) + ) ) @@ -709,7 +738,11 @@ def test_add_signed_url_key_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.add_signed_url_key_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -720,7 +753,8 @@ def test_add_signed_url_key_unary_rest_bad_request( transport: str = "rest", request_type=compute.AddSignedUrlKeyBackendBucketRequest ): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -745,7 +779,8 @@ def test_add_signed_url_key_unary_rest_bad_request( def test_add_signed_url_key_unary_rest_flattened(): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -787,7 +822,8 @@ def test_add_signed_url_key_unary_rest_flattened(): def test_add_signed_url_key_unary_rest_flattened_error(transport: str = "rest"): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -807,10 +843,17 @@ def test_add_signed_url_key_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.DeleteBackendBucketRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteBackendBucketRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -920,7 +963,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -961,7 +1005,13 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("backendBucket", "project",)) + set(("requestId",)) + & set( + ( + "backendBucket", + "project", + ) + ) ) @@ -1007,7 +1057,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1018,7 +1072,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteBackendBucketRequest ): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1039,7 +1094,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1052,7 +1108,8 @@ def test_delete_unary_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", backend_bucket="backend_bucket_value", + project="project_value", + backend_bucket="backend_bucket_value", ) mock_args.update(sample_request) @@ -1079,7 +1136,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1099,11 +1157,16 @@ def test_delete_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.DeleteSignedUrlKeyBackendBucketRequest, dict,] + "request_type", + [ + compute.DeleteSignedUrlKeyBackendBucketRequest, + dict, + ], ) def test_delete_signed_url_key_unary_rest(request_type): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1208,7 +1271,12 @@ def test_delete_signed_url_key_unary_rest_required_fields( credentials=ga_credentials.AnonymousCredentials() ).delete_signed_url_key._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("key_name", "request_id",)) + assert not set(unset_fields) - set( + ( + "key_name", + "request_id", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -1220,7 +1288,8 @@ def test_delete_signed_url_key_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1250,7 +1319,10 @@ def test_delete_signed_url_key_unary_rest_required_fields( response = client.delete_signed_url_key_unary(request) expected_params = [ - ("keyName", "",), + ( + "keyName", + "", + ), ] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -1263,7 +1335,19 @@ def test_delete_signed_url_key_unary_rest_unset_required_fields(): unset_fields = transport.delete_signed_url_key._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("keyName", "requestId",)) & set(("backendBucket", "keyName", "project",)) + set( + ( + "keyName", + "requestId", + ) + ) + & set( + ( + "backendBucket", + "keyName", + "project", + ) + ) ) @@ -1309,7 +1393,11 @@ def test_delete_signed_url_key_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_signed_url_key_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1320,7 +1408,8 @@ def test_delete_signed_url_key_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteSignedUrlKeyBackendBucketRequest ): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1341,7 +1430,8 @@ def test_delete_signed_url_key_unary_rest_bad_request( def test_delete_signed_url_key_unary_rest_flattened(): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1383,7 +1473,8 @@ def test_delete_signed_url_key_unary_rest_flattened(): def test_delete_signed_url_key_unary_rest_flattened_error(transport: str = "rest"): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1403,10 +1494,17 @@ def test_delete_signed_url_key_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetBackendBucketRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetBackendBucketRequest, + dict, + ], +) def test_get_rest(request_type): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1488,7 +1586,8 @@ def test_get_rest_required_fields(request_type=compute.GetBackendBucketRequest): assert jsonified_request["project"] == "project_value" client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1528,7 +1627,15 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("backendBucket", "project",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "backendBucket", + "project", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1574,7 +1681,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.BackendBucket - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1584,7 +1697,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetBackendBucketRequest ): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1605,7 +1719,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1618,7 +1733,8 @@ def test_get_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", backend_bucket="backend_bucket_value", + project="project_value", + backend_bucket="backend_bucket_value", ) mock_args.update(sample_request) @@ -1645,7 +1761,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1664,10 +1781,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertBackendBucketRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertBackendBucketRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1814,7 +1938,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1856,7 +1981,13 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("backendBucketResource", "project",)) + set(("requestId",)) + & set( + ( + "backendBucketResource", + "project", + ) + ) ) @@ -1902,7 +2033,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1913,7 +2048,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertBackendBucketRequest ): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1975,7 +2111,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2018,7 +2155,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2039,10 +2177,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListBackendBucketsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListBackendBucketsRequest, + dict, + ], +) def test_list_rest(request_type): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2103,7 +2248,13 @@ def test_list_rest_required_fields(request_type=compute.ListBackendBucketsReques ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -2112,7 +2263,8 @@ def test_list_rest_required_fields(request_type=compute.ListBackendBucketsReques assert jsonified_request["project"] == "project_value" client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2153,7 +2305,15 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set(("project",)) ) @@ -2201,7 +2361,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.BackendBucketList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2211,7 +2377,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListBackendBucketsRequest ): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2232,7 +2399,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2244,7 +2412,9 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2270,20 +2440,23 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list( - compute.ListBackendBucketsRequest(), project="project_value", + compute.ListBackendBucketsRequest(), + project="project_value", ) def test_list_rest_pager(transport: str = "rest"): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2300,12 +2473,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.BackendBucketList(items=[], next_page_token="def",), compute.BackendBucketList( - items=[compute.BackendBucket(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.BackendBucketList( - items=[compute.BackendBucket(), compute.BackendBucket(),], + items=[ + compute.BackendBucket(), + ], + next_page_token="ghi", + ), + compute.BackendBucketList( + items=[ + compute.BackendBucket(), + compute.BackendBucket(), + ], ), ) # Two responses for two calls @@ -2332,10 +2514,17 @@ def test_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.PatchBackendBucketRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.PatchBackendBucketRequest, + dict, + ], +) def test_patch_unary_rest(request_type): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2486,7 +2675,8 @@ def test_patch_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2529,7 +2719,13 @@ def test_patch_unary_rest_unset_required_fields(): unset_fields = transport.patch._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("backendBucket", "backendBucketResource", "project",)) + & set( + ( + "backendBucket", + "backendBucketResource", + "project", + ) + ) ) @@ -2574,7 +2770,13 @@ def test_patch_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.patch_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2584,7 +2786,8 @@ def test_patch_unary_rest_bad_request( transport: str = "rest", request_type=compute.PatchBackendBucketRequest ): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2646,7 +2849,8 @@ def test_patch_unary_rest_bad_request( def test_patch_unary_rest_flattened(): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2690,7 +2894,8 @@ def test_patch_unary_rest_flattened(): def test_patch_unary_rest_flattened_error(transport: str = "rest"): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2713,11 +2918,16 @@ def test_patch_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SetEdgeSecurityPolicyBackendBucketRequest, dict,] + "request_type", + [ + compute.SetEdgeSecurityPolicyBackendBucketRequest, + dict, + ], ) def test_set_edge_security_policy_unary_rest(request_type): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2830,7 +3040,8 @@ def test_set_edge_security_policy_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2873,7 +3084,13 @@ def test_set_edge_security_policy_unary_rest_unset_required_fields(): unset_fields = transport.set_edge_security_policy._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("backendBucket", "project", "securityPolicyReferenceResource",)) + & set( + ( + "backendBucket", + "project", + "securityPolicyReferenceResource", + ) + ) ) @@ -2919,7 +3136,11 @@ def test_set_edge_security_policy_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_edge_security_policy_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2931,7 +3152,8 @@ def test_set_edge_security_policy_unary_rest_bad_request( request_type=compute.SetEdgeSecurityPolicyBackendBucketRequest, ): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2955,7 +3177,8 @@ def test_set_edge_security_policy_unary_rest_bad_request( def test_set_edge_security_policy_unary_rest_flattened(): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2999,7 +3222,8 @@ def test_set_edge_security_policy_unary_rest_flattened(): def test_set_edge_security_policy_unary_rest_flattened_error(transport: str = "rest"): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3021,10 +3245,17 @@ def test_set_edge_security_policy_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.UpdateBackendBucketRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.UpdateBackendBucketRequest, + dict, + ], +) def test_update_unary_rest(request_type): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3175,7 +3406,8 @@ def test_update_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3218,7 +3450,13 @@ def test_update_unary_rest_unset_required_fields(): unset_fields = transport.update._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("backendBucket", "backendBucketResource", "project",)) + & set( + ( + "backendBucket", + "backendBucketResource", + "project", + ) + ) ) @@ -3264,7 +3502,11 @@ def test_update_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.update_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3275,7 +3517,8 @@ def test_update_unary_rest_bad_request( transport: str = "rest", request_type=compute.UpdateBackendBucketRequest ): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3337,7 +3580,8 @@ def test_update_unary_rest_bad_request( def test_update_unary_rest_flattened(): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3381,7 +3625,8 @@ def test_update_unary_rest_flattened(): def test_update_unary_rest_flattened_error(transport: str = "rest"): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3410,7 +3655,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -3430,7 +3676,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = BackendBucketsClient(client_options=options, transport=transport,) + client = BackendBucketsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -3446,7 +3695,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = BackendBucketsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -3459,7 +3709,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.BackendBucketsRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.BackendBucketsRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -3518,7 +3773,8 @@ def test_backend_buckets_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.BackendBucketsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -3568,7 +3824,12 @@ def test_backend_buckets_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_backend_buckets_host_no_port(transport_name): client = BackendBucketsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3584,7 +3845,12 @@ def test_backend_buckets_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_backend_buckets_host_with_port(transport_name): client = BackendBucketsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3622,7 +3888,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = BackendBucketsClient.common_folder_path(folder) assert expected == actual @@ -3640,7 +3908,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = BackendBucketsClient.common_organization_path(organization) assert expected == actual @@ -3658,7 +3928,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = BackendBucketsClient.common_project_path(project) assert expected == actual @@ -3678,7 +3950,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = BackendBucketsClient.common_location_path(project, location) assert expected == actual @@ -3703,7 +3976,8 @@ def test_client_with_default_client_info(): transports.BackendBucketsTransport, "_prep_wrapped_messages" ) as prep: client = BackendBucketsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3712,7 +3986,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = BackendBucketsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3752,7 +4027,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(BackendBucketsClient, transports.BackendBucketsRestTransport),], + [ + (BackendBucketsClient, transports.BackendBucketsRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_backend_services.py b/tests/unit/gapic/compute_v1/test_backend_services.py index 9b70aa34c..bd1b42f35 100644 --- a/tests/unit/gapic/compute_v1/test_backend_services.py +++ b/tests/unit/gapic/compute_v1/test_backend_services.py @@ -89,7 +89,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(BackendServicesClient, "rest"),] + "client_class,transport_name", + [ + (BackendServicesClient, "rest"), + ], ) def test_backend_services_client_from_service_account_info( client_class, transport_name @@ -113,7 +116,9 @@ def test_backend_services_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.BackendServicesRestTransport, "rest"),], + [ + (transports.BackendServicesRestTransport, "rest"), + ], ) def test_backend_services_client_service_account_always_use_jwt( transport_class, transport_name @@ -134,7 +139,10 @@ def test_backend_services_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(BackendServicesClient, "rest"),] + "client_class,transport_name", + [ + (BackendServicesClient, "rest"), + ], ) def test_backend_services_client_from_service_account_file( client_class, transport_name @@ -176,7 +184,9 @@ def test_backend_services_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(BackendServicesClient, transports.BackendServicesRestTransport, "rest"),], + [ + (BackendServicesClient, transports.BackendServicesRestTransport, "rest"), + ], ) @mock.patch.object( BackendServicesClient, @@ -469,13 +479,17 @@ def test_backend_services_client_get_mtls_endpoint_and_cert_source(client_class) @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(BackendServicesClient, transports.BackendServicesRestTransport, "rest"),], + [ + (BackendServicesClient, transports.BackendServicesRestTransport, "rest"), + ], ) def test_backend_services_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -493,7 +507,9 @@ def test_backend_services_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(BackendServicesClient, transports.BackendServicesRestTransport, "rest", None),], + [ + (BackendServicesClient, transports.BackendServicesRestTransport, "rest", None), + ], ) def test_backend_services_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -517,11 +533,16 @@ def test_backend_services_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.AddSignedUrlKeyBackendServiceRequest, dict,] + "request_type", + [ + compute.AddSignedUrlKeyBackendServiceRequest, + dict, + ], ) def test_add_signed_url_key_unary_rest(request_type): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -635,7 +656,8 @@ def test_add_signed_url_key_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -678,7 +700,13 @@ def test_add_signed_url_key_unary_rest_unset_required_fields(): unset_fields = transport.add_signed_url_key._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("backendService", "project", "signedUrlKeyResource",)) + & set( + ( + "backendService", + "project", + "signedUrlKeyResource", + ) + ) ) @@ -724,7 +752,11 @@ def test_add_signed_url_key_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.add_signed_url_key_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -735,7 +767,8 @@ def test_add_signed_url_key_unary_rest_bad_request( transport: str = "rest", request_type=compute.AddSignedUrlKeyBackendServiceRequest ): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -760,7 +793,8 @@ def test_add_signed_url_key_unary_rest_bad_request( def test_add_signed_url_key_unary_rest_flattened(): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -802,7 +836,8 @@ def test_add_signed_url_key_unary_rest_flattened(): def test_add_signed_url_key_unary_rest_flattened_error(transport: str = "rest"): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -823,11 +858,16 @@ def test_add_signed_url_key_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.AggregatedListBackendServicesRequest, dict,] + "request_type", + [ + compute.AggregatedListBackendServicesRequest, + dict, + ], ) def test_aggregated_list_rest(request_type): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -908,7 +948,8 @@ def test_aggregated_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1009,7 +1050,11 @@ def test_aggregated_list_rest_interceptors(null_interceptor): post.return_value = compute.BackendServiceAggregatedList client.aggregated_list( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1020,7 +1065,8 @@ def test_aggregated_list_rest_bad_request( transport: str = "rest", request_type=compute.AggregatedListBackendServicesRequest ): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1041,7 +1087,8 @@ def test_aggregated_list_rest_bad_request( def test_aggregated_list_rest_flattened(): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1053,7 +1100,9 @@ def test_aggregated_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1079,20 +1128,23 @@ def test_aggregated_list_rest_flattened(): def test_aggregated_list_rest_flattened_error(transport: str = "rest"): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.aggregated_list( - compute.AggregatedListBackendServicesRequest(), project="project_value", + compute.AggregatedListBackendServicesRequest(), + project="project_value", ) def test_aggregated_list_rest_pager(transport: str = "rest"): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1109,9 +1161,14 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): }, next_page_token="abc", ), - compute.BackendServiceAggregatedList(items={}, next_page_token="def",), compute.BackendServiceAggregatedList( - items={"g": compute.BackendServicesScopedList(),}, + items={}, + next_page_token="def", + ), + compute.BackendServiceAggregatedList( + items={ + "g": compute.BackendServicesScopedList(), + }, next_page_token="ghi", ), compute.BackendServiceAggregatedList( @@ -1159,10 +1216,17 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.DeleteBackendServiceRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteBackendServiceRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1272,7 +1336,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1313,7 +1378,13 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("backendService", "project",)) + set(("requestId",)) + & set( + ( + "backendService", + "project", + ) + ) ) @@ -1359,7 +1430,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1370,7 +1445,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteBackendServiceRequest ): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1391,7 +1467,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1404,7 +1481,8 @@ def test_delete_unary_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", backend_service="backend_service_value", + project="project_value", + backend_service="backend_service_value", ) mock_args.update(sample_request) @@ -1431,7 +1509,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1451,11 +1530,16 @@ def test_delete_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.DeleteSignedUrlKeyBackendServiceRequest, dict,] + "request_type", + [ + compute.DeleteSignedUrlKeyBackendServiceRequest, + dict, + ], ) def test_delete_signed_url_key_unary_rest(request_type): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1560,7 +1644,12 @@ def test_delete_signed_url_key_unary_rest_required_fields( credentials=ga_credentials.AnonymousCredentials() ).delete_signed_url_key._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("key_name", "request_id",)) + assert not set(unset_fields) - set( + ( + "key_name", + "request_id", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -1572,7 +1661,8 @@ def test_delete_signed_url_key_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1602,7 +1692,10 @@ def test_delete_signed_url_key_unary_rest_required_fields( response = client.delete_signed_url_key_unary(request) expected_params = [ - ("keyName", "",), + ( + "keyName", + "", + ), ] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -1615,7 +1708,19 @@ def test_delete_signed_url_key_unary_rest_unset_required_fields(): unset_fields = transport.delete_signed_url_key._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("keyName", "requestId",)) & set(("backendService", "keyName", "project",)) + set( + ( + "keyName", + "requestId", + ) + ) + & set( + ( + "backendService", + "keyName", + "project", + ) + ) ) @@ -1661,7 +1766,11 @@ def test_delete_signed_url_key_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_signed_url_key_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1673,7 +1782,8 @@ def test_delete_signed_url_key_unary_rest_bad_request( request_type=compute.DeleteSignedUrlKeyBackendServiceRequest, ): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1694,7 +1804,8 @@ def test_delete_signed_url_key_unary_rest_bad_request( def test_delete_signed_url_key_unary_rest_flattened(): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1736,7 +1847,8 @@ def test_delete_signed_url_key_unary_rest_flattened(): def test_delete_signed_url_key_unary_rest_flattened_error(transport: str = "rest"): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1756,10 +1868,17 @@ def test_delete_signed_url_key_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetBackendServiceRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetBackendServiceRequest, + dict, + ], +) def test_get_rest(request_type): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1867,7 +1986,8 @@ def test_get_rest_required_fields(request_type=compute.GetBackendServiceRequest) assert jsonified_request["project"] == "project_value" client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1907,7 +2027,15 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("backendService", "project",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "backendService", + "project", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1953,7 +2081,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.BackendService - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1963,7 +2097,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetBackendServiceRequest ): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1984,7 +2119,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1997,7 +2133,8 @@ def test_get_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", backend_service="backend_service_value", + project="project_value", + backend_service="backend_service_value", ) mock_args.update(sample_request) @@ -2024,7 +2161,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2044,11 +2182,16 @@ def test_get_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.GetHealthBackendServiceRequest, dict,] + "request_type", + [ + compute.GetHealthBackendServiceRequest, + dict, + ], ) def test_get_health_rest(request_type): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2059,7 +2202,9 @@ def test_get_health_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = compute.BackendServiceGroupHealth(kind="kind_value",) + return_value = compute.BackendServiceGroupHealth( + kind="kind_value", + ) # Wrap the value into a proper Response obj response_value = Response() @@ -2113,7 +2258,8 @@ def test_get_health_rest_required_fields( assert jsonified_request["project"] == "project_value" client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2155,7 +2301,14 @@ def test_get_health_rest_unset_required_fields(): unset_fields = transport.get_health._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("backendService", "project", "resourceGroupReferenceResource",)) + set(()) + & set( + ( + "backendService", + "project", + "resourceGroupReferenceResource", + ) + ) ) @@ -2202,7 +2355,13 @@ def test_get_health_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.BackendServiceGroupHealth - client.get_health(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get_health( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2212,7 +2371,8 @@ def test_get_health_rest_bad_request( transport: str = "rest", request_type=compute.GetHealthBackendServiceRequest ): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2234,7 +2394,8 @@ def test_get_health_rest_bad_request( def test_get_health_rest_flattened(): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2278,7 +2439,8 @@ def test_get_health_rest_flattened(): def test_get_health_rest_flattened_error(transport: str = "rest"): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2300,10 +2462,17 @@ def test_get_health_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertBackendServiceRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertBackendServiceRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2549,7 +2718,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2591,7 +2761,13 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("backendServiceResource", "project",)) + set(("requestId",)) + & set( + ( + "backendServiceResource", + "project", + ) + ) ) @@ -2637,7 +2813,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2648,7 +2828,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertBackendServiceRequest ): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2809,7 +2990,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2852,7 +3034,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2873,10 +3056,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListBackendServicesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListBackendServicesRequest, + dict, + ], +) def test_list_rest(request_type): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2937,7 +3127,13 @@ def test_list_rest_required_fields(request_type=compute.ListBackendServicesReque ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -2946,7 +3142,8 @@ def test_list_rest_required_fields(request_type=compute.ListBackendServicesReque assert jsonified_request["project"] == "project_value" client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2987,7 +3184,15 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set(("project",)) ) @@ -3035,7 +3240,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.BackendServiceList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -3045,7 +3256,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListBackendServicesRequest ): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3066,7 +3278,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3078,7 +3291,9 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -3104,20 +3319,23 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list( - compute.ListBackendServicesRequest(), project="project_value", + compute.ListBackendServicesRequest(), + project="project_value", ) def test_list_rest_pager(transport: str = "rest"): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -3134,12 +3352,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.BackendServiceList(items=[], next_page_token="def",), compute.BackendServiceList( - items=[compute.BackendService(),], next_page_token="ghi", + items=[], + next_page_token="def", + ), + compute.BackendServiceList( + items=[ + compute.BackendService(), + ], + next_page_token="ghi", ), compute.BackendServiceList( - items=[compute.BackendService(), compute.BackendService(),], + items=[ + compute.BackendService(), + compute.BackendService(), + ], ), ) # Two responses for two calls @@ -3166,10 +3393,17 @@ def test_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.PatchBackendServiceRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.PatchBackendServiceRequest, + dict, + ], +) def test_patch_unary_rest(request_type): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3419,7 +3653,8 @@ def test_patch_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3462,7 +3697,13 @@ def test_patch_unary_rest_unset_required_fields(): unset_fields = transport.patch._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("backendService", "backendServiceResource", "project",)) + & set( + ( + "backendService", + "backendServiceResource", + "project", + ) + ) ) @@ -3507,7 +3748,13 @@ def test_patch_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.patch_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -3517,7 +3764,8 @@ def test_patch_unary_rest_bad_request( transport: str = "rest", request_type=compute.PatchBackendServiceRequest ): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3678,7 +3926,8 @@ def test_patch_unary_rest_bad_request( def test_patch_unary_rest_flattened(): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3722,7 +3971,8 @@ def test_patch_unary_rest_flattened(): def test_patch_unary_rest_flattened_error(transport: str = "rest"): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3745,11 +3995,16 @@ def test_patch_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SetEdgeSecurityPolicyBackendServiceRequest, dict,] + "request_type", + [ + compute.SetEdgeSecurityPolicyBackendServiceRequest, + dict, + ], ) def test_set_edge_security_policy_unary_rest(request_type): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3862,7 +4117,8 @@ def test_set_edge_security_policy_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3905,7 +4161,13 @@ def test_set_edge_security_policy_unary_rest_unset_required_fields(): unset_fields = transport.set_edge_security_policy._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("backendService", "project", "securityPolicyReferenceResource",)) + & set( + ( + "backendService", + "project", + "securityPolicyReferenceResource", + ) + ) ) @@ -3951,7 +4213,11 @@ def test_set_edge_security_policy_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_edge_security_policy_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3963,7 +4229,8 @@ def test_set_edge_security_policy_unary_rest_bad_request( request_type=compute.SetEdgeSecurityPolicyBackendServiceRequest, ): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3987,7 +4254,8 @@ def test_set_edge_security_policy_unary_rest_bad_request( def test_set_edge_security_policy_unary_rest_flattened(): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -4031,7 +4299,8 @@ def test_set_edge_security_policy_unary_rest_flattened(): def test_set_edge_security_policy_unary_rest_flattened_error(transport: str = "rest"): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -4054,11 +4323,16 @@ def test_set_edge_security_policy_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SetSecurityPolicyBackendServiceRequest, dict,] + "request_type", + [ + compute.SetSecurityPolicyBackendServiceRequest, + dict, + ], ) def test_set_security_policy_unary_rest(request_type): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -4171,7 +4445,8 @@ def test_set_security_policy_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -4214,7 +4489,13 @@ def test_set_security_policy_unary_rest_unset_required_fields(): unset_fields = transport.set_security_policy._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("backendService", "project", "securityPolicyReferenceResource",)) + & set( + ( + "backendService", + "project", + "securityPolicyReferenceResource", + ) + ) ) @@ -4260,7 +4541,11 @@ def test_set_security_policy_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_security_policy_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -4271,7 +4556,8 @@ def test_set_security_policy_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetSecurityPolicyBackendServiceRequest ): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -4295,7 +4581,8 @@ def test_set_security_policy_unary_rest_bad_request( def test_set_security_policy_unary_rest_flattened(): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -4339,7 +4626,8 @@ def test_set_security_policy_unary_rest_flattened(): def test_set_security_policy_unary_rest_flattened_error(transport: str = "rest"): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -4361,10 +4649,17 @@ def test_set_security_policy_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.UpdateBackendServiceRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.UpdateBackendServiceRequest, + dict, + ], +) def test_update_unary_rest(request_type): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -4614,7 +4909,8 @@ def test_update_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -4657,7 +4953,13 @@ def test_update_unary_rest_unset_required_fields(): unset_fields = transport.update._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("backendService", "backendServiceResource", "project",)) + & set( + ( + "backendService", + "backendServiceResource", + "project", + ) + ) ) @@ -4703,7 +5005,11 @@ def test_update_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.update_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -4714,7 +5020,8 @@ def test_update_unary_rest_bad_request( transport: str = "rest", request_type=compute.UpdateBackendServiceRequest ): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -4875,7 +5182,8 @@ def test_update_unary_rest_bad_request( def test_update_unary_rest_flattened(): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -4919,7 +5227,8 @@ def test_update_unary_rest_flattened(): def test_update_unary_rest_flattened_error(transport: str = "rest"): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -4948,7 +5257,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -4968,7 +5278,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = BackendServicesClient(client_options=options, transport=transport,) + client = BackendServicesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -4984,7 +5297,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = BackendServicesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -4997,7 +5311,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.BackendServicesRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.BackendServicesRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -5059,7 +5378,8 @@ def test_backend_services_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.BackendServicesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -5109,7 +5429,12 @@ def test_backend_services_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_backend_services_host_no_port(transport_name): client = BackendServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5125,7 +5450,12 @@ def test_backend_services_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_backend_services_host_with_port(transport_name): client = BackendServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5163,7 +5493,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = BackendServicesClient.common_folder_path(folder) assert expected == actual @@ -5181,7 +5513,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = BackendServicesClient.common_organization_path(organization) assert expected == actual @@ -5199,7 +5533,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = BackendServicesClient.common_project_path(project) assert expected == actual @@ -5219,7 +5555,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = BackendServicesClient.common_location_path(project, location) assert expected == actual @@ -5244,7 +5581,8 @@ def test_client_with_default_client_info(): transports.BackendServicesTransport, "_prep_wrapped_messages" ) as prep: client = BackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -5253,7 +5591,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = BackendServicesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -5293,7 +5632,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(BackendServicesClient, transports.BackendServicesRestTransport),], + [ + (BackendServicesClient, transports.BackendServicesRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_disk_types.py b/tests/unit/gapic/compute_v1/test_disk_types.py index 42b70d0fa..abec82e38 100644 --- a/tests/unit/gapic/compute_v1/test_disk_types.py +++ b/tests/unit/gapic/compute_v1/test_disk_types.py @@ -83,7 +83,12 @@ def test__get_default_mtls_endpoint(): assert DiskTypesClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class,transport_name", [(DiskTypesClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (DiskTypesClient, "rest"), + ], +) def test_disk_types_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -103,7 +108,10 @@ def test_disk_types_client_from_service_account_info(client_class, transport_nam @pytest.mark.parametrize( - "transport_class,transport_name", [(transports.DiskTypesRestTransport, "rest"),] + "transport_class,transport_name", + [ + (transports.DiskTypesRestTransport, "rest"), + ], ) def test_disk_types_client_service_account_always_use_jwt( transport_class, transport_name @@ -123,7 +131,12 @@ def test_disk_types_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class,transport_name", [(DiskTypesClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (DiskTypesClient, "rest"), + ], +) def test_disk_types_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -162,7 +175,9 @@ def test_disk_types_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(DiskTypesClient, transports.DiskTypesRestTransport, "rest"),], + [ + (DiskTypesClient, transports.DiskTypesRestTransport, "rest"), + ], ) @mock.patch.object( DiskTypesClient, "DEFAULT_ENDPOINT", modify_default_endpoint(DiskTypesClient) @@ -439,13 +454,17 @@ def test_disk_types_client_get_mtls_endpoint_and_cert_source(client_class): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(DiskTypesClient, transports.DiskTypesRestTransport, "rest"),], + [ + (DiskTypesClient, transports.DiskTypesRestTransport, "rest"), + ], ) def test_disk_types_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -463,7 +482,9 @@ def test_disk_types_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(DiskTypesClient, transports.DiskTypesRestTransport, "rest", None),], + [ + (DiskTypesClient, transports.DiskTypesRestTransport, "rest", None), + ], ) def test_disk_types_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -487,11 +508,16 @@ def test_disk_types_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.AggregatedListDiskTypesRequest, dict,] + "request_type", + [ + compute.AggregatedListDiskTypesRequest, + dict, + ], ) def test_aggregated_list_rest(request_type): client = DiskTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -572,7 +598,8 @@ def test_aggregated_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = DiskTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -669,7 +696,11 @@ def test_aggregated_list_rest_interceptors(null_interceptor): post.return_value = compute.DiskTypeAggregatedList client.aggregated_list( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -680,7 +711,8 @@ def test_aggregated_list_rest_bad_request( transport: str = "rest", request_type=compute.AggregatedListDiskTypesRequest ): client = DiskTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -701,7 +733,8 @@ def test_aggregated_list_rest_bad_request( def test_aggregated_list_rest_flattened(): client = DiskTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -713,7 +746,9 @@ def test_aggregated_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -739,20 +774,23 @@ def test_aggregated_list_rest_flattened(): def test_aggregated_list_rest_flattened_error(transport: str = "rest"): client = DiskTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.aggregated_list( - compute.AggregatedListDiskTypesRequest(), project="project_value", + compute.AggregatedListDiskTypesRequest(), + project="project_value", ) def test_aggregated_list_rest_pager(transport: str = "rest"): client = DiskTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -769,9 +807,15 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): }, next_page_token="abc", ), - compute.DiskTypeAggregatedList(items={}, next_page_token="def",), compute.DiskTypeAggregatedList( - items={"g": compute.DiskTypesScopedList(),}, next_page_token="ghi", + items={}, + next_page_token="def", + ), + compute.DiskTypeAggregatedList( + items={ + "g": compute.DiskTypesScopedList(), + }, + next_page_token="ghi", ), compute.DiskTypeAggregatedList( items={ @@ -813,10 +857,17 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.GetDiskTypeRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetDiskTypeRequest, + dict, + ], +) def test_get_rest(request_type): client = DiskTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -902,7 +953,8 @@ def test_get_rest_required_fields(request_type=compute.GetDiskTypeRequest): assert jsonified_request["zone"] == "zone_value" client = DiskTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -942,7 +994,16 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("diskType", "project", "zone",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "diskType", + "project", + "zone", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -984,7 +1045,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.DiskType - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -994,7 +1061,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetDiskTypeRequest ): client = DiskTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1015,7 +1083,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = DiskTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1032,7 +1101,9 @@ def test_get_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", zone="zone_value", disk_type="disk_type_value", + project="project_value", + zone="zone_value", + disk_type="disk_type_value", ) mock_args.update(sample_request) @@ -1059,7 +1130,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = DiskTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1079,10 +1151,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListDiskTypesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListDiskTypesRequest, + dict, + ], +) def test_list_rest(request_type): client = DiskTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1145,7 +1224,13 @@ def test_list_rest_required_fields(request_type=compute.ListDiskTypesRequest): ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1156,7 +1241,8 @@ def test_list_rest_required_fields(request_type=compute.ListDiskTypesRequest): assert jsonified_request["zone"] == "zone_value" client = DiskTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1197,8 +1283,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "zone",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "zone", + ) + ) ) @@ -1241,7 +1340,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.DiskTypeList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1251,7 +1356,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListDiskTypesRequest ): client = DiskTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1272,7 +1378,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = DiskTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1284,7 +1391,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "zone": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", zone="zone_value",) + mock_args = dict( + project="project_value", + zone="zone_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1310,20 +1420,24 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = DiskTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list( - compute.ListDiskTypesRequest(), project="project_value", zone="zone_value", + compute.ListDiskTypesRequest(), + project="project_value", + zone="zone_value", ) def test_list_rest_pager(transport: str = "rest"): client = DiskTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1333,12 +1447,29 @@ def test_list_rest_pager(transport: str = "rest"): # Set the response as a series of pages response = ( compute.DiskTypeList( - items=[compute.DiskType(), compute.DiskType(), compute.DiskType(),], + items=[ + compute.DiskType(), + compute.DiskType(), + compute.DiskType(), + ], next_page_token="abc", ), - compute.DiskTypeList(items=[], next_page_token="def",), - compute.DiskTypeList(items=[compute.DiskType(),], next_page_token="ghi",), - compute.DiskTypeList(items=[compute.DiskType(), compute.DiskType(),],), + compute.DiskTypeList( + items=[], + next_page_token="def", + ), + compute.DiskTypeList( + items=[ + compute.DiskType(), + ], + next_page_token="ghi", + ), + compute.DiskTypeList( + items=[ + compute.DiskType(), + compute.DiskType(), + ], + ), ) # Two responses for two calls response = response + response @@ -1371,7 +1502,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = DiskTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1391,7 +1523,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = DiskTypesClient(client_options=options, transport=transport,) + client = DiskTypesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1407,7 +1542,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = DiskTypesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1420,7 +1556,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.DiskTypesRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.DiskTypesRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -1473,7 +1614,8 @@ def test_disk_types_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.DiskTypesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1525,7 +1667,12 @@ def test_disk_types_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_disk_types_host_no_port(transport_name): client = DiskTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1541,7 +1688,12 @@ def test_disk_types_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_disk_types_host_with_port(transport_name): client = DiskTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1579,7 +1731,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = DiskTypesClient.common_folder_path(folder) assert expected == actual @@ -1597,7 +1751,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = DiskTypesClient.common_organization_path(organization) assert expected == actual @@ -1615,7 +1771,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = DiskTypesClient.common_project_path(project) assert expected == actual @@ -1635,7 +1793,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = DiskTypesClient.common_location_path(project, location) assert expected == actual @@ -1660,7 +1819,8 @@ def test_client_with_default_client_info(): transports.DiskTypesTransport, "_prep_wrapped_messages" ) as prep: client = DiskTypesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1669,7 +1829,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = DiskTypesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1709,7 +1870,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(DiskTypesClient, transports.DiskTypesRestTransport),], + [ + (DiskTypesClient, transports.DiskTypesRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_disks.py b/tests/unit/gapic/compute_v1/test_disks.py index 392007fa7..d0d27bcbe 100644 --- a/tests/unit/gapic/compute_v1/test_disks.py +++ b/tests/unit/gapic/compute_v1/test_disks.py @@ -82,7 +82,12 @@ def test__get_default_mtls_endpoint(): assert DisksClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class,transport_name", [(DisksClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (DisksClient, "rest"), + ], +) def test_disks_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -102,7 +107,10 @@ def test_disks_client_from_service_account_info(client_class, transport_name): @pytest.mark.parametrize( - "transport_class,transport_name", [(transports.DisksRestTransport, "rest"),] + "transport_class,transport_name", + [ + (transports.DisksRestTransport, "rest"), + ], ) def test_disks_client_service_account_always_use_jwt(transport_class, transport_name): with mock.patch.object( @@ -120,7 +128,12 @@ def test_disks_client_service_account_always_use_jwt(transport_class, transport_ use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class,transport_name", [(DisksClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (DisksClient, "rest"), + ], +) def test_disks_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -159,7 +172,9 @@ def test_disks_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(DisksClient, transports.DisksRestTransport, "rest"),], + [ + (DisksClient, transports.DisksRestTransport, "rest"), + ], ) @mock.patch.object( DisksClient, "DEFAULT_ENDPOINT", modify_default_endpoint(DisksClient) @@ -434,13 +449,17 @@ def test_disks_client_get_mtls_endpoint_and_cert_source(client_class): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(DisksClient, transports.DisksRestTransport, "rest"),], + [ + (DisksClient, transports.DisksRestTransport, "rest"), + ], ) def test_disks_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -458,7 +477,9 @@ def test_disks_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(DisksClient, transports.DisksRestTransport, "rest", None),], + [ + (DisksClient, transports.DisksRestTransport, "rest", None), + ], ) def test_disks_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -482,11 +503,16 @@ def test_disks_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.AddResourcePoliciesDiskRequest, dict,] + "request_type", + [ + compute.AddResourcePoliciesDiskRequest, + dict, + ], ) def test_add_resource_policies_unary_rest(request_type): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -603,7 +629,8 @@ def test_add_resource_policies_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -646,7 +673,14 @@ def test_add_resource_policies_unary_rest_unset_required_fields(): unset_fields = transport.add_resource_policies._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("disk", "disksAddResourcePoliciesRequestResource", "project", "zone",)) + & set( + ( + "disk", + "disksAddResourcePoliciesRequestResource", + "project", + "zone", + ) + ) ) @@ -690,7 +724,11 @@ def test_add_resource_policies_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.add_resource_policies_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -701,7 +739,8 @@ def test_add_resource_policies_unary_rest_bad_request( transport: str = "rest", request_type=compute.AddResourcePoliciesDiskRequest ): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -725,7 +764,8 @@ def test_add_resource_policies_unary_rest_bad_request( def test_add_resource_policies_unary_rest_flattened(): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -770,7 +810,8 @@ def test_add_resource_policies_unary_rest_flattened(): def test_add_resource_policies_unary_rest_flattened_error(transport: str = "rest"): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -793,10 +834,17 @@ def test_add_resource_policies_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.AggregatedListDisksRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.AggregatedListDisksRequest, + dict, + ], +) def test_aggregated_list_rest(request_type): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -877,7 +925,8 @@ def test_aggregated_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -974,7 +1023,11 @@ def test_aggregated_list_rest_interceptors(null_interceptor): post.return_value = compute.DiskAggregatedList client.aggregated_list( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -985,7 +1038,8 @@ def test_aggregated_list_rest_bad_request( transport: str = "rest", request_type=compute.AggregatedListDisksRequest ): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1006,7 +1060,8 @@ def test_aggregated_list_rest_bad_request( def test_aggregated_list_rest_flattened(): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1018,7 +1073,9 @@ def test_aggregated_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1044,20 +1101,23 @@ def test_aggregated_list_rest_flattened(): def test_aggregated_list_rest_flattened_error(transport: str = "rest"): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.aggregated_list( - compute.AggregatedListDisksRequest(), project="project_value", + compute.AggregatedListDisksRequest(), + project="project_value", ) def test_aggregated_list_rest_pager(transport: str = "rest"): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1074,12 +1134,21 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): }, next_page_token="abc", ), - compute.DiskAggregatedList(items={}, next_page_token="def",), compute.DiskAggregatedList( - items={"g": compute.DisksScopedList(),}, next_page_token="ghi", + items={}, + next_page_token="def", ), compute.DiskAggregatedList( - items={"h": compute.DisksScopedList(), "i": compute.DisksScopedList(),}, + items={ + "g": compute.DisksScopedList(), + }, + next_page_token="ghi", + ), + compute.DiskAggregatedList( + items={ + "h": compute.DisksScopedList(), + "i": compute.DisksScopedList(), + }, ), ) # Two responses for two calls @@ -1115,10 +1184,17 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.CreateSnapshotDiskRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.CreateSnapshotDiskRequest, + dict, + ], +) def test_create_snapshot_unary_rest(request_type): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1252,7 +1328,12 @@ def test_create_snapshot_unary_rest_required_fields( credentials=ga_credentials.AnonymousCredentials() ).create_snapshot._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("guest_flush", "request_id",)) + assert not set(unset_fields) - set( + ( + "guest_flush", + "request_id", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -1264,7 +1345,8 @@ def test_create_snapshot_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1306,8 +1388,20 @@ def test_create_snapshot_unary_rest_unset_required_fields(): unset_fields = transport.create_snapshot._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("guestFlush", "requestId",)) - & set(("disk", "project", "snapshotResource", "zone",)) + set( + ( + "guestFlush", + "requestId", + ) + ) + & set( + ( + "disk", + "project", + "snapshotResource", + "zone", + ) + ) ) @@ -1351,7 +1445,11 @@ def test_create_snapshot_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.create_snapshot_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1362,7 +1460,8 @@ def test_create_snapshot_unary_rest_bad_request( transport: str = "rest", request_type=compute.CreateSnapshotDiskRequest ): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1415,7 +1514,8 @@ def test_create_snapshot_unary_rest_bad_request( def test_create_snapshot_unary_rest_flattened(): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1458,7 +1558,8 @@ def test_create_snapshot_unary_rest_flattened(): def test_create_snapshot_unary_rest_flattened_error(transport: str = "rest"): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1479,10 +1580,17 @@ def test_create_snapshot_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.DeleteDiskRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteDiskRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1594,7 +1702,8 @@ def test_delete_unary_rest_required_fields(request_type=compute.DeleteDiskReques assert jsonified_request["zone"] == "zone_value" client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1635,7 +1744,14 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("disk", "project", "zone",)) + set(("requestId",)) + & set( + ( + "disk", + "project", + "zone", + ) + ) ) @@ -1679,7 +1795,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1690,7 +1810,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteDiskRequest ): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1711,7 +1832,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1723,7 +1845,11 @@ def test_delete_unary_rest_flattened(): sample_request = {"project": "sample1", "zone": "sample2", "disk": "sample3"} # get truthy value for each flattened field - mock_args = dict(project="project_value", zone="zone_value", disk="disk_value",) + mock_args = dict( + project="project_value", + zone="zone_value", + disk="disk_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1749,7 +1875,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1769,10 +1896,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetDiskRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetDiskRequest, + dict, + ], +) def test_get_rest(request_type): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1900,7 +2034,8 @@ def test_get_rest_required_fields(request_type=compute.GetDiskRequest): assert jsonified_request["zone"] == "zone_value" client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1940,7 +2075,16 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("disk", "project", "zone",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "disk", + "project", + "zone", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1982,7 +2126,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Disk - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1992,7 +2142,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetDiskRequest ): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2013,7 +2164,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2025,7 +2177,11 @@ def test_get_rest_flattened(): sample_request = {"project": "sample1", "zone": "sample2", "disk": "sample3"} # get truthy value for each flattened field - mock_args = dict(project="project_value", zone="zone_value", disk="disk_value",) + mock_args = dict( + project="project_value", + zone="zone_value", + disk="disk_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2051,7 +2207,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2071,10 +2228,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetIamPolicyDiskRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetIamPolicyDiskRequest, + dict, + ], +) def test_get_iam_policy_rest(request_type): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2084,7 +2248,11 @@ def test_get_iam_policy_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = compute.Policy(etag="etag_value", iam_owned=True, version=774,) + return_value = compute.Policy( + etag="etag_value", + iam_owned=True, + version=774, + ) # Wrap the value into a proper Response obj response_value = Response() @@ -2146,7 +2314,8 @@ def test_get_iam_policy_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2187,7 +2356,14 @@ def test_get_iam_policy_rest_unset_required_fields(): unset_fields = transport.get_iam_policy._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("optionsRequestedPolicyVersion",)) & set(("project", "resource", "zone",)) + set(("optionsRequestedPolicyVersion",)) + & set( + ( + "project", + "resource", + "zone", + ) + ) ) @@ -2231,7 +2407,11 @@ def test_get_iam_policy_rest_interceptors(null_interceptor): post.return_value = compute.Policy client.get_iam_policy( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2242,7 +2422,8 @@ def test_get_iam_policy_rest_bad_request( transport: str = "rest", request_type=compute.GetIamPolicyDiskRequest ): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2263,7 +2444,8 @@ def test_get_iam_policy_rest_bad_request( def test_get_iam_policy_rest_flattened(): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2280,7 +2462,9 @@ def test_get_iam_policy_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", zone="zone_value", resource="resource_value", + project="project_value", + zone="zone_value", + resource="resource_value", ) mock_args.update(sample_request) @@ -2307,7 +2491,8 @@ def test_get_iam_policy_rest_flattened(): def test_get_iam_policy_rest_flattened_error(transport: str = "rest"): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2327,10 +2512,17 @@ def test_get_iam_policy_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertDiskRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertDiskRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2472,7 +2664,12 @@ def test_insert_unary_rest_required_fields(request_type=compute.InsertDiskReques credentials=ga_credentials.AnonymousCredentials() ).insert._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("request_id", "source_image",)) + assert not set(unset_fields) - set( + ( + "request_id", + "source_image", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -2482,7 +2679,8 @@ def test_insert_unary_rest_required_fields(request_type=compute.InsertDiskReques assert jsonified_request["zone"] == "zone_value" client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2524,7 +2722,19 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId", "sourceImage",)) & set(("diskResource", "project", "zone",)) + set( + ( + "requestId", + "sourceImage", + ) + ) + & set( + ( + "diskResource", + "project", + "zone", + ) + ) ) @@ -2568,7 +2778,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2579,7 +2793,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertDiskRequest ): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2644,7 +2859,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2686,7 +2902,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2706,10 +2923,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListDisksRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListDisksRequest, + dict, + ], +) def test_list_rest(request_type): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2772,7 +2996,13 @@ def test_list_rest_required_fields(request_type=compute.ListDisksRequest): ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -2783,7 +3013,8 @@ def test_list_rest_required_fields(request_type=compute.ListDisksRequest): assert jsonified_request["zone"] == "zone_value" client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2824,8 +3055,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "zone",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "zone", + ) + ) ) @@ -2868,7 +3112,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.DiskList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2878,7 +3128,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListDisksRequest ): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2899,7 +3150,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2911,7 +3163,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "zone": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", zone="zone_value",) + mock_args = dict( + project="project_value", + zone="zone_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2937,20 +3192,24 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list( - compute.ListDisksRequest(), project="project_value", zone="zone_value", + compute.ListDisksRequest(), + project="project_value", + zone="zone_value", ) def test_list_rest_pager(transport: str = "rest"): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2960,12 +3219,29 @@ def test_list_rest_pager(transport: str = "rest"): # Set the response as a series of pages response = ( compute.DiskList( - items=[compute.Disk(), compute.Disk(), compute.Disk(),], + items=[ + compute.Disk(), + compute.Disk(), + compute.Disk(), + ], next_page_token="abc", ), - compute.DiskList(items=[], next_page_token="def",), - compute.DiskList(items=[compute.Disk(),], next_page_token="ghi",), - compute.DiskList(items=[compute.Disk(), compute.Disk(),],), + compute.DiskList( + items=[], + next_page_token="def", + ), + compute.DiskList( + items=[ + compute.Disk(), + ], + next_page_token="ghi", + ), + compute.DiskList( + items=[ + compute.Disk(), + compute.Disk(), + ], + ), ) # Two responses for two calls response = response + response @@ -2992,11 +3268,16 @@ def test_list_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.RemoveResourcePoliciesDiskRequest, dict,] + "request_type", + [ + compute.RemoveResourcePoliciesDiskRequest, + dict, + ], ) def test_remove_resource_policies_unary_rest(request_type): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3113,7 +3394,8 @@ def test_remove_resource_policies_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3157,7 +3439,12 @@ def test_remove_resource_policies_unary_rest_unset_required_fields(): assert set(unset_fields) == ( set(("requestId",)) & set( - ("disk", "disksRemoveResourcePoliciesRequestResource", "project", "zone",) + ( + "disk", + "disksRemoveResourcePoliciesRequestResource", + "project", + "zone", + ) ) ) @@ -3202,7 +3489,11 @@ def test_remove_resource_policies_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.remove_resource_policies_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3213,7 +3504,8 @@ def test_remove_resource_policies_unary_rest_bad_request( transport: str = "rest", request_type=compute.RemoveResourcePoliciesDiskRequest ): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3237,7 +3529,8 @@ def test_remove_resource_policies_unary_rest_bad_request( def test_remove_resource_policies_unary_rest_flattened(): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3282,7 +3575,8 @@ def test_remove_resource_policies_unary_rest_flattened(): def test_remove_resource_policies_unary_rest_flattened_error(transport: str = "rest"): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3305,10 +3599,17 @@ def test_remove_resource_policies_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ResizeDiskRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ResizeDiskRequest, + dict, + ], +) def test_resize_unary_rest(request_type): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3421,7 +3722,8 @@ def test_resize_unary_rest_required_fields(request_type=compute.ResizeDiskReques assert jsonified_request["zone"] == "zone_value" client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3464,7 +3766,14 @@ def test_resize_unary_rest_unset_required_fields(): unset_fields = transport.resize._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("disk", "disksResizeRequestResource", "project", "zone",)) + & set( + ( + "disk", + "disksResizeRequestResource", + "project", + "zone", + ) + ) ) @@ -3508,7 +3817,11 @@ def test_resize_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.resize_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3519,7 +3832,8 @@ def test_resize_unary_rest_bad_request( transport: str = "rest", request_type=compute.ResizeDiskRequest ): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3541,7 +3855,8 @@ def test_resize_unary_rest_bad_request( def test_resize_unary_rest_flattened(): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3584,7 +3899,8 @@ def test_resize_unary_rest_flattened(): def test_resize_unary_rest_flattened_error(transport: str = "rest"): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3605,10 +3921,17 @@ def test_resize_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.SetIamPolicyDiskRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.SetIamPolicyDiskRequest, + dict, + ], +) def test_set_iam_policy_rest(request_type): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3695,7 +4018,11 @@ def test_set_iam_policy_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = compute.Policy(etag="etag_value", iam_owned=True, version=774,) + return_value = compute.Policy( + etag="etag_value", + iam_owned=True, + version=774, + ) # Wrap the value into a proper Response obj response_value = Response() @@ -3755,7 +4082,8 @@ def test_set_iam_policy_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3797,7 +4125,15 @@ def test_set_iam_policy_rest_unset_required_fields(): unset_fields = transport.set_iam_policy._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("project", "resource", "zone", "zoneSetPolicyRequestResource",)) + set(()) + & set( + ( + "project", + "resource", + "zone", + "zoneSetPolicyRequestResource", + ) + ) ) @@ -3841,7 +4177,11 @@ def test_set_iam_policy_rest_interceptors(null_interceptor): post.return_value = compute.Policy client.set_iam_policy( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3852,7 +4192,8 @@ def test_set_iam_policy_rest_bad_request( transport: str = "rest", request_type=compute.SetIamPolicyDiskRequest ): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3950,7 +4291,8 @@ def test_set_iam_policy_rest_bad_request( def test_set_iam_policy_rest_flattened(): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3999,7 +4341,8 @@ def test_set_iam_policy_rest_flattened(): def test_set_iam_policy_rest_flattened_error(transport: str = "rest"): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -4022,10 +4365,17 @@ def test_set_iam_policy_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.SetLabelsDiskRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.SetLabelsDiskRequest, + dict, + ], +) def test_set_labels_unary_rest(request_type): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -4143,7 +4493,8 @@ def test_set_labels_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -4186,7 +4537,14 @@ def test_set_labels_unary_rest_unset_required_fields(): unset_fields = transport.set_labels._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("project", "resource", "zone", "zoneSetLabelsRequestResource",)) + & set( + ( + "project", + "resource", + "zone", + "zoneSetLabelsRequestResource", + ) + ) ) @@ -4230,7 +4588,11 @@ def test_set_labels_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_labels_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -4241,7 +4603,8 @@ def test_set_labels_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetLabelsDiskRequest ): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -4266,7 +4629,8 @@ def test_set_labels_unary_rest_bad_request( def test_set_labels_unary_rest_flattened(): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -4315,7 +4679,8 @@ def test_set_labels_unary_rest_flattened(): def test_set_labels_unary_rest_flattened_error(transport: str = "rest"): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -4338,10 +4703,17 @@ def test_set_labels_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.TestIamPermissionsDiskRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.TestIamPermissionsDiskRequest, + dict, + ], +) def test_test_iam_permissions_rest(request_type): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -4414,7 +4786,8 @@ def test_test_iam_permissions_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -4457,7 +4830,14 @@ def test_test_iam_permissions_rest_unset_required_fields(): unset_fields = transport.test_iam_permissions._get_unset_required_fields({}) assert set(unset_fields) == ( set(()) - & set(("project", "resource", "testPermissionsRequestResource", "zone",)) + & set( + ( + "project", + "resource", + "testPermissionsRequestResource", + "zone", + ) + ) ) @@ -4503,7 +4883,11 @@ def test_test_iam_permissions_rest_interceptors(null_interceptor): post.return_value = compute.TestPermissionsResponse client.test_iam_permissions( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -4514,7 +4898,8 @@ def test_test_iam_permissions_rest_bad_request( transport: str = "rest", request_type=compute.TestIamPermissionsDiskRequest ): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -4538,7 +4923,8 @@ def test_test_iam_permissions_rest_bad_request( def test_test_iam_permissions_rest_flattened(): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -4587,7 +4973,8 @@ def test_test_iam_permissions_rest_flattened(): def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -4617,7 +5004,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -4637,7 +5025,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = DisksClient(client_options=options, transport=transport,) + client = DisksClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -4653,7 +5044,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = DisksClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -4666,7 +5058,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.DisksRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.DisksRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -4729,7 +5126,8 @@ def test_disks_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.DisksTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -4779,7 +5177,12 @@ def test_disks_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_disks_host_no_port(transport_name): client = DisksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4795,7 +5198,12 @@ def test_disks_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_disks_host_with_port(transport_name): client = DisksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4833,7 +5241,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = DisksClient.common_folder_path(folder) assert expected == actual @@ -4851,7 +5261,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = DisksClient.common_organization_path(organization) assert expected == actual @@ -4869,7 +5281,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = DisksClient.common_project_path(project) assert expected == actual @@ -4889,7 +5303,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = DisksClient.common_location_path(project, location) assert expected == actual @@ -4912,14 +5327,16 @@ def test_client_with_default_client_info(): with mock.patch.object(transports.DisksTransport, "_prep_wrapped_messages") as prep: client = DisksClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) with mock.patch.object(transports.DisksTransport, "_prep_wrapped_messages") as prep: transport_class = DisksClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4958,7 +5375,10 @@ def test_client_ctx(): @pytest.mark.parametrize( - "client_class,transport_class", [(DisksClient, transports.DisksRestTransport),] + "client_class,transport_class", + [ + (DisksClient, transports.DisksRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_external_vpn_gateways.py b/tests/unit/gapic/compute_v1/test_external_vpn_gateways.py index 765d9ac24..0357fb224 100644 --- a/tests/unit/gapic/compute_v1/test_external_vpn_gateways.py +++ b/tests/unit/gapic/compute_v1/test_external_vpn_gateways.py @@ -92,7 +92,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(ExternalVpnGatewaysClient, "rest"),] + "client_class,transport_name", + [ + (ExternalVpnGatewaysClient, "rest"), + ], ) def test_external_vpn_gateways_client_from_service_account_info( client_class, transport_name @@ -116,7 +119,9 @@ def test_external_vpn_gateways_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.ExternalVpnGatewaysRestTransport, "rest"),], + [ + (transports.ExternalVpnGatewaysRestTransport, "rest"), + ], ) def test_external_vpn_gateways_client_service_account_always_use_jwt( transport_class, transport_name @@ -137,7 +142,10 @@ def test_external_vpn_gateways_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(ExternalVpnGatewaysClient, "rest"),] + "client_class,transport_name", + [ + (ExternalVpnGatewaysClient, "rest"), + ], ) def test_external_vpn_gateways_client_from_service_account_file( client_class, transport_name @@ -179,7 +187,13 @@ def test_external_vpn_gateways_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(ExternalVpnGatewaysClient, transports.ExternalVpnGatewaysRestTransport, "rest"),], + [ + ( + ExternalVpnGatewaysClient, + transports.ExternalVpnGatewaysRestTransport, + "rest", + ), + ], ) @mock.patch.object( ExternalVpnGatewaysClient, @@ -472,13 +486,21 @@ def test_external_vpn_gateways_client_get_mtls_endpoint_and_cert_source(client_c @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(ExternalVpnGatewaysClient, transports.ExternalVpnGatewaysRestTransport, "rest"),], + [ + ( + ExternalVpnGatewaysClient, + transports.ExternalVpnGatewaysRestTransport, + "rest", + ), + ], ) def test_external_vpn_gateways_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -527,11 +549,16 @@ def test_external_vpn_gateways_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.DeleteExternalVpnGatewayRequest, dict,] + "request_type", + [ + compute.DeleteExternalVpnGatewayRequest, + dict, + ], ) def test_delete_unary_rest(request_type): client = ExternalVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -641,7 +668,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = ExternalVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -682,7 +710,13 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("externalVpnGateway", "project",)) + set(("requestId",)) + & set( + ( + "externalVpnGateway", + "project", + ) + ) ) @@ -728,7 +762,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -739,7 +777,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteExternalVpnGatewayRequest ): client = ExternalVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -760,7 +799,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = ExternalVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -773,7 +813,8 @@ def test_delete_unary_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", external_vpn_gateway="external_vpn_gateway_value", + project="project_value", + external_vpn_gateway="external_vpn_gateway_value", ) mock_args.update(sample_request) @@ -800,7 +841,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = ExternalVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -819,10 +861,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetExternalVpnGatewayRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetExternalVpnGatewayRequest, + dict, + ], +) def test_get_rest(request_type): client = ExternalVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -900,7 +949,8 @@ def test_get_rest_required_fields(request_type=compute.GetExternalVpnGatewayRequ assert jsonified_request["project"] == "project_value" client = ExternalVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -940,7 +990,15 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("externalVpnGateway", "project",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "externalVpnGateway", + "project", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -986,7 +1044,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.ExternalVpnGateway - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -996,7 +1060,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetExternalVpnGatewayRequest ): client = ExternalVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1017,7 +1082,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = ExternalVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1030,7 +1096,8 @@ def test_get_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", external_vpn_gateway="external_vpn_gateway_value", + project="project_value", + external_vpn_gateway="external_vpn_gateway_value", ) mock_args.update(sample_request) @@ -1057,7 +1124,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = ExternalVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1077,11 +1145,16 @@ def test_get_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.InsertExternalVpnGatewayRequest, dict,] + "request_type", + [ + compute.InsertExternalVpnGatewayRequest, + dict, + ], ) def test_insert_unary_rest(request_type): client = ExternalVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1199,7 +1272,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = ExternalVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1241,7 +1315,13 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("externalVpnGatewayResource", "project",)) + set(("requestId",)) + & set( + ( + "externalVpnGatewayResource", + "project", + ) + ) ) @@ -1287,7 +1367,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1298,7 +1382,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertExternalVpnGatewayRequest ): client = ExternalVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1331,7 +1416,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = ExternalVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1374,7 +1460,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = ExternalVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1396,11 +1483,16 @@ def test_insert_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.ListExternalVpnGatewaysRequest, dict,] + "request_type", + [ + compute.ListExternalVpnGatewaysRequest, + dict, + ], ) def test_list_rest(request_type): client = ExternalVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1463,7 +1555,13 @@ def test_list_rest_required_fields(request_type=compute.ListExternalVpnGatewaysR ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1472,7 +1570,8 @@ def test_list_rest_required_fields(request_type=compute.ListExternalVpnGatewaysR assert jsonified_request["project"] == "project_value" client = ExternalVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1513,7 +1612,15 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set(("project",)) ) @@ -1561,7 +1668,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.ExternalVpnGatewayList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1571,7 +1684,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListExternalVpnGatewaysRequest ): client = ExternalVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1592,7 +1706,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = ExternalVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1604,7 +1719,9 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1630,20 +1747,23 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = ExternalVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list( - compute.ListExternalVpnGatewaysRequest(), project="project_value", + compute.ListExternalVpnGatewaysRequest(), + project="project_value", ) def test_list_rest_pager(transport: str = "rest"): client = ExternalVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1660,12 +1780,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.ExternalVpnGatewayList(items=[], next_page_token="def",), compute.ExternalVpnGatewayList( - items=[compute.ExternalVpnGateway(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.ExternalVpnGatewayList( - items=[compute.ExternalVpnGateway(), compute.ExternalVpnGateway(),], + items=[ + compute.ExternalVpnGateway(), + ], + next_page_token="ghi", + ), + compute.ExternalVpnGatewayList( + items=[ + compute.ExternalVpnGateway(), + compute.ExternalVpnGateway(), + ], ), ) # Two responses for two calls @@ -1693,11 +1822,16 @@ def test_list_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.SetLabelsExternalVpnGatewayRequest, dict,] + "request_type", + [ + compute.SetLabelsExternalVpnGatewayRequest, + dict, + ], ) def test_set_labels_unary_rest(request_type): client = ExternalVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1809,7 +1943,8 @@ def test_set_labels_unary_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = ExternalVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1851,7 +1986,14 @@ def test_set_labels_unary_rest_unset_required_fields(): unset_fields = transport.set_labels._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("globalSetLabelsRequestResource", "project", "resource",)) + set(()) + & set( + ( + "globalSetLabelsRequestResource", + "project", + "resource", + ) + ) ) @@ -1897,7 +2039,11 @@ def test_set_labels_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_labels_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1908,7 +2054,8 @@ def test_set_labels_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetLabelsExternalVpnGatewayRequest ): client = ExternalVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1933,7 +2080,8 @@ def test_set_labels_unary_rest_bad_request( def test_set_labels_unary_rest_flattened(): client = ExternalVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1977,7 +2125,8 @@ def test_set_labels_unary_rest_flattened(): def test_set_labels_unary_rest_flattened_error(transport: str = "rest"): client = ExternalVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2000,11 +2149,16 @@ def test_set_labels_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.TestIamPermissionsExternalVpnGatewayRequest, dict,] + "request_type", + [ + compute.TestIamPermissionsExternalVpnGatewayRequest, + dict, + ], ) def test_test_iam_permissions_rest(request_type): client = ExternalVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2073,7 +2227,8 @@ def test_test_iam_permissions_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = ExternalVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2115,7 +2270,14 @@ def test_test_iam_permissions_rest_unset_required_fields(): unset_fields = transport.test_iam_permissions._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("project", "resource", "testPermissionsRequestResource",)) + set(()) + & set( + ( + "project", + "resource", + "testPermissionsRequestResource", + ) + ) ) @@ -2163,7 +2325,11 @@ def test_test_iam_permissions_rest_interceptors(null_interceptor): post.return_value = compute.TestPermissionsResponse client.test_iam_permissions( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2175,7 +2341,8 @@ def test_test_iam_permissions_rest_bad_request( request_type=compute.TestIamPermissionsExternalVpnGatewayRequest, ): client = ExternalVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2199,7 +2366,8 @@ def test_test_iam_permissions_rest_bad_request( def test_test_iam_permissions_rest_flattened(): client = ExternalVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2243,7 +2411,8 @@ def test_test_iam_permissions_rest_flattened(): def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): client = ExternalVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2272,7 +2441,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ExternalVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2292,7 +2462,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = ExternalVpnGatewaysClient(client_options=options, transport=transport,) + client = ExternalVpnGatewaysClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2308,7 +2481,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ExternalVpnGatewaysClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2322,7 +2496,10 @@ def test_transport_instance(): @pytest.mark.parametrize( - "transport_class", [transports.ExternalVpnGatewaysRestTransport,] + "transport_class", + [ + transports.ExternalVpnGatewaysRestTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -2379,7 +2556,8 @@ def test_external_vpn_gateways_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ExternalVpnGatewaysTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2429,7 +2607,12 @@ def test_external_vpn_gateways_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_external_vpn_gateways_host_no_port(transport_name): client = ExternalVpnGatewaysClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2445,7 +2628,12 @@ def test_external_vpn_gateways_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_external_vpn_gateways_host_with_port(transport_name): client = ExternalVpnGatewaysClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2483,7 +2671,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = ExternalVpnGatewaysClient.common_folder_path(folder) assert expected == actual @@ -2501,7 +2691,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = ExternalVpnGatewaysClient.common_organization_path(organization) assert expected == actual @@ -2519,7 +2711,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = ExternalVpnGatewaysClient.common_project_path(project) assert expected == actual @@ -2539,7 +2733,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = ExternalVpnGatewaysClient.common_location_path(project, location) assert expected == actual @@ -2564,7 +2759,8 @@ def test_client_with_default_client_info(): transports.ExternalVpnGatewaysTransport, "_prep_wrapped_messages" ) as prep: client = ExternalVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2573,7 +2769,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ExternalVpnGatewaysClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2613,7 +2810,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(ExternalVpnGatewaysClient, transports.ExternalVpnGatewaysRestTransport),], + [ + (ExternalVpnGatewaysClient, transports.ExternalVpnGatewaysRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_firewall_policies.py b/tests/unit/gapic/compute_v1/test_firewall_policies.py index 95ada26ec..deacda2a0 100644 --- a/tests/unit/gapic/compute_v1/test_firewall_policies.py +++ b/tests/unit/gapic/compute_v1/test_firewall_policies.py @@ -90,7 +90,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(FirewallPoliciesClient, "rest"),] + "client_class,transport_name", + [ + (FirewallPoliciesClient, "rest"), + ], ) def test_firewall_policies_client_from_service_account_info( client_class, transport_name @@ -114,7 +117,9 @@ def test_firewall_policies_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.FirewallPoliciesRestTransport, "rest"),], + [ + (transports.FirewallPoliciesRestTransport, "rest"), + ], ) def test_firewall_policies_client_service_account_always_use_jwt( transport_class, transport_name @@ -135,7 +140,10 @@ def test_firewall_policies_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(FirewallPoliciesClient, "rest"),] + "client_class,transport_name", + [ + (FirewallPoliciesClient, "rest"), + ], ) def test_firewall_policies_client_from_service_account_file( client_class, transport_name @@ -177,7 +185,9 @@ def test_firewall_policies_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(FirewallPoliciesClient, transports.FirewallPoliciesRestTransport, "rest"),], + [ + (FirewallPoliciesClient, transports.FirewallPoliciesRestTransport, "rest"), + ], ) @mock.patch.object( FirewallPoliciesClient, @@ -470,13 +480,17 @@ def test_firewall_policies_client_get_mtls_endpoint_and_cert_source(client_class @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(FirewallPoliciesClient, transports.FirewallPoliciesRestTransport, "rest"),], + [ + (FirewallPoliciesClient, transports.FirewallPoliciesRestTransport, "rest"), + ], ) def test_firewall_policies_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -494,7 +508,14 @@ def test_firewall_policies_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(FirewallPoliciesClient, transports.FirewallPoliciesRestTransport, "rest", None),], + [ + ( + FirewallPoliciesClient, + transports.FirewallPoliciesRestTransport, + "rest", + None, + ), + ], ) def test_firewall_policies_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -518,11 +539,16 @@ def test_firewall_policies_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.AddAssociationFirewallPolicyRequest, dict,] + "request_type", + [ + compute.AddAssociationFirewallPolicyRequest, + dict, + ], ) def test_add_association_unary_rest(request_type): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -627,7 +653,12 @@ def test_add_association_unary_rest_required_fields( credentials=ga_credentials.AnonymousCredentials() ).add_association._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("replace_existing_association", "request_id",)) + assert not set(unset_fields) - set( + ( + "replace_existing_association", + "request_id", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -635,7 +666,8 @@ def test_add_association_unary_rest_required_fields( assert jsonified_request["firewallPolicy"] == "firewall_policy_value" client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -677,8 +709,18 @@ def test_add_association_unary_rest_unset_required_fields(): unset_fields = transport.add_association._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("replaceExistingAssociation", "requestId",)) - & set(("firewallPolicy", "firewallPolicyAssociationResource",)) + set( + ( + "replaceExistingAssociation", + "requestId", + ) + ) + & set( + ( + "firewallPolicy", + "firewallPolicyAssociationResource", + ) + ) ) @@ -724,7 +766,11 @@ def test_add_association_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.add_association_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -735,7 +781,8 @@ def test_add_association_unary_rest_bad_request( transport: str = "rest", request_type=compute.AddAssociationFirewallPolicyRequest ): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -763,7 +810,8 @@ def test_add_association_unary_rest_bad_request( def test_add_association_unary_rest_flattened(): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -806,7 +854,8 @@ def test_add_association_unary_rest_flattened(): def test_add_association_unary_rest_flattened_error(transport: str = "rest"): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -827,10 +876,17 @@ def test_add_association_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.AddRuleFirewallPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.AddRuleFirewallPolicyRequest, + dict, + ], +) def test_add_rule_unary_rest(request_type): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -961,7 +1017,8 @@ def test_add_rule_unary_rest_required_fields( assert jsonified_request["firewallPolicy"] == "firewall_policy_value" client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1003,7 +1060,13 @@ def test_add_rule_unary_rest_unset_required_fields(): unset_fields = transport.add_rule._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("firewallPolicy", "firewallPolicyRuleResource",)) + set(("requestId",)) + & set( + ( + "firewallPolicy", + "firewallPolicyRuleResource", + ) + ) ) @@ -1049,7 +1112,11 @@ def test_add_rule_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.add_rule_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1060,7 +1127,8 @@ def test_add_rule_unary_rest_bad_request( transport: str = "rest", request_type=compute.AddRuleFirewallPolicyRequest ): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1106,7 +1174,8 @@ def test_add_rule_unary_rest_bad_request( def test_add_rule_unary_rest_flattened(): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1149,7 +1218,8 @@ def test_add_rule_unary_rest_flattened(): def test_add_rule_unary_rest_flattened_error(transport: str = "rest"): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1171,11 +1241,16 @@ def test_add_rule_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.CloneRulesFirewallPolicyRequest, dict,] + "request_type", + [ + compute.CloneRulesFirewallPolicyRequest, + dict, + ], ) def test_clone_rules_unary_rest(request_type): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1273,7 +1348,12 @@ def test_clone_rules_unary_rest_required_fields( credentials=ga_credentials.AnonymousCredentials() ).clone_rules._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("request_id", "source_firewall_policy",)) + assert not set(unset_fields) - set( + ( + "request_id", + "source_firewall_policy", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -1281,7 +1361,8 @@ def test_clone_rules_unary_rest_required_fields( assert jsonified_request["firewallPolicy"] == "firewall_policy_value" client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1322,7 +1403,13 @@ def test_clone_rules_unary_rest_unset_required_fields(): unset_fields = transport.clone_rules._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId", "sourceFirewallPolicy",)) & set(("firewallPolicy",)) + set( + ( + "requestId", + "sourceFirewallPolicy", + ) + ) + & set(("firewallPolicy",)) ) @@ -1368,7 +1455,11 @@ def test_clone_rules_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.clone_rules_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1379,7 +1470,8 @@ def test_clone_rules_unary_rest_bad_request( transport: str = "rest", request_type=compute.CloneRulesFirewallPolicyRequest ): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1400,7 +1492,8 @@ def test_clone_rules_unary_rest_bad_request( def test_clone_rules_unary_rest_flattened(): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1412,7 +1505,9 @@ def test_clone_rules_unary_rest_flattened(): sample_request = {"firewall_policy": "sample1"} # get truthy value for each flattened field - mock_args = dict(firewall_policy="firewall_policy_value",) + mock_args = dict( + firewall_policy="firewall_policy_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1438,7 +1533,8 @@ def test_clone_rules_unary_rest_flattened(): def test_clone_rules_unary_rest_flattened_error(transport: str = "rest"): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1456,10 +1552,17 @@ def test_clone_rules_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.DeleteFirewallPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteFirewallPolicyRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1565,7 +1668,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["firewallPolicy"] == "firewall_policy_value" client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1650,7 +1754,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1661,7 +1769,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteFirewallPolicyRequest ): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1682,7 +1791,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1694,7 +1804,9 @@ def test_delete_unary_rest_flattened(): sample_request = {"firewall_policy": "sample1"} # get truthy value for each flattened field - mock_args = dict(firewall_policy="firewall_policy_value",) + mock_args = dict( + firewall_policy="firewall_policy_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1720,7 +1832,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1738,10 +1851,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetFirewallPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetFirewallPolicyRequest, + dict, + ], +) def test_get_rest(request_type): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1823,7 +1943,8 @@ def test_get_rest_required_fields(request_type=compute.GetFirewallPolicyRequest) assert jsonified_request["firewallPolicy"] == "firewall_policy_value" client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1909,7 +2030,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.FirewallPolicy - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1919,7 +2046,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetFirewallPolicyRequest ): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1940,7 +2068,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1952,7 +2081,9 @@ def test_get_rest_flattened(): sample_request = {"firewall_policy": "sample1"} # get truthy value for each flattened field - mock_args = dict(firewall_policy="firewall_policy_value",) + mock_args = dict( + firewall_policy="firewall_policy_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1978,14 +2109,16 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get( - compute.GetFirewallPolicyRequest(), firewall_policy="firewall_policy_value", + compute.GetFirewallPolicyRequest(), + firewall_policy="firewall_policy_value", ) @@ -1996,11 +2129,16 @@ def test_get_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.GetAssociationFirewallPolicyRequest, dict,] + "request_type", + [ + compute.GetAssociationFirewallPolicyRequest, + dict, + ], ) def test_get_association_rest(request_type): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2072,7 +2210,8 @@ def test_get_association_rest_required_fields( assert jsonified_request["firewallPolicy"] == "firewall_policy_value" client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2159,7 +2298,11 @@ def test_get_association_rest_interceptors(null_interceptor): post.return_value = compute.FirewallPolicyAssociation client.get_association( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2170,7 +2313,8 @@ def test_get_association_rest_bad_request( transport: str = "rest", request_type=compute.GetAssociationFirewallPolicyRequest ): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2191,7 +2335,8 @@ def test_get_association_rest_bad_request( def test_get_association_rest_flattened(): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2203,7 +2348,9 @@ def test_get_association_rest_flattened(): sample_request = {"firewall_policy": "sample1"} # get truthy value for each flattened field - mock_args = dict(firewall_policy="firewall_policy_value",) + mock_args = dict( + firewall_policy="firewall_policy_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2229,7 +2376,8 @@ def test_get_association_rest_flattened(): def test_get_association_rest_flattened_error(transport: str = "rest"): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2248,11 +2396,16 @@ def test_get_association_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.GetIamPolicyFirewallPolicyRequest, dict,] + "request_type", + [ + compute.GetIamPolicyFirewallPolicyRequest, + dict, + ], ) def test_get_iam_policy_rest(request_type): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2262,7 +2415,11 @@ def test_get_iam_policy_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = compute.Policy(etag="etag_value", iam_owned=True, version=774,) + return_value = compute.Policy( + etag="etag_value", + iam_owned=True, + version=774, + ) # Wrap the value into a proper Response obj response_value = Response() @@ -2316,7 +2473,8 @@ def test_get_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2403,7 +2561,11 @@ def test_get_iam_policy_rest_interceptors(null_interceptor): post.return_value = compute.Policy client.get_iam_policy( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2414,7 +2576,8 @@ def test_get_iam_policy_rest_bad_request( transport: str = "rest", request_type=compute.GetIamPolicyFirewallPolicyRequest ): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2435,7 +2598,8 @@ def test_get_iam_policy_rest_bad_request( def test_get_iam_policy_rest_flattened(): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2447,7 +2611,9 @@ def test_get_iam_policy_rest_flattened(): sample_request = {"resource": "sample1"} # get truthy value for each flattened field - mock_args = dict(resource="resource_value",) + mock_args = dict( + resource="resource_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2473,14 +2639,16 @@ def test_get_iam_policy_rest_flattened(): def test_get_iam_policy_rest_flattened_error(transport: str = "rest"): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_iam_policy( - compute.GetIamPolicyFirewallPolicyRequest(), resource="resource_value", + compute.GetIamPolicyFirewallPolicyRequest(), + resource="resource_value", ) @@ -2490,10 +2658,17 @@ def test_get_iam_policy_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetRuleFirewallPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetRuleFirewallPolicyRequest, + dict, + ], +) def test_get_rule_rest(request_type): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2575,7 +2750,8 @@ def test_get_rule_rest_required_fields( assert jsonified_request["firewallPolicy"] == "firewall_policy_value" client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2661,7 +2837,13 @@ def test_get_rule_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.FirewallPolicyRule - client.get_rule(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get_rule( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2671,7 +2853,8 @@ def test_get_rule_rest_bad_request( transport: str = "rest", request_type=compute.GetRuleFirewallPolicyRequest ): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2692,7 +2875,8 @@ def test_get_rule_rest_bad_request( def test_get_rule_rest_flattened(): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2704,7 +2888,9 @@ def test_get_rule_rest_flattened(): sample_request = {"firewall_policy": "sample1"} # get truthy value for each flattened field - mock_args = dict(firewall_policy="firewall_policy_value",) + mock_args = dict( + firewall_policy="firewall_policy_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2730,7 +2916,8 @@ def test_get_rule_rest_flattened(): def test_get_rule_rest_flattened_error(transport: str = "rest"): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2748,10 +2935,17 @@ def test_get_rule_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertFirewallPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertFirewallPolicyRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2902,13 +3096,19 @@ def test_insert_unary_rest_required_fields( credentials=ga_credentials.AnonymousCredentials() ).insert._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("parent_id", "request_id",)) + assert not set(unset_fields) - set( + ( + "parent_id", + "request_id", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2950,7 +3150,13 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("parentId", "requestId",)) & set(("firewallPolicyResource",)) + set( + ( + "parentId", + "requestId", + ) + ) + & set(("firewallPolicyResource",)) ) @@ -2996,7 +3202,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3007,7 +3217,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertFirewallPolicyRequest ): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3084,7 +3295,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3130,7 +3342,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3155,10 +3368,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListFirewallPoliciesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListFirewallPoliciesRequest, + dict, + ], +) def test_list_rest(request_type): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3169,7 +3389,9 @@ def test_list_rest(request_type): with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. return_value = compute.FirewallPolicyList( - id="id_value", kind="kind_value", next_page_token="next_page_token_value", + id="id_value", + kind="kind_value", + next_page_token="next_page_token_value", ) # Wrap the value into a proper Response obj @@ -3230,7 +3452,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.FirewallPolicyList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -3240,7 +3468,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListFirewallPoliciesRequest ): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3261,7 +3490,8 @@ def test_list_rest_bad_request( def test_list_rest_pager(transport: str = "rest"): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -3278,12 +3508,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.FirewallPolicyList(items=[], next_page_token="def",), compute.FirewallPolicyList( - items=[compute.FirewallPolicy(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.FirewallPolicyList( - items=[compute.FirewallPolicy(), compute.FirewallPolicy(),], + items=[ + compute.FirewallPolicy(), + ], + next_page_token="ghi", + ), + compute.FirewallPolicyList( + items=[ + compute.FirewallPolicy(), + compute.FirewallPolicy(), + ], ), ) # Two responses for two calls @@ -3311,11 +3550,16 @@ def test_list_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.ListAssociationsFirewallPolicyRequest, dict,] + "request_type", + [ + compute.ListAssociationsFirewallPolicyRequest, + dict, + ], ) def test_list_associations_rest(request_type): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3375,8 +3619,10 @@ def test_list_associations_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = compute.FirewallPoliciesListAssociationsResponse.to_json( - compute.FirewallPoliciesListAssociationsResponse() + req.return_value._content = ( + compute.FirewallPoliciesListAssociationsResponse.to_json( + compute.FirewallPoliciesListAssociationsResponse() + ) ) request = compute.ListAssociationsFirewallPolicyRequest() @@ -3388,7 +3634,11 @@ def test_list_associations_rest_interceptors(null_interceptor): post.return_value = compute.FirewallPoliciesListAssociationsResponse client.list_associations( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3399,7 +3649,8 @@ def test_list_associations_rest_bad_request( transport: str = "rest", request_type=compute.ListAssociationsFirewallPolicyRequest ): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3424,10 +3675,17 @@ def test_list_associations_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.MoveFirewallPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.MoveFirewallPolicyRequest, + dict, + ], +) def test_move_unary_rest(request_type): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3525,7 +3783,12 @@ def test_move_unary_rest_required_fields( credentials=ga_credentials.AnonymousCredentials() ).move._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("parent_id", "request_id",)) + assert not set(unset_fields) - set( + ( + "parent_id", + "request_id", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -3533,7 +3796,8 @@ def test_move_unary_rest_required_fields( assert jsonified_request["firewallPolicy"] == "firewall_policy_value" client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3574,7 +3838,13 @@ def test_move_unary_rest_unset_required_fields(): unset_fields = transport.move._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("parentId", "requestId",)) & set(("firewallPolicy",)) + set( + ( + "parentId", + "requestId", + ) + ) + & set(("firewallPolicy",)) ) @@ -3619,7 +3889,13 @@ def test_move_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.move_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.move_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -3629,7 +3905,8 @@ def test_move_unary_rest_bad_request( transport: str = "rest", request_type=compute.MoveFirewallPolicyRequest ): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3650,7 +3927,8 @@ def test_move_unary_rest_bad_request( def test_move_unary_rest_flattened(): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3663,7 +3941,8 @@ def test_move_unary_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - firewall_policy="firewall_policy_value", parent_id="parent_id_value", + firewall_policy="firewall_policy_value", + parent_id="parent_id_value", ) mock_args.update(sample_request) @@ -3690,7 +3969,8 @@ def test_move_unary_rest_flattened(): def test_move_unary_rest_flattened_error(transport: str = "rest"): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3709,10 +3989,17 @@ def test_move_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.PatchFirewallPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.PatchFirewallPolicyRequest, + dict, + ], +) def test_patch_unary_rest(request_type): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3874,7 +4161,8 @@ def test_patch_unary_rest_required_fields( assert jsonified_request["firewallPolicy"] == "firewall_policy_value" client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3916,7 +4204,13 @@ def test_patch_unary_rest_unset_required_fields(): unset_fields = transport.patch._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("firewallPolicy", "firewallPolicyResource",)) + set(("requestId",)) + & set( + ( + "firewallPolicy", + "firewallPolicyResource", + ) + ) ) @@ -3961,7 +4255,13 @@ def test_patch_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.patch_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -3971,7 +4271,8 @@ def test_patch_unary_rest_bad_request( transport: str = "rest", request_type=compute.PatchFirewallPolicyRequest ): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -4048,7 +4349,8 @@ def test_patch_unary_rest_bad_request( def test_patch_unary_rest_flattened(): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -4095,7 +4397,8 @@ def test_patch_unary_rest_flattened(): def test_patch_unary_rest_flattened_error(transport: str = "rest"): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -4121,11 +4424,16 @@ def test_patch_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.PatchRuleFirewallPolicyRequest, dict,] + "request_type", + [ + compute.PatchRuleFirewallPolicyRequest, + dict, + ], ) def test_patch_rule_unary_rest(request_type): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -4248,7 +4556,12 @@ def test_patch_rule_unary_rest_required_fields( credentials=ga_credentials.AnonymousCredentials() ).patch_rule._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("priority", "request_id",)) + assert not set(unset_fields) - set( + ( + "priority", + "request_id", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -4256,7 +4569,8 @@ def test_patch_rule_unary_rest_required_fields( assert jsonified_request["firewallPolicy"] == "firewall_policy_value" client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -4298,8 +4612,18 @@ def test_patch_rule_unary_rest_unset_required_fields(): unset_fields = transport.patch_rule._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("priority", "requestId",)) - & set(("firewallPolicy", "firewallPolicyRuleResource",)) + set( + ( + "priority", + "requestId", + ) + ) + & set( + ( + "firewallPolicy", + "firewallPolicyRuleResource", + ) + ) ) @@ -4345,7 +4669,11 @@ def test_patch_rule_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.patch_rule_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -4356,7 +4684,8 @@ def test_patch_rule_unary_rest_bad_request( transport: str = "rest", request_type=compute.PatchRuleFirewallPolicyRequest ): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -4402,7 +4731,8 @@ def test_patch_rule_unary_rest_bad_request( def test_patch_rule_unary_rest_flattened(): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -4445,7 +4775,8 @@ def test_patch_rule_unary_rest_flattened(): def test_patch_rule_unary_rest_flattened_error(transport: str = "rest"): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -4467,11 +4798,16 @@ def test_patch_rule_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.RemoveAssociationFirewallPolicyRequest, dict,] + "request_type", + [ + compute.RemoveAssociationFirewallPolicyRequest, + dict, + ], ) def test_remove_association_unary_rest(request_type): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -4569,7 +4905,12 @@ def test_remove_association_unary_rest_required_fields( credentials=ga_credentials.AnonymousCredentials() ).remove_association._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("name", "request_id",)) + assert not set(unset_fields) - set( + ( + "name", + "request_id", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -4577,7 +4918,8 @@ def test_remove_association_unary_rest_required_fields( assert jsonified_request["firewallPolicy"] == "firewall_policy_value" client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -4617,7 +4959,15 @@ def test_remove_association_unary_rest_unset_required_fields(): ) unset_fields = transport.remove_association._get_unset_required_fields({}) - assert set(unset_fields) == (set(("name", "requestId",)) & set(("firewallPolicy",))) + assert set(unset_fields) == ( + set( + ( + "name", + "requestId", + ) + ) + & set(("firewallPolicy",)) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -4662,7 +5012,11 @@ def test_remove_association_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.remove_association_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -4673,7 +5027,8 @@ def test_remove_association_unary_rest_bad_request( transport: str = "rest", request_type=compute.RemoveAssociationFirewallPolicyRequest ): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -4694,7 +5049,8 @@ def test_remove_association_unary_rest_bad_request( def test_remove_association_unary_rest_flattened(): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -4706,7 +5062,9 @@ def test_remove_association_unary_rest_flattened(): sample_request = {"firewall_policy": "sample1"} # get truthy value for each flattened field - mock_args = dict(firewall_policy="firewall_policy_value",) + mock_args = dict( + firewall_policy="firewall_policy_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -4732,7 +5090,8 @@ def test_remove_association_unary_rest_flattened(): def test_remove_association_unary_rest_flattened_error(transport: str = "rest"): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -4751,11 +5110,16 @@ def test_remove_association_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.RemoveRuleFirewallPolicyRequest, dict,] + "request_type", + [ + compute.RemoveRuleFirewallPolicyRequest, + dict, + ], ) def test_remove_rule_unary_rest(request_type): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -4853,7 +5217,12 @@ def test_remove_rule_unary_rest_required_fields( credentials=ga_credentials.AnonymousCredentials() ).remove_rule._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("priority", "request_id",)) + assert not set(unset_fields) - set( + ( + "priority", + "request_id", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -4861,7 +5230,8 @@ def test_remove_rule_unary_rest_required_fields( assert jsonified_request["firewallPolicy"] == "firewall_policy_value" client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -4902,7 +5272,13 @@ def test_remove_rule_unary_rest_unset_required_fields(): unset_fields = transport.remove_rule._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("priority", "requestId",)) & set(("firewallPolicy",)) + set( + ( + "priority", + "requestId", + ) + ) + & set(("firewallPolicy",)) ) @@ -4948,7 +5324,11 @@ def test_remove_rule_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.remove_rule_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -4959,7 +5339,8 @@ def test_remove_rule_unary_rest_bad_request( transport: str = "rest", request_type=compute.RemoveRuleFirewallPolicyRequest ): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -4980,7 +5361,8 @@ def test_remove_rule_unary_rest_bad_request( def test_remove_rule_unary_rest_flattened(): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -4992,7 +5374,9 @@ def test_remove_rule_unary_rest_flattened(): sample_request = {"firewall_policy": "sample1"} # get truthy value for each flattened field - mock_args = dict(firewall_policy="firewall_policy_value",) + mock_args = dict( + firewall_policy="firewall_policy_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -5018,7 +5402,8 @@ def test_remove_rule_unary_rest_flattened(): def test_remove_rule_unary_rest_flattened_error(transport: str = "rest"): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -5037,11 +5422,16 @@ def test_remove_rule_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SetIamPolicyFirewallPolicyRequest, dict,] + "request_type", + [ + compute.SetIamPolicyFirewallPolicyRequest, + dict, + ], ) def test_set_iam_policy_rest(request_type): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -5128,7 +5518,11 @@ def test_set_iam_policy_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = compute.Policy(etag="etag_value", iam_owned=True, version=774,) + return_value = compute.Policy( + etag="etag_value", + iam_owned=True, + version=774, + ) # Wrap the value into a proper Response obj response_value = Response() @@ -5180,7 +5574,8 @@ def test_set_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -5222,7 +5617,13 @@ def test_set_iam_policy_rest_unset_required_fields(): unset_fields = transport.set_iam_policy._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("globalOrganizationSetPolicyRequestResource", "resource",)) + set(()) + & set( + ( + "globalOrganizationSetPolicyRequestResource", + "resource", + ) + ) ) @@ -5268,7 +5669,11 @@ def test_set_iam_policy_rest_interceptors(null_interceptor): post.return_value = compute.Policy client.set_iam_policy( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -5279,7 +5684,8 @@ def test_set_iam_policy_rest_bad_request( transport: str = "rest", request_type=compute.SetIamPolicyFirewallPolicyRequest ): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -5377,7 +5783,8 @@ def test_set_iam_policy_rest_bad_request( def test_set_iam_policy_rest_flattened(): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -5420,7 +5827,8 @@ def test_set_iam_policy_rest_flattened(): def test_set_iam_policy_rest_flattened_error(transport: str = "rest"): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -5442,11 +5850,16 @@ def test_set_iam_policy_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.TestIamPermissionsFirewallPolicyRequest, dict,] + "request_type", + [ + compute.TestIamPermissionsFirewallPolicyRequest, + dict, + ], ) def test_test_iam_permissions_rest(request_type): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -5511,7 +5924,8 @@ def test_test_iam_permissions_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -5553,7 +5967,13 @@ def test_test_iam_permissions_rest_unset_required_fields(): unset_fields = transport.test_iam_permissions._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("resource", "testPermissionsRequestResource",)) + set(()) + & set( + ( + "resource", + "testPermissionsRequestResource", + ) + ) ) @@ -5601,7 +6021,11 @@ def test_test_iam_permissions_rest_interceptors(null_interceptor): post.return_value = compute.TestPermissionsResponse client.test_iam_permissions( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -5613,7 +6037,8 @@ def test_test_iam_permissions_rest_bad_request( request_type=compute.TestIamPermissionsFirewallPolicyRequest, ): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -5637,7 +6062,8 @@ def test_test_iam_permissions_rest_bad_request( def test_test_iam_permissions_rest_flattened(): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -5680,7 +6106,8 @@ def test_test_iam_permissions_rest_flattened(): def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -5708,7 +6135,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -5728,7 +6156,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = FirewallPoliciesClient(client_options=options, transport=transport,) + client = FirewallPoliciesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -5744,7 +6175,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = FirewallPoliciesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -5757,7 +6189,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.FirewallPoliciesRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.FirewallPoliciesRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -5825,7 +6262,8 @@ def test_firewall_policies_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.FirewallPoliciesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -5875,7 +6313,12 @@ def test_firewall_policies_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_firewall_policies_host_no_port(transport_name): client = FirewallPoliciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5891,7 +6334,12 @@ def test_firewall_policies_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_firewall_policies_host_with_port(transport_name): client = FirewallPoliciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5929,7 +6377,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = FirewallPoliciesClient.common_folder_path(folder) assert expected == actual @@ -5947,7 +6397,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = FirewallPoliciesClient.common_organization_path(organization) assert expected == actual @@ -5965,7 +6417,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = FirewallPoliciesClient.common_project_path(project) assert expected == actual @@ -5985,7 +6439,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = FirewallPoliciesClient.common_location_path(project, location) assert expected == actual @@ -6010,7 +6465,8 @@ def test_client_with_default_client_info(): transports.FirewallPoliciesTransport, "_prep_wrapped_messages" ) as prep: client = FirewallPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6019,7 +6475,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = FirewallPoliciesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6059,7 +6516,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(FirewallPoliciesClient, transports.FirewallPoliciesRestTransport),], + [ + (FirewallPoliciesClient, transports.FirewallPoliciesRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_firewalls.py b/tests/unit/gapic/compute_v1/test_firewalls.py index b0269c97c..9bee0b470 100644 --- a/tests/unit/gapic/compute_v1/test_firewalls.py +++ b/tests/unit/gapic/compute_v1/test_firewalls.py @@ -83,7 +83,12 @@ def test__get_default_mtls_endpoint(): assert FirewallsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class,transport_name", [(FirewallsClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (FirewallsClient, "rest"), + ], +) def test_firewalls_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -103,7 +108,10 @@ def test_firewalls_client_from_service_account_info(client_class, transport_name @pytest.mark.parametrize( - "transport_class,transport_name", [(transports.FirewallsRestTransport, "rest"),] + "transport_class,transport_name", + [ + (transports.FirewallsRestTransport, "rest"), + ], ) def test_firewalls_client_service_account_always_use_jwt( transport_class, transport_name @@ -123,7 +131,12 @@ def test_firewalls_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class,transport_name", [(FirewallsClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (FirewallsClient, "rest"), + ], +) def test_firewalls_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -162,7 +175,9 @@ def test_firewalls_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(FirewallsClient, transports.FirewallsRestTransport, "rest"),], + [ + (FirewallsClient, transports.FirewallsRestTransport, "rest"), + ], ) @mock.patch.object( FirewallsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(FirewallsClient) @@ -437,13 +452,17 @@ def test_firewalls_client_get_mtls_endpoint_and_cert_source(client_class): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(FirewallsClient, transports.FirewallsRestTransport, "rest"),], + [ + (FirewallsClient, transports.FirewallsRestTransport, "rest"), + ], ) def test_firewalls_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -461,7 +480,9 @@ def test_firewalls_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(FirewallsClient, transports.FirewallsRestTransport, "rest", None),], + [ + (FirewallsClient, transports.FirewallsRestTransport, "rest", None), + ], ) def test_firewalls_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -484,10 +505,17 @@ def test_firewalls_client_client_options_credentials_file( ) -@pytest.mark.parametrize("request_type", [compute.DeleteFirewallRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteFirewallRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = FirewallsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -595,7 +623,8 @@ def test_delete_unary_rest_required_fields(request_type=compute.DeleteFirewallRe assert jsonified_request["project"] == "project_value" client = FirewallsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -635,7 +664,15 @@ def test_delete_unary_rest_unset_required_fields(): ) unset_fields = transport.delete._get_unset_required_fields({}) - assert set(unset_fields) == (set(("requestId",)) & set(("firewall", "project",))) + assert set(unset_fields) == ( + set(("requestId",)) + & set( + ( + "firewall", + "project", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -678,7 +715,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -689,7 +730,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteFirewallRequest ): client = FirewallsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -710,7 +752,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = FirewallsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -722,7 +765,10 @@ def test_delete_unary_rest_flattened(): sample_request = {"project": "sample1", "firewall": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", firewall="firewall_value",) + mock_args = dict( + project="project_value", + firewall="firewall_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -748,7 +794,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = FirewallsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -767,10 +814,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetFirewallRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetFirewallRequest, + dict, + ], +) def test_get_rest(request_type): client = FirewallsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -864,7 +918,8 @@ def test_get_rest_required_fields(request_type=compute.GetFirewallRequest): assert jsonified_request["project"] == "project_value" client = FirewallsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -904,7 +959,15 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("firewall", "project",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "firewall", + "project", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -946,7 +1009,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Firewall - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -956,7 +1025,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetFirewallRequest ): client = FirewallsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -977,7 +1047,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = FirewallsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -989,7 +1060,10 @@ def test_get_rest_flattened(): sample_request = {"project": "sample1", "firewall": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", firewall="firewall_value",) + mock_args = dict( + project="project_value", + firewall="firewall_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1015,7 +1089,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = FirewallsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1034,10 +1109,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertFirewallRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertFirewallRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = FirewallsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1181,7 +1263,8 @@ def test_insert_unary_rest_required_fields(request_type=compute.InsertFirewallRe assert jsonified_request["project"] == "project_value" client = FirewallsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1223,7 +1306,13 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("firewallResource", "project",)) + set(("requestId",)) + & set( + ( + "firewallResource", + "project", + ) + ) ) @@ -1267,7 +1356,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1278,7 +1371,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertFirewallRequest ): client = FirewallsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1339,7 +1433,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = FirewallsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1382,7 +1477,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = FirewallsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1403,10 +1499,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListFirewallsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListFirewallsRequest, + dict, + ], +) def test_list_rest(request_type): client = FirewallsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1467,7 +1570,13 @@ def test_list_rest_required_fields(request_type=compute.ListFirewallsRequest): ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1476,7 +1585,8 @@ def test_list_rest_required_fields(request_type=compute.ListFirewallsRequest): assert jsonified_request["project"] == "project_value" client = FirewallsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1517,7 +1627,15 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set(("project",)) ) @@ -1561,7 +1679,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.FirewallList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1571,7 +1695,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListFirewallsRequest ): client = FirewallsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1592,7 +1717,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = FirewallsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1604,7 +1730,9 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1630,20 +1758,23 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = FirewallsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list( - compute.ListFirewallsRequest(), project="project_value", + compute.ListFirewallsRequest(), + project="project_value", ) def test_list_rest_pager(transport: str = "rest"): client = FirewallsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1653,12 +1784,29 @@ def test_list_rest_pager(transport: str = "rest"): # Set the response as a series of pages response = ( compute.FirewallList( - items=[compute.Firewall(), compute.Firewall(), compute.Firewall(),], + items=[ + compute.Firewall(), + compute.Firewall(), + compute.Firewall(), + ], next_page_token="abc", ), - compute.FirewallList(items=[], next_page_token="def",), - compute.FirewallList(items=[compute.Firewall(),], next_page_token="ghi",), - compute.FirewallList(items=[compute.Firewall(), compute.Firewall(),],), + compute.FirewallList( + items=[], + next_page_token="def", + ), + compute.FirewallList( + items=[ + compute.Firewall(), + ], + next_page_token="ghi", + ), + compute.FirewallList( + items=[ + compute.Firewall(), + compute.Firewall(), + ], + ), ) # Two responses for two calls response = response + response @@ -1684,10 +1832,17 @@ def test_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.PatchFirewallRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.PatchFirewallRequest, + dict, + ], +) def test_patch_unary_rest(request_type): client = FirewallsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1835,7 +1990,8 @@ def test_patch_unary_rest_required_fields(request_type=compute.PatchFirewallRequ assert jsonified_request["project"] == "project_value" client = FirewallsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1877,7 +2033,14 @@ def test_patch_unary_rest_unset_required_fields(): unset_fields = transport.patch._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("firewall", "firewallResource", "project",)) + set(("requestId",)) + & set( + ( + "firewall", + "firewallResource", + "project", + ) + ) ) @@ -1920,7 +2083,13 @@ def test_patch_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.patch_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1930,7 +2099,8 @@ def test_patch_unary_rest_bad_request( transport: str = "rest", request_type=compute.PatchFirewallRequest ): client = FirewallsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1991,7 +2161,8 @@ def test_patch_unary_rest_bad_request( def test_patch_unary_rest_flattened(): client = FirewallsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2035,7 +2206,8 @@ def test_patch_unary_rest_flattened(): def test_patch_unary_rest_flattened_error(transport: str = "rest"): client = FirewallsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2057,10 +2229,17 @@ def test_patch_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.UpdateFirewallRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.UpdateFirewallRequest, + dict, + ], +) def test_update_unary_rest(request_type): client = FirewallsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2208,7 +2387,8 @@ def test_update_unary_rest_required_fields(request_type=compute.UpdateFirewallRe assert jsonified_request["project"] == "project_value" client = FirewallsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2250,7 +2430,14 @@ def test_update_unary_rest_unset_required_fields(): unset_fields = transport.update._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("firewall", "firewallResource", "project",)) + set(("requestId",)) + & set( + ( + "firewall", + "firewallResource", + "project", + ) + ) ) @@ -2294,7 +2481,11 @@ def test_update_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.update_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2305,7 +2496,8 @@ def test_update_unary_rest_bad_request( transport: str = "rest", request_type=compute.UpdateFirewallRequest ): client = FirewallsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2366,7 +2558,8 @@ def test_update_unary_rest_bad_request( def test_update_unary_rest_flattened(): client = FirewallsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2410,7 +2603,8 @@ def test_update_unary_rest_flattened(): def test_update_unary_rest_flattened_error(transport: str = "rest"): client = FirewallsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2439,7 +2633,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = FirewallsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2459,7 +2654,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = FirewallsClient(client_options=options, transport=transport,) + client = FirewallsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2475,7 +2673,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = FirewallsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2488,7 +2687,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.FirewallsRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.FirewallsRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -2544,7 +2748,8 @@ def test_firewalls_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.FirewallsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2594,7 +2799,12 @@ def test_firewalls_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_firewalls_host_no_port(transport_name): client = FirewallsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2610,7 +2820,12 @@ def test_firewalls_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_firewalls_host_with_port(transport_name): client = FirewallsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2648,7 +2863,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = FirewallsClient.common_folder_path(folder) assert expected == actual @@ -2666,7 +2883,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = FirewallsClient.common_organization_path(organization) assert expected == actual @@ -2684,7 +2903,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = FirewallsClient.common_project_path(project) assert expected == actual @@ -2704,7 +2925,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = FirewallsClient.common_location_path(project, location) assert expected == actual @@ -2729,7 +2951,8 @@ def test_client_with_default_client_info(): transports.FirewallsTransport, "_prep_wrapped_messages" ) as prep: client = FirewallsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2738,7 +2961,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = FirewallsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2778,7 +3002,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(FirewallsClient, transports.FirewallsRestTransport),], + [ + (FirewallsClient, transports.FirewallsRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_forwarding_rules.py b/tests/unit/gapic/compute_v1/test_forwarding_rules.py index 776a004da..acae5377a 100644 --- a/tests/unit/gapic/compute_v1/test_forwarding_rules.py +++ b/tests/unit/gapic/compute_v1/test_forwarding_rules.py @@ -89,7 +89,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(ForwardingRulesClient, "rest"),] + "client_class,transport_name", + [ + (ForwardingRulesClient, "rest"), + ], ) def test_forwarding_rules_client_from_service_account_info( client_class, transport_name @@ -113,7 +116,9 @@ def test_forwarding_rules_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.ForwardingRulesRestTransport, "rest"),], + [ + (transports.ForwardingRulesRestTransport, "rest"), + ], ) def test_forwarding_rules_client_service_account_always_use_jwt( transport_class, transport_name @@ -134,7 +139,10 @@ def test_forwarding_rules_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(ForwardingRulesClient, "rest"),] + "client_class,transport_name", + [ + (ForwardingRulesClient, "rest"), + ], ) def test_forwarding_rules_client_from_service_account_file( client_class, transport_name @@ -176,7 +184,9 @@ def test_forwarding_rules_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(ForwardingRulesClient, transports.ForwardingRulesRestTransport, "rest"),], + [ + (ForwardingRulesClient, transports.ForwardingRulesRestTransport, "rest"), + ], ) @mock.patch.object( ForwardingRulesClient, @@ -469,13 +479,17 @@ def test_forwarding_rules_client_get_mtls_endpoint_and_cert_source(client_class) @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(ForwardingRulesClient, transports.ForwardingRulesRestTransport, "rest"),], + [ + (ForwardingRulesClient, transports.ForwardingRulesRestTransport, "rest"), + ], ) def test_forwarding_rules_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -493,7 +507,9 @@ def test_forwarding_rules_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(ForwardingRulesClient, transports.ForwardingRulesRestTransport, "rest", None),], + [ + (ForwardingRulesClient, transports.ForwardingRulesRestTransport, "rest", None), + ], ) def test_forwarding_rules_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -517,11 +533,16 @@ def test_forwarding_rules_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.AggregatedListForwardingRulesRequest, dict,] + "request_type", + [ + compute.AggregatedListForwardingRulesRequest, + dict, + ], ) def test_aggregated_list_rest(request_type): client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -602,7 +623,8 @@ def test_aggregated_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -703,7 +725,11 @@ def test_aggregated_list_rest_interceptors(null_interceptor): post.return_value = compute.ForwardingRuleAggregatedList client.aggregated_list( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -714,7 +740,8 @@ def test_aggregated_list_rest_bad_request( transport: str = "rest", request_type=compute.AggregatedListForwardingRulesRequest ): client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -735,7 +762,8 @@ def test_aggregated_list_rest_bad_request( def test_aggregated_list_rest_flattened(): client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -747,7 +775,9 @@ def test_aggregated_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -773,20 +803,23 @@ def test_aggregated_list_rest_flattened(): def test_aggregated_list_rest_flattened_error(transport: str = "rest"): client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.aggregated_list( - compute.AggregatedListForwardingRulesRequest(), project="project_value", + compute.AggregatedListForwardingRulesRequest(), + project="project_value", ) def test_aggregated_list_rest_pager(transport: str = "rest"): client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -803,9 +836,14 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): }, next_page_token="abc", ), - compute.ForwardingRuleAggregatedList(items={}, next_page_token="def",), compute.ForwardingRuleAggregatedList( - items={"g": compute.ForwardingRulesScopedList(),}, + items={}, + next_page_token="def", + ), + compute.ForwardingRuleAggregatedList( + items={ + "g": compute.ForwardingRulesScopedList(), + }, next_page_token="ghi", ), compute.ForwardingRuleAggregatedList( @@ -853,10 +891,17 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.DeleteForwardingRuleRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteForwardingRuleRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -974,7 +1019,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1015,7 +1061,14 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("forwardingRule", "project", "region",)) + set(("requestId",)) + & set( + ( + "forwardingRule", + "project", + "region", + ) + ) ) @@ -1061,7 +1114,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1072,7 +1129,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteForwardingRuleRequest ): client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1097,7 +1155,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1143,7 +1202,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1163,10 +1223,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetForwardingRuleRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetForwardingRuleRequest, + dict, + ], +) def test_get_rest(request_type): client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1290,7 +1357,8 @@ def test_get_rest_required_fields(request_type=compute.GetForwardingRuleRequest) assert jsonified_request["region"] == "region_value" client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1331,7 +1399,14 @@ def test_get_rest_unset_required_fields(): unset_fields = transport.get._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("forwardingRule", "project", "region",)) + set(()) + & set( + ( + "forwardingRule", + "project", + "region", + ) + ) ) @@ -1378,7 +1453,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.ForwardingRule - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1388,7 +1469,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetForwardingRuleRequest ): client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1413,7 +1495,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1459,7 +1542,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1479,10 +1563,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertForwardingRuleRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertForwardingRuleRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1635,7 +1726,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1677,7 +1769,14 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("forwardingRuleResource", "project", "region",)) + set(("requestId",)) + & set( + ( + "forwardingRuleResource", + "project", + "region", + ) + ) ) @@ -1723,7 +1822,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1734,7 +1837,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertForwardingRuleRequest ): client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1798,7 +1902,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1842,7 +1947,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1864,10 +1970,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListForwardingRulesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListForwardingRulesRequest, + dict, + ], +) def test_list_rest(request_type): client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1930,7 +2043,13 @@ def test_list_rest_required_fields(request_type=compute.ListForwardingRulesReque ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1941,7 +2060,8 @@ def test_list_rest_required_fields(request_type=compute.ListForwardingRulesReque assert jsonified_request["region"] == "region_value" client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1982,8 +2102,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "region",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "region", + ) + ) ) @@ -2030,7 +2163,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.ForwardingRuleList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2040,7 +2179,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListForwardingRulesRequest ): client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2061,7 +2201,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2073,7 +2214,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "region": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", region="region_value",) + mock_args = dict( + project="project_value", + region="region_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2099,7 +2243,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2114,7 +2259,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2131,12 +2277,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.ForwardingRuleList(items=[], next_page_token="def",), compute.ForwardingRuleList( - items=[compute.ForwardingRule(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.ForwardingRuleList( - items=[compute.ForwardingRule(), compute.ForwardingRule(),], + items=[ + compute.ForwardingRule(), + ], + next_page_token="ghi", + ), + compute.ForwardingRuleList( + items=[ + compute.ForwardingRule(), + compute.ForwardingRule(), + ], ), ) # Two responses for two calls @@ -2163,10 +2318,17 @@ def test_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.PatchForwardingRuleRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.PatchForwardingRuleRequest, + dict, + ], +) def test_patch_unary_rest(request_type): client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2327,7 +2489,8 @@ def test_patch_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2370,7 +2533,14 @@ def test_patch_unary_rest_unset_required_fields(): unset_fields = transport.patch._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("forwardingRule", "forwardingRuleResource", "project", "region",)) + & set( + ( + "forwardingRule", + "forwardingRuleResource", + "project", + "region", + ) + ) ) @@ -2415,7 +2585,13 @@ def test_patch_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.patch_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2425,7 +2601,8 @@ def test_patch_unary_rest_bad_request( transport: str = "rest", request_type=compute.PatchForwardingRuleRequest ): client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2493,7 +2670,8 @@ def test_patch_unary_rest_bad_request( def test_patch_unary_rest_flattened(): client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2542,7 +2720,8 @@ def test_patch_unary_rest_flattened(): def test_patch_unary_rest_flattened_error(transport: str = "rest"): client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2566,11 +2745,16 @@ def test_patch_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SetLabelsForwardingRuleRequest, dict,] + "request_type", + [ + compute.SetLabelsForwardingRuleRequest, + dict, + ], ) def test_set_labels_unary_rest(request_type): client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2688,7 +2872,8 @@ def test_set_labels_unary_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2731,7 +2916,14 @@ def test_set_labels_unary_rest_unset_required_fields(): unset_fields = transport.set_labels._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("project", "region", "regionSetLabelsRequestResource", "resource",)) + & set( + ( + "project", + "region", + "regionSetLabelsRequestResource", + "resource", + ) + ) ) @@ -2777,7 +2969,11 @@ def test_set_labels_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_labels_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2788,7 +2984,8 @@ def test_set_labels_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetLabelsForwardingRuleRequest ): client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2813,7 +3010,8 @@ def test_set_labels_unary_rest_bad_request( def test_set_labels_unary_rest_flattened(): client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2862,7 +3060,8 @@ def test_set_labels_unary_rest_flattened(): def test_set_labels_unary_rest_flattened_error(transport: str = "rest"): client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2886,11 +3085,16 @@ def test_set_labels_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SetTargetForwardingRuleRequest, dict,] + "request_type", + [ + compute.SetTargetForwardingRuleRequest, + dict, + ], ) def test_set_target_unary_rest(request_type): client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3009,7 +3213,8 @@ def test_set_target_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3052,7 +3257,14 @@ def test_set_target_unary_rest_unset_required_fields(): unset_fields = transport.set_target._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("forwardingRule", "project", "region", "targetReferenceResource",)) + & set( + ( + "forwardingRule", + "project", + "region", + "targetReferenceResource", + ) + ) ) @@ -3098,7 +3310,11 @@ def test_set_target_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_target_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3109,7 +3325,8 @@ def test_set_target_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetTargetForwardingRuleRequest ): client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3135,7 +3352,8 @@ def test_set_target_unary_rest_bad_request( def test_set_target_unary_rest_flattened(): client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3182,7 +3400,8 @@ def test_set_target_unary_rest_flattened(): def test_set_target_unary_rest_flattened_error(transport: str = "rest"): client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3210,7 +3429,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -3230,7 +3450,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = ForwardingRulesClient(client_options=options, transport=transport,) + client = ForwardingRulesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -3246,7 +3469,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ForwardingRulesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -3259,7 +3483,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.ForwardingRulesRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.ForwardingRulesRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -3317,7 +3546,8 @@ def test_forwarding_rules_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ForwardingRulesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -3367,7 +3597,12 @@ def test_forwarding_rules_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_forwarding_rules_host_no_port(transport_name): client = ForwardingRulesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3383,7 +3618,12 @@ def test_forwarding_rules_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_forwarding_rules_host_with_port(transport_name): client = ForwardingRulesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3421,7 +3661,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = ForwardingRulesClient.common_folder_path(folder) assert expected == actual @@ -3439,7 +3681,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = ForwardingRulesClient.common_organization_path(organization) assert expected == actual @@ -3457,7 +3701,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = ForwardingRulesClient.common_project_path(project) assert expected == actual @@ -3477,7 +3723,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = ForwardingRulesClient.common_location_path(project, location) assert expected == actual @@ -3502,7 +3749,8 @@ def test_client_with_default_client_info(): transports.ForwardingRulesTransport, "_prep_wrapped_messages" ) as prep: client = ForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3511,7 +3759,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ForwardingRulesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3551,7 +3800,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(ForwardingRulesClient, transports.ForwardingRulesRestTransport),], + [ + (ForwardingRulesClient, transports.ForwardingRulesRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_global_addresses.py b/tests/unit/gapic/compute_v1/test_global_addresses.py index fc68dd6ef..673afca97 100644 --- a/tests/unit/gapic/compute_v1/test_global_addresses.py +++ b/tests/unit/gapic/compute_v1/test_global_addresses.py @@ -89,7 +89,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(GlobalAddressesClient, "rest"),] + "client_class,transport_name", + [ + (GlobalAddressesClient, "rest"), + ], ) def test_global_addresses_client_from_service_account_info( client_class, transport_name @@ -113,7 +116,9 @@ def test_global_addresses_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.GlobalAddressesRestTransport, "rest"),], + [ + (transports.GlobalAddressesRestTransport, "rest"), + ], ) def test_global_addresses_client_service_account_always_use_jwt( transport_class, transport_name @@ -134,7 +139,10 @@ def test_global_addresses_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(GlobalAddressesClient, "rest"),] + "client_class,transport_name", + [ + (GlobalAddressesClient, "rest"), + ], ) def test_global_addresses_client_from_service_account_file( client_class, transport_name @@ -176,7 +184,9 @@ def test_global_addresses_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(GlobalAddressesClient, transports.GlobalAddressesRestTransport, "rest"),], + [ + (GlobalAddressesClient, transports.GlobalAddressesRestTransport, "rest"), + ], ) @mock.patch.object( GlobalAddressesClient, @@ -469,13 +479,17 @@ def test_global_addresses_client_get_mtls_endpoint_and_cert_source(client_class) @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(GlobalAddressesClient, transports.GlobalAddressesRestTransport, "rest"),], + [ + (GlobalAddressesClient, transports.GlobalAddressesRestTransport, "rest"), + ], ) def test_global_addresses_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -493,7 +507,9 @@ def test_global_addresses_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(GlobalAddressesClient, transports.GlobalAddressesRestTransport, "rest", None),], + [ + (GlobalAddressesClient, transports.GlobalAddressesRestTransport, "rest", None), + ], ) def test_global_addresses_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -516,10 +532,17 @@ def test_global_addresses_client_client_options_credentials_file( ) -@pytest.mark.parametrize("request_type", [compute.DeleteGlobalAddressRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteGlobalAddressRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = GlobalAddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -629,7 +652,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = GlobalAddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -669,7 +693,15 @@ def test_delete_unary_rest_unset_required_fields(): ) unset_fields = transport.delete._get_unset_required_fields({}) - assert set(unset_fields) == (set(("requestId",)) & set(("address", "project",))) + assert set(unset_fields) == ( + set(("requestId",)) + & set( + ( + "address", + "project", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -714,7 +746,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -725,7 +761,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteGlobalAddressRequest ): client = GlobalAddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -746,7 +783,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = GlobalAddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -758,7 +796,10 @@ def test_delete_unary_rest_flattened(): sample_request = {"project": "sample1", "address": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", address="address_value",) + mock_args = dict( + project="project_value", + address="address_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -784,7 +825,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = GlobalAddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -803,10 +845,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetGlobalAddressRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetGlobalAddressRequest, + dict, + ], +) def test_get_rest(request_type): client = GlobalAddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -902,7 +951,8 @@ def test_get_rest_required_fields(request_type=compute.GetGlobalAddressRequest): assert jsonified_request["project"] == "project_value" client = GlobalAddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -942,7 +992,15 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("address", "project",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "address", + "project", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -986,7 +1044,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Address - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -996,7 +1060,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetGlobalAddressRequest ): client = GlobalAddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1017,7 +1082,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = GlobalAddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1029,7 +1095,10 @@ def test_get_rest_flattened(): sample_request = {"project": "sample1", "address": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", address="address_value",) + mock_args = dict( + project="project_value", + address="address_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1055,7 +1124,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = GlobalAddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1074,10 +1144,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertGlobalAddressRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertGlobalAddressRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = GlobalAddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1202,7 +1279,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = GlobalAddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1244,7 +1322,13 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("addressResource", "project",)) + set(("requestId",)) + & set( + ( + "addressResource", + "project", + ) + ) ) @@ -1290,7 +1374,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1301,7 +1389,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertGlobalAddressRequest ): client = GlobalAddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1341,7 +1430,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = GlobalAddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1382,7 +1472,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = GlobalAddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1401,10 +1492,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListGlobalAddressesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListGlobalAddressesRequest, + dict, + ], +) def test_list_rest(request_type): client = GlobalAddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1465,7 +1563,13 @@ def test_list_rest_required_fields(request_type=compute.ListGlobalAddressesReque ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1474,7 +1578,8 @@ def test_list_rest_required_fields(request_type=compute.ListGlobalAddressesReque assert jsonified_request["project"] == "project_value" client = GlobalAddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1515,7 +1620,15 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set(("project",)) ) @@ -1561,7 +1674,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.AddressList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1571,7 +1690,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListGlobalAddressesRequest ): client = GlobalAddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1592,7 +1712,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = GlobalAddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1604,7 +1725,9 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1630,20 +1753,23 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = GlobalAddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list( - compute.ListGlobalAddressesRequest(), project="project_value", + compute.ListGlobalAddressesRequest(), + project="project_value", ) def test_list_rest_pager(transport: str = "rest"): client = GlobalAddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1653,12 +1779,29 @@ def test_list_rest_pager(transport: str = "rest"): # Set the response as a series of pages response = ( compute.AddressList( - items=[compute.Address(), compute.Address(), compute.Address(),], + items=[ + compute.Address(), + compute.Address(), + compute.Address(), + ], next_page_token="abc", ), - compute.AddressList(items=[], next_page_token="def",), - compute.AddressList(items=[compute.Address(),], next_page_token="ghi",), - compute.AddressList(items=[compute.Address(), compute.Address(),],), + compute.AddressList( + items=[], + next_page_token="def", + ), + compute.AddressList( + items=[ + compute.Address(), + ], + next_page_token="ghi", + ), + compute.AddressList( + items=[ + compute.Address(), + compute.Address(), + ], + ), ) # Two responses for two calls response = response + response @@ -1691,7 +1834,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = GlobalAddressesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1711,7 +1855,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = GlobalAddressesClient(client_options=options, transport=transport,) + client = GlobalAddressesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1727,7 +1874,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = GlobalAddressesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1740,7 +1888,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.GlobalAddressesRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.GlobalAddressesRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -1794,7 +1947,8 @@ def test_global_addresses_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.GlobalAddressesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1844,7 +1998,12 @@ def test_global_addresses_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_global_addresses_host_no_port(transport_name): client = GlobalAddressesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1860,7 +2019,12 @@ def test_global_addresses_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_global_addresses_host_with_port(transport_name): client = GlobalAddressesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1898,7 +2062,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = GlobalAddressesClient.common_folder_path(folder) assert expected == actual @@ -1916,7 +2082,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = GlobalAddressesClient.common_organization_path(organization) assert expected == actual @@ -1934,7 +2102,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = GlobalAddressesClient.common_project_path(project) assert expected == actual @@ -1954,7 +2124,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = GlobalAddressesClient.common_location_path(project, location) assert expected == actual @@ -1979,7 +2150,8 @@ def test_client_with_default_client_info(): transports.GlobalAddressesTransport, "_prep_wrapped_messages" ) as prep: client = GlobalAddressesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1988,7 +2160,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = GlobalAddressesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2028,7 +2201,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(GlobalAddressesClient, transports.GlobalAddressesRestTransport),], + [ + (GlobalAddressesClient, transports.GlobalAddressesRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_global_forwarding_rules.py b/tests/unit/gapic/compute_v1/test_global_forwarding_rules.py index e8cacced7..aa479b043 100644 --- a/tests/unit/gapic/compute_v1/test_global_forwarding_rules.py +++ b/tests/unit/gapic/compute_v1/test_global_forwarding_rules.py @@ -92,7 +92,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(GlobalForwardingRulesClient, "rest"),] + "client_class,transport_name", + [ + (GlobalForwardingRulesClient, "rest"), + ], ) def test_global_forwarding_rules_client_from_service_account_info( client_class, transport_name @@ -116,7 +119,9 @@ def test_global_forwarding_rules_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.GlobalForwardingRulesRestTransport, "rest"),], + [ + (transports.GlobalForwardingRulesRestTransport, "rest"), + ], ) def test_global_forwarding_rules_client_service_account_always_use_jwt( transport_class, transport_name @@ -137,7 +142,10 @@ def test_global_forwarding_rules_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(GlobalForwardingRulesClient, "rest"),] + "client_class,transport_name", + [ + (GlobalForwardingRulesClient, "rest"), + ], ) def test_global_forwarding_rules_client_from_service_account_file( client_class, transport_name @@ -490,7 +498,9 @@ def test_global_forwarding_rules_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -539,11 +549,16 @@ def test_global_forwarding_rules_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.DeleteGlobalForwardingRuleRequest, dict,] + "request_type", + [ + compute.DeleteGlobalForwardingRuleRequest, + dict, + ], ) def test_delete_unary_rest(request_type): client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -653,7 +668,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -694,7 +710,13 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("forwardingRule", "project",)) + set(("requestId",)) + & set( + ( + "forwardingRule", + "project", + ) + ) ) @@ -740,7 +762,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -751,7 +777,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteGlobalForwardingRuleRequest ): client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -772,7 +799,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -785,7 +813,8 @@ def test_delete_unary_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", forwarding_rule="forwarding_rule_value", + project="project_value", + forwarding_rule="forwarding_rule_value", ) mock_args.update(sample_request) @@ -812,7 +841,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -832,11 +862,16 @@ def test_delete_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.GetGlobalForwardingRuleRequest, dict,] + "request_type", + [ + compute.GetGlobalForwardingRuleRequest, + dict, + ], ) def test_get_rest(request_type): client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -952,7 +987,8 @@ def test_get_rest_required_fields(request_type=compute.GetGlobalForwardingRuleRe assert jsonified_request["project"] == "project_value" client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -992,7 +1028,15 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("forwardingRule", "project",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "forwardingRule", + "project", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1038,7 +1082,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.ForwardingRule - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1048,7 +1098,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetGlobalForwardingRuleRequest ): client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1069,7 +1120,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1082,7 +1134,8 @@ def test_get_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", forwarding_rule="forwarding_rule_value", + project="project_value", + forwarding_rule="forwarding_rule_value", ) mock_args.update(sample_request) @@ -1109,7 +1162,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1129,11 +1183,16 @@ def test_get_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.InsertGlobalForwardingRuleRequest, dict,] + "request_type", + [ + compute.InsertGlobalForwardingRuleRequest, + dict, + ], ) def test_insert_unary_rest(request_type): client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1282,7 +1341,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1324,7 +1384,13 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("forwardingRuleResource", "project",)) + set(("requestId",)) + & set( + ( + "forwardingRuleResource", + "project", + ) + ) ) @@ -1370,7 +1436,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1381,7 +1451,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertGlobalForwardingRuleRequest ): client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1445,7 +1516,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1488,7 +1560,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1510,11 +1583,16 @@ def test_insert_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.ListGlobalForwardingRulesRequest, dict,] + "request_type", + [ + compute.ListGlobalForwardingRulesRequest, + dict, + ], ) def test_list_rest(request_type): client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1577,7 +1655,13 @@ def test_list_rest_required_fields( ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1586,7 +1670,8 @@ def test_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1627,7 +1712,15 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set(("project",)) ) @@ -1675,7 +1768,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.ForwardingRuleList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1685,7 +1784,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListGlobalForwardingRulesRequest ): client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1706,7 +1806,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1718,7 +1819,9 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1744,20 +1847,23 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list( - compute.ListGlobalForwardingRulesRequest(), project="project_value", + compute.ListGlobalForwardingRulesRequest(), + project="project_value", ) def test_list_rest_pager(transport: str = "rest"): client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1774,12 +1880,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.ForwardingRuleList(items=[], next_page_token="def",), compute.ForwardingRuleList( - items=[compute.ForwardingRule(),], next_page_token="ghi", + items=[], + next_page_token="def", + ), + compute.ForwardingRuleList( + items=[ + compute.ForwardingRule(), + ], + next_page_token="ghi", ), compute.ForwardingRuleList( - items=[compute.ForwardingRule(), compute.ForwardingRule(),], + items=[ + compute.ForwardingRule(), + compute.ForwardingRule(), + ], ), ) # Two responses for two calls @@ -1807,11 +1922,16 @@ def test_list_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.PatchGlobalForwardingRuleRequest, dict,] + "request_type", + [ + compute.PatchGlobalForwardingRuleRequest, + dict, + ], ) def test_patch_unary_rest(request_type): client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1964,7 +2084,8 @@ def test_patch_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2007,7 +2128,13 @@ def test_patch_unary_rest_unset_required_fields(): unset_fields = transport.patch._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("forwardingRule", "forwardingRuleResource", "project",)) + & set( + ( + "forwardingRule", + "forwardingRuleResource", + "project", + ) + ) ) @@ -2052,7 +2179,13 @@ def test_patch_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.patch_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2062,7 +2195,8 @@ def test_patch_unary_rest_bad_request( transport: str = "rest", request_type=compute.PatchGlobalForwardingRuleRequest ): client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2126,7 +2260,8 @@ def test_patch_unary_rest_bad_request( def test_patch_unary_rest_flattened(): client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2170,7 +2305,8 @@ def test_patch_unary_rest_flattened(): def test_patch_unary_rest_flattened_error(transport: str = "rest"): client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2193,11 +2329,16 @@ def test_patch_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SetLabelsGlobalForwardingRuleRequest, dict,] + "request_type", + [ + compute.SetLabelsGlobalForwardingRuleRequest, + dict, + ], ) def test_set_labels_unary_rest(request_type): client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2309,7 +2450,8 @@ def test_set_labels_unary_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2351,7 +2493,14 @@ def test_set_labels_unary_rest_unset_required_fields(): unset_fields = transport.set_labels._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("globalSetLabelsRequestResource", "project", "resource",)) + set(()) + & set( + ( + "globalSetLabelsRequestResource", + "project", + "resource", + ) + ) ) @@ -2397,7 +2546,11 @@ def test_set_labels_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_labels_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2408,7 +2561,8 @@ def test_set_labels_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetLabelsGlobalForwardingRuleRequest ): client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2433,7 +2587,8 @@ def test_set_labels_unary_rest_bad_request( def test_set_labels_unary_rest_flattened(): client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2477,7 +2632,8 @@ def test_set_labels_unary_rest_flattened(): def test_set_labels_unary_rest_flattened_error(transport: str = "rest"): client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2500,11 +2656,16 @@ def test_set_labels_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SetTargetGlobalForwardingRuleRequest, dict,] + "request_type", + [ + compute.SetTargetGlobalForwardingRuleRequest, + dict, + ], ) def test_set_target_unary_rest(request_type): client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2615,7 +2776,8 @@ def test_set_target_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2658,7 +2820,13 @@ def test_set_target_unary_rest_unset_required_fields(): unset_fields = transport.set_target._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("forwardingRule", "project", "targetReferenceResource",)) + & set( + ( + "forwardingRule", + "project", + "targetReferenceResource", + ) + ) ) @@ -2704,7 +2872,11 @@ def test_set_target_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_target_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2715,7 +2887,8 @@ def test_set_target_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetTargetGlobalForwardingRuleRequest ): client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2737,7 +2910,8 @@ def test_set_target_unary_rest_bad_request( def test_set_target_unary_rest_flattened(): client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2779,7 +2953,8 @@ def test_set_target_unary_rest_flattened(): def test_set_target_unary_rest_flattened_error(transport: str = "rest"): client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2806,7 +2981,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2827,7 +3003,8 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = GlobalForwardingRulesClient( - client_options=options, transport=transport, + client_options=options, + transport=transport, ) # It is an error to provide an api_key and a credential. @@ -2844,7 +3021,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = GlobalForwardingRulesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2858,7 +3036,10 @@ def test_transport_instance(): @pytest.mark.parametrize( - "transport_class", [transports.GlobalForwardingRulesRestTransport,] + "transport_class", + [ + transports.GlobalForwardingRulesRestTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -2916,7 +3097,8 @@ def test_global_forwarding_rules_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.GlobalForwardingRulesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2966,7 +3148,12 @@ def test_global_forwarding_rules_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_global_forwarding_rules_host_no_port(transport_name): client = GlobalForwardingRulesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2982,7 +3169,12 @@ def test_global_forwarding_rules_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_global_forwarding_rules_host_with_port(transport_name): client = GlobalForwardingRulesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3020,7 +3212,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = GlobalForwardingRulesClient.common_folder_path(folder) assert expected == actual @@ -3038,7 +3232,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = GlobalForwardingRulesClient.common_organization_path(organization) assert expected == actual @@ -3056,7 +3252,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = GlobalForwardingRulesClient.common_project_path(project) assert expected == actual @@ -3076,7 +3274,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = GlobalForwardingRulesClient.common_location_path(project, location) assert expected == actual @@ -3101,7 +3300,8 @@ def test_client_with_default_client_info(): transports.GlobalForwardingRulesTransport, "_prep_wrapped_messages" ) as prep: client = GlobalForwardingRulesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3110,7 +3310,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = GlobalForwardingRulesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3150,7 +3351,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(GlobalForwardingRulesClient, transports.GlobalForwardingRulesRestTransport),], + [ + (GlobalForwardingRulesClient, transports.GlobalForwardingRulesRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_global_network_endpoint_groups.py b/tests/unit/gapic/compute_v1/test_global_network_endpoint_groups.py index 5cf4bf220..c8bf2e284 100644 --- a/tests/unit/gapic/compute_v1/test_global_network_endpoint_groups.py +++ b/tests/unit/gapic/compute_v1/test_global_network_endpoint_groups.py @@ -94,7 +94,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(GlobalNetworkEndpointGroupsClient, "rest"),] + "client_class,transport_name", + [ + (GlobalNetworkEndpointGroupsClient, "rest"), + ], ) def test_global_network_endpoint_groups_client_from_service_account_info( client_class, transport_name @@ -118,7 +121,9 @@ def test_global_network_endpoint_groups_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.GlobalNetworkEndpointGroupsRestTransport, "rest"),], + [ + (transports.GlobalNetworkEndpointGroupsRestTransport, "rest"), + ], ) def test_global_network_endpoint_groups_client_service_account_always_use_jwt( transport_class, transport_name @@ -139,7 +144,10 @@ def test_global_network_endpoint_groups_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(GlobalNetworkEndpointGroupsClient, "rest"),] + "client_class,transport_name", + [ + (GlobalNetworkEndpointGroupsClient, "rest"), + ], ) def test_global_network_endpoint_groups_client_from_service_account_file( client_class, transport_name @@ -498,7 +506,9 @@ def test_global_network_endpoint_groups_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -548,11 +558,15 @@ def test_global_network_endpoint_groups_client_client_options_credentials_file( @pytest.mark.parametrize( "request_type", - [compute.AttachNetworkEndpointsGlobalNetworkEndpointGroupRequest, dict,], + [ + compute.AttachNetworkEndpointsGlobalNetworkEndpointGroupRequest, + dict, + ], ) def test_attach_network_endpoints_unary_rest(request_type): client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -673,7 +687,8 @@ def test_attach_network_endpoints_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -770,7 +785,11 @@ def test_attach_network_endpoints_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.attach_network_endpoints_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -782,7 +801,8 @@ def test_attach_network_endpoints_unary_rest_bad_request( request_type=compute.AttachNetworkEndpointsGlobalNetworkEndpointGroupRequest, ): client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -814,7 +834,8 @@ def test_attach_network_endpoints_unary_rest_bad_request( def test_attach_network_endpoints_unary_rest_flattened(): client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -860,7 +881,8 @@ def test_attach_network_endpoints_unary_rest_flattened(): def test_attach_network_endpoints_unary_rest_flattened_error(transport: str = "rest"): client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -885,11 +907,16 @@ def test_attach_network_endpoints_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.DeleteGlobalNetworkEndpointGroupRequest, dict,] + "request_type", + [ + compute.DeleteGlobalNetworkEndpointGroupRequest, + dict, + ], ) def test_delete_unary_rest(request_type): client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -999,7 +1026,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1040,7 +1068,13 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("networkEndpointGroup", "project",)) + set(("requestId",)) + & set( + ( + "networkEndpointGroup", + "project", + ) + ) ) @@ -1086,7 +1120,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1098,7 +1136,8 @@ def test_delete_unary_rest_bad_request( request_type=compute.DeleteGlobalNetworkEndpointGroupRequest, ): client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1119,7 +1158,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1160,7 +1200,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1181,11 +1222,15 @@ def test_delete_unary_rest_error(): @pytest.mark.parametrize( "request_type", - [compute.DetachNetworkEndpointsGlobalNetworkEndpointGroupRequest, dict,], + [ + compute.DetachNetworkEndpointsGlobalNetworkEndpointGroupRequest, + dict, + ], ) def test_detach_network_endpoints_unary_rest(request_type): client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1306,7 +1351,8 @@ def test_detach_network_endpoints_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1403,7 +1449,11 @@ def test_detach_network_endpoints_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.detach_network_endpoints_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1415,7 +1465,8 @@ def test_detach_network_endpoints_unary_rest_bad_request( request_type=compute.DetachNetworkEndpointsGlobalNetworkEndpointGroupRequest, ): client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1447,7 +1498,8 @@ def test_detach_network_endpoints_unary_rest_bad_request( def test_detach_network_endpoints_unary_rest_flattened(): client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1493,7 +1545,8 @@ def test_detach_network_endpoints_unary_rest_flattened(): def test_detach_network_endpoints_unary_rest_flattened_error(transport: str = "rest"): client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1518,11 +1571,16 @@ def test_detach_network_endpoints_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.GetGlobalNetworkEndpointGroupRequest, dict,] + "request_type", + [ + compute.GetGlobalNetworkEndpointGroupRequest, + dict, + ], ) def test_get_rest(request_type): client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1614,7 +1672,8 @@ def test_get_rest_required_fields( assert jsonified_request["project"] == "project_value" client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1654,7 +1713,15 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("networkEndpointGroup", "project",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "networkEndpointGroup", + "project", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1700,7 +1767,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.NetworkEndpointGroup - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1710,7 +1783,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetGlobalNetworkEndpointGroupRequest ): client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1731,7 +1805,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1772,7 +1847,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1792,11 +1868,16 @@ def test_get_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.InsertGlobalNetworkEndpointGroupRequest, dict,] + "request_type", + [ + compute.InsertGlobalNetworkEndpointGroupRequest, + dict, + ], ) def test_insert_unary_rest(request_type): client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1930,7 +2011,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1972,7 +2054,13 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("networkEndpointGroupResource", "project",)) + set(("requestId",)) + & set( + ( + "networkEndpointGroupResource", + "project", + ) + ) ) @@ -2018,7 +2106,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2030,7 +2122,8 @@ def test_insert_unary_rest_bad_request( request_type=compute.InsertGlobalNetworkEndpointGroupRequest, ): client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2079,7 +2172,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2122,7 +2216,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2144,11 +2239,16 @@ def test_insert_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.ListGlobalNetworkEndpointGroupsRequest, dict,] + "request_type", + [ + compute.ListGlobalNetworkEndpointGroupsRequest, + dict, + ], ) def test_list_rest(request_type): client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2211,7 +2311,13 @@ def test_list_rest_required_fields( ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -2220,7 +2326,8 @@ def test_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2261,7 +2368,15 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set(("project",)) ) @@ -2309,7 +2424,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.NetworkEndpointGroupList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2319,7 +2440,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListGlobalNetworkEndpointGroupsRequest ): client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2340,7 +2462,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2352,7 +2475,9 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2378,20 +2503,23 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list( - compute.ListGlobalNetworkEndpointGroupsRequest(), project="project_value", + compute.ListGlobalNetworkEndpointGroupsRequest(), + project="project_value", ) def test_list_rest_pager(transport: str = "rest"): client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2408,12 +2536,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.NetworkEndpointGroupList(items=[], next_page_token="def",), compute.NetworkEndpointGroupList( - items=[compute.NetworkEndpointGroup(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.NetworkEndpointGroupList( - items=[compute.NetworkEndpointGroup(), compute.NetworkEndpointGroup(),], + items=[ + compute.NetworkEndpointGroup(), + ], + next_page_token="ghi", + ), + compute.NetworkEndpointGroupList( + items=[ + compute.NetworkEndpointGroup(), + compute.NetworkEndpointGroup(), + ], ), ) # Two responses for two calls @@ -2442,11 +2579,15 @@ def test_list_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( "request_type", - [compute.ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest, dict,], + [ + compute.ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest, + dict, + ], ) def test_list_network_endpoints_rest(request_type): client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2457,7 +2598,9 @@ def test_list_network_endpoints_rest(request_type): with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. return_value = compute.NetworkEndpointGroupsListNetworkEndpoints( - id="id_value", kind="kind_value", next_page_token="next_page_token_value", + id="id_value", + kind="kind_value", + next_page_token="next_page_token_value", ) # Wrap the value into a proper Response obj @@ -2509,7 +2652,13 @@ def test_list_network_endpoints_rest_required_fields( ).list_network_endpoints._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -2520,7 +2669,8 @@ def test_list_network_endpoints_rest_required_fields( assert jsonified_request["project"] == "project_value" client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2543,8 +2693,8 @@ def test_list_network_endpoints_rest_required_fields( response_value = Response() response_value.status_code = 200 - json_return_value = compute.NetworkEndpointGroupsListNetworkEndpoints.to_json( - return_value + json_return_value = ( + compute.NetworkEndpointGroupsListNetworkEndpoints.to_json(return_value) ) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -2563,8 +2713,21 @@ def test_list_network_endpoints_rest_unset_required_fields(): unset_fields = transport.list_network_endpoints._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("networkEndpointGroup", "project",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "networkEndpointGroup", + "project", + ) + ) ) @@ -2601,8 +2764,10 @@ def test_list_network_endpoints_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = compute.NetworkEndpointGroupsListNetworkEndpoints.to_json( - compute.NetworkEndpointGroupsListNetworkEndpoints() + req.return_value._content = ( + compute.NetworkEndpointGroupsListNetworkEndpoints.to_json( + compute.NetworkEndpointGroupsListNetworkEndpoints() + ) ) request = compute.ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest() @@ -2614,7 +2779,11 @@ def test_list_network_endpoints_rest_interceptors(null_interceptor): post.return_value = compute.NetworkEndpointGroupsListNetworkEndpoints client.list_network_endpoints( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2626,7 +2795,8 @@ def test_list_network_endpoints_rest_bad_request( request_type=compute.ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest, ): client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2647,7 +2817,8 @@ def test_list_network_endpoints_rest_bad_request( def test_list_network_endpoints_rest_flattened(): client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2690,7 +2861,8 @@ def test_list_network_endpoints_rest_flattened(): def test_list_network_endpoints_rest_flattened_error(transport: str = "rest"): client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2705,7 +2877,8 @@ def test_list_network_endpoints_rest_flattened_error(transport: str = "rest"): def test_list_network_endpoints_rest_pager(transport: str = "rest"): client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2723,10 +2896,13 @@ def test_list_network_endpoints_rest_pager(transport: str = "rest"): next_page_token="abc", ), compute.NetworkEndpointGroupsListNetworkEndpoints( - items=[], next_page_token="def", + items=[], + next_page_token="def", ), compute.NetworkEndpointGroupsListNetworkEndpoints( - items=[compute.NetworkEndpointWithHealthStatus(),], + items=[ + compute.NetworkEndpointWithHealthStatus(), + ], next_page_token="ghi", ), compute.NetworkEndpointGroupsListNetworkEndpoints( @@ -2772,7 +2948,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2793,7 +2970,8 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = GlobalNetworkEndpointGroupsClient( - client_options=options, transport=transport, + client_options=options, + transport=transport, ) # It is an error to provide an api_key and a credential. @@ -2810,7 +2988,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = GlobalNetworkEndpointGroupsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2824,7 +3003,10 @@ def test_transport_instance(): @pytest.mark.parametrize( - "transport_class", [transports.GlobalNetworkEndpointGroupsRestTransport,] + "transport_class", + [ + transports.GlobalNetworkEndpointGroupsRestTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -2882,7 +3064,8 @@ def test_global_network_endpoint_groups_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.GlobalNetworkEndpointGroupsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2932,7 +3115,12 @@ def test_global_network_endpoint_groups_http_transport_client_cert_source_for_mt mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_global_network_endpoint_groups_host_no_port(transport_name): client = GlobalNetworkEndpointGroupsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2948,7 +3136,12 @@ def test_global_network_endpoint_groups_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_global_network_endpoint_groups_host_with_port(transport_name): client = GlobalNetworkEndpointGroupsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2988,7 +3181,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = GlobalNetworkEndpointGroupsClient.common_folder_path(folder) assert expected == actual @@ -3006,7 +3201,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = GlobalNetworkEndpointGroupsClient.common_organization_path(organization) assert expected == actual @@ -3024,7 +3221,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = GlobalNetworkEndpointGroupsClient.common_project_path(project) assert expected == actual @@ -3044,7 +3243,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = GlobalNetworkEndpointGroupsClient.common_location_path(project, location) assert expected == actual @@ -3069,7 +3269,8 @@ def test_client_with_default_client_info(): transports.GlobalNetworkEndpointGroupsTransport, "_prep_wrapped_messages" ) as prep: client = GlobalNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3078,7 +3279,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = GlobalNetworkEndpointGroupsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) diff --git a/tests/unit/gapic/compute_v1/test_global_operations.py b/tests/unit/gapic/compute_v1/test_global_operations.py index 8e210341c..639c41048 100644 --- a/tests/unit/gapic/compute_v1/test_global_operations.py +++ b/tests/unit/gapic/compute_v1/test_global_operations.py @@ -90,7 +90,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(GlobalOperationsClient, "rest"),] + "client_class,transport_name", + [ + (GlobalOperationsClient, "rest"), + ], ) def test_global_operations_client_from_service_account_info( client_class, transport_name @@ -114,7 +117,9 @@ def test_global_operations_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.GlobalOperationsRestTransport, "rest"),], + [ + (transports.GlobalOperationsRestTransport, "rest"), + ], ) def test_global_operations_client_service_account_always_use_jwt( transport_class, transport_name @@ -135,7 +140,10 @@ def test_global_operations_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(GlobalOperationsClient, "rest"),] + "client_class,transport_name", + [ + (GlobalOperationsClient, "rest"), + ], ) def test_global_operations_client_from_service_account_file( client_class, transport_name @@ -177,7 +185,9 @@ def test_global_operations_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(GlobalOperationsClient, transports.GlobalOperationsRestTransport, "rest"),], + [ + (GlobalOperationsClient, transports.GlobalOperationsRestTransport, "rest"), + ], ) @mock.patch.object( GlobalOperationsClient, @@ -470,13 +480,17 @@ def test_global_operations_client_get_mtls_endpoint_and_cert_source(client_class @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(GlobalOperationsClient, transports.GlobalOperationsRestTransport, "rest"),], + [ + (GlobalOperationsClient, transports.GlobalOperationsRestTransport, "rest"), + ], ) def test_global_operations_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -494,7 +508,14 @@ def test_global_operations_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(GlobalOperationsClient, transports.GlobalOperationsRestTransport, "rest", None),], + [ + ( + GlobalOperationsClient, + transports.GlobalOperationsRestTransport, + "rest", + None, + ), + ], ) def test_global_operations_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -518,11 +539,16 @@ def test_global_operations_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.AggregatedListGlobalOperationsRequest, dict,] + "request_type", + [ + compute.AggregatedListGlobalOperationsRequest, + dict, + ], ) def test_aggregated_list_rest(request_type): client = GlobalOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -603,7 +629,8 @@ def test_aggregated_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = GlobalOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -702,7 +729,11 @@ def test_aggregated_list_rest_interceptors(null_interceptor): post.return_value = compute.OperationAggregatedList client.aggregated_list( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -713,7 +744,8 @@ def test_aggregated_list_rest_bad_request( transport: str = "rest", request_type=compute.AggregatedListGlobalOperationsRequest ): client = GlobalOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -734,7 +766,8 @@ def test_aggregated_list_rest_bad_request( def test_aggregated_list_rest_flattened(): client = GlobalOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -746,7 +779,9 @@ def test_aggregated_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -772,20 +807,23 @@ def test_aggregated_list_rest_flattened(): def test_aggregated_list_rest_flattened_error(transport: str = "rest"): client = GlobalOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.aggregated_list( - compute.AggregatedListGlobalOperationsRequest(), project="project_value", + compute.AggregatedListGlobalOperationsRequest(), + project="project_value", ) def test_aggregated_list_rest_pager(transport: str = "rest"): client = GlobalOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -802,9 +840,15 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): }, next_page_token="abc", ), - compute.OperationAggregatedList(items={}, next_page_token="def",), compute.OperationAggregatedList( - items={"g": compute.OperationsScopedList(),}, next_page_token="ghi", + items={}, + next_page_token="def", + ), + compute.OperationAggregatedList( + items={ + "g": compute.OperationsScopedList(), + }, + next_page_token="ghi", ), compute.OperationAggregatedList( items={ @@ -846,10 +890,17 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.DeleteGlobalOperationRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteGlobalOperationRequest, + dict, + ], +) def test_delete_rest(request_type): client = GlobalOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -910,7 +961,8 @@ def test_delete_rest_required_fields(request_type=compute.DeleteGlobalOperationR assert jsonified_request["project"] == "project_value" client = GlobalOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -952,7 +1004,15 @@ def test_delete_rest_unset_required_fields(): ) unset_fields = transport.delete._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("operation", "project",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "operation", + "project", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -998,7 +1058,13 @@ def test_delete_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.DeleteGlobalOperationResponse - client.delete(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.delete( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1008,7 +1074,8 @@ def test_delete_rest_bad_request( transport: str = "rest", request_type=compute.DeleteGlobalOperationRequest ): client = GlobalOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1029,7 +1096,8 @@ def test_delete_rest_bad_request( def test_delete_rest_flattened(): client = GlobalOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1041,7 +1109,10 @@ def test_delete_rest_flattened(): sample_request = {"project": "sample1", "operation": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", operation="operation_value",) + mock_args = dict( + project="project_value", + operation="operation_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1067,7 +1138,8 @@ def test_delete_rest_flattened(): def test_delete_rest_flattened_error(transport: str = "rest"): client = GlobalOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1086,10 +1158,17 @@ def test_delete_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetGlobalOperationRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetGlobalOperationRequest, + dict, + ], +) def test_get_rest(request_type): client = GlobalOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1195,7 +1274,8 @@ def test_get_rest_required_fields(request_type=compute.GetGlobalOperationRequest assert jsonified_request["project"] == "project_value" client = GlobalOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1235,7 +1315,15 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("operation", "project",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "operation", + "project", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1279,7 +1367,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1289,7 +1383,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetGlobalOperationRequest ): client = GlobalOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1310,7 +1405,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = GlobalOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1322,7 +1418,10 @@ def test_get_rest_flattened(): sample_request = {"project": "sample1", "operation": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", operation="operation_value",) + mock_args = dict( + project="project_value", + operation="operation_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1348,7 +1447,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = GlobalOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1367,10 +1467,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListGlobalOperationsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListGlobalOperationsRequest, + dict, + ], +) def test_list_rest(request_type): client = GlobalOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1431,7 +1538,13 @@ def test_list_rest_required_fields(request_type=compute.ListGlobalOperationsRequ ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1440,7 +1553,8 @@ def test_list_rest_required_fields(request_type=compute.ListGlobalOperationsRequ assert jsonified_request["project"] == "project_value" client = GlobalOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1481,7 +1595,15 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set(("project",)) ) @@ -1529,7 +1651,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.OperationList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1539,7 +1667,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListGlobalOperationsRequest ): client = GlobalOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1560,7 +1689,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = GlobalOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1572,7 +1702,9 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1598,20 +1730,23 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = GlobalOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list( - compute.ListGlobalOperationsRequest(), project="project_value", + compute.ListGlobalOperationsRequest(), + project="project_value", ) def test_list_rest_pager(transport: str = "rest"): client = GlobalOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1621,12 +1756,29 @@ def test_list_rest_pager(transport: str = "rest"): # Set the response as a series of pages response = ( compute.OperationList( - items=[compute.Operation(), compute.Operation(), compute.Operation(),], + items=[ + compute.Operation(), + compute.Operation(), + compute.Operation(), + ], next_page_token="abc", ), - compute.OperationList(items=[], next_page_token="def",), - compute.OperationList(items=[compute.Operation(),], next_page_token="ghi",), - compute.OperationList(items=[compute.Operation(), compute.Operation(),],), + compute.OperationList( + items=[], + next_page_token="def", + ), + compute.OperationList( + items=[ + compute.Operation(), + ], + next_page_token="ghi", + ), + compute.OperationList( + items=[ + compute.Operation(), + compute.Operation(), + ], + ), ) # Two responses for two calls response = response + response @@ -1652,10 +1804,17 @@ def test_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.WaitGlobalOperationRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.WaitGlobalOperationRequest, + dict, + ], +) def test_wait_rest(request_type): client = GlobalOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1761,7 +1920,8 @@ def test_wait_rest_required_fields(request_type=compute.WaitGlobalOperationReque assert jsonified_request["project"] == "project_value" client = GlobalOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1801,7 +1961,15 @@ def test_wait_rest_unset_required_fields(): ) unset_fields = transport.wait._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("operation", "project",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "operation", + "project", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1845,7 +2013,13 @@ def test_wait_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.wait(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.wait( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1855,7 +2029,8 @@ def test_wait_rest_bad_request( transport: str = "rest", request_type=compute.WaitGlobalOperationRequest ): client = GlobalOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1876,7 +2051,8 @@ def test_wait_rest_bad_request( def test_wait_rest_flattened(): client = GlobalOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1888,7 +2064,10 @@ def test_wait_rest_flattened(): sample_request = {"project": "sample1", "operation": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", operation="operation_value",) + mock_args = dict( + project="project_value", + operation="operation_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1914,7 +2093,8 @@ def test_wait_rest_flattened(): def test_wait_rest_flattened_error(transport: str = "rest"): client = GlobalOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1940,7 +2120,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = GlobalOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1960,7 +2141,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = GlobalOperationsClient(client_options=options, transport=transport,) + client = GlobalOperationsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1976,7 +2160,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = GlobalOperationsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1989,7 +2174,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.GlobalOperationsRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.GlobalOperationsRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -2044,7 +2234,8 @@ def test_global_operations_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.GlobalOperationsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2094,7 +2285,12 @@ def test_global_operations_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_global_operations_host_no_port(transport_name): client = GlobalOperationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2110,7 +2306,12 @@ def test_global_operations_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_global_operations_host_with_port(transport_name): client = GlobalOperationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2148,7 +2349,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = GlobalOperationsClient.common_folder_path(folder) assert expected == actual @@ -2166,7 +2369,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = GlobalOperationsClient.common_organization_path(organization) assert expected == actual @@ -2184,7 +2389,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = GlobalOperationsClient.common_project_path(project) assert expected == actual @@ -2204,7 +2411,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = GlobalOperationsClient.common_location_path(project, location) assert expected == actual @@ -2229,7 +2437,8 @@ def test_client_with_default_client_info(): transports.GlobalOperationsTransport, "_prep_wrapped_messages" ) as prep: client = GlobalOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2238,7 +2447,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = GlobalOperationsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2278,7 +2488,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(GlobalOperationsClient, transports.GlobalOperationsRestTransport),], + [ + (GlobalOperationsClient, transports.GlobalOperationsRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_global_organization_operations.py b/tests/unit/gapic/compute_v1/test_global_organization_operations.py index 8dc098460..42b65b014 100644 --- a/tests/unit/gapic/compute_v1/test_global_organization_operations.py +++ b/tests/unit/gapic/compute_v1/test_global_organization_operations.py @@ -94,7 +94,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(GlobalOrganizationOperationsClient, "rest"),] + "client_class,transport_name", + [ + (GlobalOrganizationOperationsClient, "rest"), + ], ) def test_global_organization_operations_client_from_service_account_info( client_class, transport_name @@ -118,7 +121,9 @@ def test_global_organization_operations_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.GlobalOrganizationOperationsRestTransport, "rest"),], + [ + (transports.GlobalOrganizationOperationsRestTransport, "rest"), + ], ) def test_global_organization_operations_client_service_account_always_use_jwt( transport_class, transport_name @@ -139,7 +144,10 @@ def test_global_organization_operations_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(GlobalOrganizationOperationsClient, "rest"),] + "client_class,transport_name", + [ + (GlobalOrganizationOperationsClient, "rest"), + ], ) def test_global_organization_operations_client_from_service_account_file( client_class, transport_name @@ -498,7 +506,9 @@ def test_global_organization_operations_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -547,11 +557,16 @@ def test_global_organization_operations_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.DeleteGlobalOrganizationOperationRequest, dict,] + "request_type", + [ + compute.DeleteGlobalOrganizationOperationRequest, + dict, + ], ) def test_delete_rest(request_type): client = GlobalOrganizationOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -614,7 +629,8 @@ def test_delete_rest_required_fields( assert jsonified_request["operation"] == "operation_value" client = GlobalOrganizationOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -637,8 +653,8 @@ def test_delete_rest_required_fields( response_value = Response() response_value.status_code = 200 - json_return_value = compute.DeleteGlobalOrganizationOperationResponse.to_json( - return_value + json_return_value = ( + compute.DeleteGlobalOrganizationOperationResponse.to_json(return_value) ) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -690,8 +706,10 @@ def test_delete_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = compute.DeleteGlobalOrganizationOperationResponse.to_json( - compute.DeleteGlobalOrganizationOperationResponse() + req.return_value._content = ( + compute.DeleteGlobalOrganizationOperationResponse.to_json( + compute.DeleteGlobalOrganizationOperationResponse() + ) ) request = compute.DeleteGlobalOrganizationOperationRequest() @@ -702,7 +720,13 @@ def test_delete_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.DeleteGlobalOrganizationOperationResponse - client.delete(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.delete( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -713,7 +737,8 @@ def test_delete_rest_bad_request( request_type=compute.DeleteGlobalOrganizationOperationRequest, ): client = GlobalOrganizationOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -734,7 +759,8 @@ def test_delete_rest_bad_request( def test_delete_rest_flattened(): client = GlobalOrganizationOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -746,7 +772,9 @@ def test_delete_rest_flattened(): sample_request = {"operation": "sample1"} # get truthy value for each flattened field - mock_args = dict(operation="operation_value",) + mock_args = dict( + operation="operation_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -774,7 +802,8 @@ def test_delete_rest_flattened(): def test_delete_rest_flattened_error(transport: str = "rest"): client = GlobalOrganizationOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -793,11 +822,16 @@ def test_delete_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.GetGlobalOrganizationOperationRequest, dict,] + "request_type", + [ + compute.GetGlobalOrganizationOperationRequest, + dict, + ], ) def test_get_rest(request_type): client = GlobalOrganizationOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -903,7 +937,8 @@ def test_get_rest_required_fields( assert jsonified_request["operation"] == "operation_value" client = GlobalOrganizationOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -987,7 +1022,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -997,7 +1038,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetGlobalOrganizationOperationRequest ): client = GlobalOrganizationOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1018,7 +1060,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = GlobalOrganizationOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1030,7 +1073,9 @@ def test_get_rest_flattened(): sample_request = {"operation": "sample1"} # get truthy value for each flattened field - mock_args = dict(operation="operation_value",) + mock_args = dict( + operation="operation_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1056,7 +1101,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = GlobalOrganizationOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1075,11 +1121,16 @@ def test_get_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.ListGlobalOrganizationOperationsRequest, dict,] + "request_type", + [ + compute.ListGlobalOrganizationOperationsRequest, + dict, + ], ) def test_list_rest(request_type): client = GlobalOrganizationOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1155,7 +1206,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.OperationList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1166,7 +1223,8 @@ def test_list_rest_bad_request( request_type=compute.ListGlobalOrganizationOperationsRequest, ): client = GlobalOrganizationOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1187,7 +1245,8 @@ def test_list_rest_bad_request( def test_list_rest_pager(transport: str = "rest"): client = GlobalOrganizationOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1197,12 +1256,29 @@ def test_list_rest_pager(transport: str = "rest"): # Set the response as a series of pages response = ( compute.OperationList( - items=[compute.Operation(), compute.Operation(), compute.Operation(),], + items=[ + compute.Operation(), + compute.Operation(), + compute.Operation(), + ], next_page_token="abc", ), - compute.OperationList(items=[], next_page_token="def",), - compute.OperationList(items=[compute.Operation(),], next_page_token="ghi",), - compute.OperationList(items=[compute.Operation(), compute.Operation(),],), + compute.OperationList( + items=[], + next_page_token="def", + ), + compute.OperationList( + items=[ + compute.Operation(), + ], + next_page_token="ghi", + ), + compute.OperationList( + items=[ + compute.Operation(), + compute.Operation(), + ], + ), ) # Two responses for two calls response = response + response @@ -1235,7 +1311,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = GlobalOrganizationOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1256,7 +1333,8 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = GlobalOrganizationOperationsClient( - client_options=options, transport=transport, + client_options=options, + transport=transport, ) # It is an error to provide an api_key and a credential. @@ -1273,7 +1351,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = GlobalOrganizationOperationsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1287,7 +1366,10 @@ def test_transport_instance(): @pytest.mark.parametrize( - "transport_class", [transports.GlobalOrganizationOperationsRestTransport,] + "transport_class", + [ + transports.GlobalOrganizationOperationsRestTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -1341,7 +1423,8 @@ def test_global_organization_operations_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.GlobalOrganizationOperationsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1391,7 +1474,12 @@ def test_global_organization_operations_http_transport_client_cert_source_for_mt mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_global_organization_operations_host_no_port(transport_name): client = GlobalOrganizationOperationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1407,7 +1495,12 @@ def test_global_organization_operations_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_global_organization_operations_host_with_port(transport_name): client = GlobalOrganizationOperationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1447,7 +1540,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = GlobalOrganizationOperationsClient.common_folder_path(folder) assert expected == actual @@ -1465,7 +1560,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = GlobalOrganizationOperationsClient.common_organization_path(organization) assert expected == actual @@ -1483,7 +1580,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = GlobalOrganizationOperationsClient.common_project_path(project) assert expected == actual @@ -1503,7 +1602,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = GlobalOrganizationOperationsClient.common_location_path(project, location) assert expected == actual @@ -1528,7 +1628,8 @@ def test_client_with_default_client_info(): transports.GlobalOrganizationOperationsTransport, "_prep_wrapped_messages" ) as prep: client = GlobalOrganizationOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1537,7 +1638,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = GlobalOrganizationOperationsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) diff --git a/tests/unit/gapic/compute_v1/test_global_public_delegated_prefixes.py b/tests/unit/gapic/compute_v1/test_global_public_delegated_prefixes.py index e4bf5921f..435b5f067 100644 --- a/tests/unit/gapic/compute_v1/test_global_public_delegated_prefixes.py +++ b/tests/unit/gapic/compute_v1/test_global_public_delegated_prefixes.py @@ -96,7 +96,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(GlobalPublicDelegatedPrefixesClient, "rest"),] + "client_class,transport_name", + [ + (GlobalPublicDelegatedPrefixesClient, "rest"), + ], ) def test_global_public_delegated_prefixes_client_from_service_account_info( client_class, transport_name @@ -120,7 +123,9 @@ def test_global_public_delegated_prefixes_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.GlobalPublicDelegatedPrefixesRestTransport, "rest"),], + [ + (transports.GlobalPublicDelegatedPrefixesRestTransport, "rest"), + ], ) def test_global_public_delegated_prefixes_client_service_account_always_use_jwt( transport_class, transport_name @@ -141,7 +146,10 @@ def test_global_public_delegated_prefixes_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(GlobalPublicDelegatedPrefixesClient, "rest"),] + "client_class,transport_name", + [ + (GlobalPublicDelegatedPrefixesClient, "rest"), + ], ) def test_global_public_delegated_prefixes_client_from_service_account_file( client_class, transport_name @@ -500,7 +508,9 @@ def test_global_public_delegated_prefixes_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -549,11 +559,16 @@ def test_global_public_delegated_prefixes_client_client_options_credentials_file @pytest.mark.parametrize( - "request_type", [compute.DeleteGlobalPublicDelegatedPrefixeRequest, dict,] + "request_type", + [ + compute.DeleteGlobalPublicDelegatedPrefixeRequest, + dict, + ], ) def test_delete_unary_rest(request_type): client = GlobalPublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -663,7 +678,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["publicDelegatedPrefix"] == "public_delegated_prefix_value" client = GlobalPublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -704,7 +720,13 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "publicDelegatedPrefix",)) + set(("requestId",)) + & set( + ( + "project", + "publicDelegatedPrefix", + ) + ) ) @@ -750,7 +772,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -762,7 +788,8 @@ def test_delete_unary_rest_bad_request( request_type=compute.DeleteGlobalPublicDelegatedPrefixeRequest, ): client = GlobalPublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -783,7 +810,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = GlobalPublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -824,7 +852,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = GlobalPublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -844,11 +873,16 @@ def test_delete_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.GetGlobalPublicDelegatedPrefixeRequest, dict,] + "request_type", + [ + compute.GetGlobalPublicDelegatedPrefixeRequest, + dict, + ], ) def test_get_rest(request_type): client = GlobalPublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -936,7 +970,8 @@ def test_get_rest_required_fields( assert jsonified_request["publicDelegatedPrefix"] == "public_delegated_prefix_value" client = GlobalPublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -976,7 +1011,15 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("project", "publicDelegatedPrefix",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "project", + "publicDelegatedPrefix", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1022,7 +1065,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.PublicDelegatedPrefix - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1032,7 +1081,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetGlobalPublicDelegatedPrefixeRequest ): client = GlobalPublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1053,7 +1103,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = GlobalPublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1094,7 +1145,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = GlobalPublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1114,11 +1166,16 @@ def test_get_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.InsertGlobalPublicDelegatedPrefixeRequest, dict,] + "request_type", + [ + compute.InsertGlobalPublicDelegatedPrefixeRequest, + dict, + ], ) def test_insert_unary_rest(request_type): client = GlobalPublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1249,7 +1306,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = GlobalPublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1291,7 +1349,13 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "publicDelegatedPrefixResource",)) + set(("requestId",)) + & set( + ( + "project", + "publicDelegatedPrefixResource", + ) + ) ) @@ -1337,7 +1401,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1349,7 +1417,8 @@ def test_insert_unary_rest_bad_request( request_type=compute.InsertGlobalPublicDelegatedPrefixeRequest, ): client = GlobalPublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1395,7 +1464,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = GlobalPublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1438,7 +1508,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = GlobalPublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1460,11 +1531,16 @@ def test_insert_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.ListGlobalPublicDelegatedPrefixesRequest, dict,] + "request_type", + [ + compute.ListGlobalPublicDelegatedPrefixesRequest, + dict, + ], ) def test_list_rest(request_type): client = GlobalPublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1527,7 +1603,13 @@ def test_list_rest_required_fields( ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1536,7 +1618,8 @@ def test_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = GlobalPublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1577,7 +1660,15 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set(("project",)) ) @@ -1625,7 +1716,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.PublicDelegatedPrefixList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1636,7 +1733,8 @@ def test_list_rest_bad_request( request_type=compute.ListGlobalPublicDelegatedPrefixesRequest, ): client = GlobalPublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1657,7 +1755,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = GlobalPublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1669,7 +1768,9 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1695,20 +1796,23 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = GlobalPublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list( - compute.ListGlobalPublicDelegatedPrefixesRequest(), project="project_value", + compute.ListGlobalPublicDelegatedPrefixesRequest(), + project="project_value", ) def test_list_rest_pager(transport: str = "rest"): client = GlobalPublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1725,9 +1829,15 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.PublicDelegatedPrefixList(items=[], next_page_token="def",), compute.PublicDelegatedPrefixList( - items=[compute.PublicDelegatedPrefix(),], next_page_token="ghi", + items=[], + next_page_token="def", + ), + compute.PublicDelegatedPrefixList( + items=[ + compute.PublicDelegatedPrefix(), + ], + next_page_token="ghi", ), compute.PublicDelegatedPrefixList( items=[ @@ -1761,11 +1871,16 @@ def test_list_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.PatchGlobalPublicDelegatedPrefixeRequest, dict,] + "request_type", + [ + compute.PatchGlobalPublicDelegatedPrefixeRequest, + dict, + ], ) def test_patch_unary_rest(request_type): client = GlobalPublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1900,7 +2015,8 @@ def test_patch_unary_rest_required_fields( assert jsonified_request["publicDelegatedPrefix"] == "public_delegated_prefix_value" client = GlobalPublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1943,7 +2059,13 @@ def test_patch_unary_rest_unset_required_fields(): unset_fields = transport.patch._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("project", "publicDelegatedPrefix", "publicDelegatedPrefixResource",)) + & set( + ( + "project", + "publicDelegatedPrefix", + "publicDelegatedPrefixResource", + ) + ) ) @@ -1988,7 +2110,13 @@ def test_patch_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.patch_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1999,7 +2127,8 @@ def test_patch_unary_rest_bad_request( request_type=compute.PatchGlobalPublicDelegatedPrefixeRequest, ): client = GlobalPublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2045,7 +2174,8 @@ def test_patch_unary_rest_bad_request( def test_patch_unary_rest_flattened(): client = GlobalPublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2089,7 +2219,8 @@ def test_patch_unary_rest_flattened(): def test_patch_unary_rest_flattened_error(transport: str = "rest"): client = GlobalPublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2118,7 +2249,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = GlobalPublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2139,7 +2271,8 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = GlobalPublicDelegatedPrefixesClient( - client_options=options, transport=transport, + client_options=options, + transport=transport, ) # It is an error to provide an api_key and a credential. @@ -2156,7 +2289,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = GlobalPublicDelegatedPrefixesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2170,7 +2304,10 @@ def test_transport_instance(): @pytest.mark.parametrize( - "transport_class", [transports.GlobalPublicDelegatedPrefixesRestTransport,] + "transport_class", + [ + transports.GlobalPublicDelegatedPrefixesRestTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -2226,7 +2363,8 @@ def test_global_public_delegated_prefixes_base_transport_with_credentials_file() Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.GlobalPublicDelegatedPrefixesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2276,7 +2414,12 @@ def test_global_public_delegated_prefixes_http_transport_client_cert_source_for_ mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_global_public_delegated_prefixes_host_no_port(transport_name): client = GlobalPublicDelegatedPrefixesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2292,7 +2435,12 @@ def test_global_public_delegated_prefixes_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_global_public_delegated_prefixes_host_with_port(transport_name): client = GlobalPublicDelegatedPrefixesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2332,7 +2480,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = GlobalPublicDelegatedPrefixesClient.common_folder_path(folder) assert expected == actual @@ -2350,7 +2500,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = GlobalPublicDelegatedPrefixesClient.common_organization_path(organization) assert expected == actual @@ -2368,7 +2520,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = GlobalPublicDelegatedPrefixesClient.common_project_path(project) assert expected == actual @@ -2388,7 +2542,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = GlobalPublicDelegatedPrefixesClient.common_location_path(project, location) assert expected == actual @@ -2413,7 +2568,8 @@ def test_client_with_default_client_info(): transports.GlobalPublicDelegatedPrefixesTransport, "_prep_wrapped_messages" ) as prep: client = GlobalPublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2422,7 +2578,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = GlobalPublicDelegatedPrefixesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) diff --git a/tests/unit/gapic/compute_v1/test_health_checks.py b/tests/unit/gapic/compute_v1/test_health_checks.py index 8ac27e594..32775c53b 100644 --- a/tests/unit/gapic/compute_v1/test_health_checks.py +++ b/tests/unit/gapic/compute_v1/test_health_checks.py @@ -85,7 +85,12 @@ def test__get_default_mtls_endpoint(): assert HealthChecksClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class,transport_name", [(HealthChecksClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (HealthChecksClient, "rest"), + ], +) def test_health_checks_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -105,7 +110,10 @@ def test_health_checks_client_from_service_account_info(client_class, transport_ @pytest.mark.parametrize( - "transport_class,transport_name", [(transports.HealthChecksRestTransport, "rest"),] + "transport_class,transport_name", + [ + (transports.HealthChecksRestTransport, "rest"), + ], ) def test_health_checks_client_service_account_always_use_jwt( transport_class, transport_name @@ -125,7 +133,12 @@ def test_health_checks_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class,transport_name", [(HealthChecksClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (HealthChecksClient, "rest"), + ], +) def test_health_checks_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -164,7 +177,9 @@ def test_health_checks_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(HealthChecksClient, transports.HealthChecksRestTransport, "rest"),], + [ + (HealthChecksClient, transports.HealthChecksRestTransport, "rest"), + ], ) @mock.patch.object( HealthChecksClient, "DEFAULT_ENDPOINT", modify_default_endpoint(HealthChecksClient) @@ -441,13 +456,17 @@ def test_health_checks_client_get_mtls_endpoint_and_cert_source(client_class): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(HealthChecksClient, transports.HealthChecksRestTransport, "rest"),], + [ + (HealthChecksClient, transports.HealthChecksRestTransport, "rest"), + ], ) def test_health_checks_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -465,7 +484,9 @@ def test_health_checks_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(HealthChecksClient, transports.HealthChecksRestTransport, "rest", None),], + [ + (HealthChecksClient, transports.HealthChecksRestTransport, "rest", None), + ], ) def test_health_checks_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -489,11 +510,16 @@ def test_health_checks_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.AggregatedListHealthChecksRequest, dict,] + "request_type", + [ + compute.AggregatedListHealthChecksRequest, + dict, + ], ) def test_aggregated_list_rest(request_type): client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -574,7 +600,8 @@ def test_aggregated_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -673,7 +700,11 @@ def test_aggregated_list_rest_interceptors(null_interceptor): post.return_value = compute.HealthChecksAggregatedList client.aggregated_list( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -684,7 +715,8 @@ def test_aggregated_list_rest_bad_request( transport: str = "rest", request_type=compute.AggregatedListHealthChecksRequest ): client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -705,7 +737,8 @@ def test_aggregated_list_rest_bad_request( def test_aggregated_list_rest_flattened(): client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -717,7 +750,9 @@ def test_aggregated_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -743,20 +778,23 @@ def test_aggregated_list_rest_flattened(): def test_aggregated_list_rest_flattened_error(transport: str = "rest"): client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.aggregated_list( - compute.AggregatedListHealthChecksRequest(), project="project_value", + compute.AggregatedListHealthChecksRequest(), + project="project_value", ) def test_aggregated_list_rest_pager(transport: str = "rest"): client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -773,9 +811,15 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): }, next_page_token="abc", ), - compute.HealthChecksAggregatedList(items={}, next_page_token="def",), compute.HealthChecksAggregatedList( - items={"g": compute.HealthChecksScopedList(),}, next_page_token="ghi", + items={}, + next_page_token="def", + ), + compute.HealthChecksAggregatedList( + items={ + "g": compute.HealthChecksScopedList(), + }, + next_page_token="ghi", ), compute.HealthChecksAggregatedList( items={ @@ -822,10 +866,17 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.DeleteHealthCheckRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteHealthCheckRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -935,7 +986,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -975,7 +1027,15 @@ def test_delete_unary_rest_unset_required_fields(): ) unset_fields = transport.delete._get_unset_required_fields({}) - assert set(unset_fields) == (set(("requestId",)) & set(("healthCheck", "project",))) + assert set(unset_fields) == ( + set(("requestId",)) + & set( + ( + "healthCheck", + "project", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1020,7 +1080,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1031,7 +1095,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteHealthCheckRequest ): client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1052,7 +1117,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1064,7 +1130,10 @@ def test_delete_unary_rest_flattened(): sample_request = {"project": "sample1", "health_check": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", health_check="health_check_value",) + mock_args = dict( + project="project_value", + health_check="health_check_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1090,7 +1159,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1109,10 +1179,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetHealthCheckRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetHealthCheckRequest, + dict, + ], +) def test_get_rest(request_type): client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1198,7 +1275,8 @@ def test_get_rest_required_fields(request_type=compute.GetHealthCheckRequest): assert jsonified_request["project"] == "project_value" client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1238,7 +1316,15 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("healthCheck", "project",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "healthCheck", + "project", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1282,7 +1368,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.HealthCheck - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1292,7 +1384,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetHealthCheckRequest ): client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1313,7 +1406,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1325,7 +1419,10 @@ def test_get_rest_flattened(): sample_request = {"project": "sample1", "health_check": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", health_check="health_check_value",) + mock_args = dict( + project="project_value", + health_check="health_check_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1351,7 +1448,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1370,10 +1468,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertHealthCheckRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertHealthCheckRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1543,7 +1648,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1585,7 +1691,13 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("healthCheckResource", "project",)) + set(("requestId",)) + & set( + ( + "healthCheckResource", + "project", + ) + ) ) @@ -1631,7 +1743,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1642,7 +1758,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertHealthCheckRequest ): client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1727,7 +1844,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1768,7 +1886,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1787,10 +1906,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListHealthChecksRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListHealthChecksRequest, + dict, + ], +) def test_list_rest(request_type): client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1851,7 +1977,13 @@ def test_list_rest_required_fields(request_type=compute.ListHealthChecksRequest) ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1860,7 +1992,8 @@ def test_list_rest_required_fields(request_type=compute.ListHealthChecksRequest) assert jsonified_request["project"] == "project_value" client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1901,7 +2034,15 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set(("project",)) ) @@ -1949,7 +2090,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.HealthCheckList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1959,7 +2106,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListHealthChecksRequest ): client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1980,7 +2128,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1992,7 +2141,9 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2018,20 +2169,23 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list( - compute.ListHealthChecksRequest(), project="project_value", + compute.ListHealthChecksRequest(), + project="project_value", ) def test_list_rest_pager(transport: str = "rest"): client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2048,12 +2202,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.HealthCheckList(items=[], next_page_token="def",), compute.HealthCheckList( - items=[compute.HealthCheck(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.HealthCheckList( - items=[compute.HealthCheck(), compute.HealthCheck(),], + items=[ + compute.HealthCheck(), + ], + next_page_token="ghi", + ), + compute.HealthCheckList( + items=[ + compute.HealthCheck(), + compute.HealthCheck(), + ], ), ) # Two responses for two calls @@ -2080,10 +2243,17 @@ def test_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.PatchHealthCheckRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.PatchHealthCheckRequest, + dict, + ], +) def test_patch_unary_rest(request_type): client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2255,7 +2425,8 @@ def test_patch_unary_rest_required_fields(request_type=compute.PatchHealthCheckR assert jsonified_request["project"] == "project_value" client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2297,7 +2468,14 @@ def test_patch_unary_rest_unset_required_fields(): unset_fields = transport.patch._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("healthCheck", "healthCheckResource", "project",)) + set(("requestId",)) + & set( + ( + "healthCheck", + "healthCheckResource", + "project", + ) + ) ) @@ -2342,7 +2520,13 @@ def test_patch_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.patch_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2352,7 +2536,8 @@ def test_patch_unary_rest_bad_request( transport: str = "rest", request_type=compute.PatchHealthCheckRequest ): client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2437,7 +2622,8 @@ def test_patch_unary_rest_bad_request( def test_patch_unary_rest_flattened(): client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2479,7 +2665,8 @@ def test_patch_unary_rest_flattened(): def test_patch_unary_rest_flattened_error(transport: str = "rest"): client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2499,10 +2686,17 @@ def test_patch_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.UpdateHealthCheckRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.UpdateHealthCheckRequest, + dict, + ], +) def test_update_unary_rest(request_type): client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2676,7 +2870,8 @@ def test_update_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2718,7 +2913,14 @@ def test_update_unary_rest_unset_required_fields(): unset_fields = transport.update._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("healthCheck", "healthCheckResource", "project",)) + set(("requestId",)) + & set( + ( + "healthCheck", + "healthCheckResource", + "project", + ) + ) ) @@ -2764,7 +2966,11 @@ def test_update_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.update_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2775,7 +2981,8 @@ def test_update_unary_rest_bad_request( transport: str = "rest", request_type=compute.UpdateHealthCheckRequest ): client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2860,7 +3067,8 @@ def test_update_unary_rest_bad_request( def test_update_unary_rest_flattened(): client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2902,7 +3110,8 @@ def test_update_unary_rest_flattened(): def test_update_unary_rest_flattened_error(transport: str = "rest"): client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2929,7 +3138,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2949,7 +3159,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = HealthChecksClient(client_options=options, transport=transport,) + client = HealthChecksClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2965,7 +3178,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = HealthChecksClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2978,7 +3192,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.HealthChecksRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.HealthChecksRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -3035,7 +3254,8 @@ def test_health_checks_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.HealthChecksTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -3085,7 +3305,12 @@ def test_health_checks_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_health_checks_host_no_port(transport_name): client = HealthChecksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3101,7 +3326,12 @@ def test_health_checks_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_health_checks_host_with_port(transport_name): client = HealthChecksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3139,7 +3369,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = HealthChecksClient.common_folder_path(folder) assert expected == actual @@ -3157,7 +3389,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = HealthChecksClient.common_organization_path(organization) assert expected == actual @@ -3175,7 +3409,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = HealthChecksClient.common_project_path(project) assert expected == actual @@ -3195,7 +3431,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = HealthChecksClient.common_location_path(project, location) assert expected == actual @@ -3220,7 +3457,8 @@ def test_client_with_default_client_info(): transports.HealthChecksTransport, "_prep_wrapped_messages" ) as prep: client = HealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3229,7 +3467,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = HealthChecksClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3269,7 +3508,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(HealthChecksClient, transports.HealthChecksRestTransport),], + [ + (HealthChecksClient, transports.HealthChecksRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_image_family_views.py b/tests/unit/gapic/compute_v1/test_image_family_views.py index 4aa698286..b8ea95f5a 100644 --- a/tests/unit/gapic/compute_v1/test_image_family_views.py +++ b/tests/unit/gapic/compute_v1/test_image_family_views.py @@ -89,7 +89,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(ImageFamilyViewsClient, "rest"),] + "client_class,transport_name", + [ + (ImageFamilyViewsClient, "rest"), + ], ) def test_image_family_views_client_from_service_account_info( client_class, transport_name @@ -113,7 +116,9 @@ def test_image_family_views_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.ImageFamilyViewsRestTransport, "rest"),], + [ + (transports.ImageFamilyViewsRestTransport, "rest"), + ], ) def test_image_family_views_client_service_account_always_use_jwt( transport_class, transport_name @@ -134,7 +139,10 @@ def test_image_family_views_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(ImageFamilyViewsClient, "rest"),] + "client_class,transport_name", + [ + (ImageFamilyViewsClient, "rest"), + ], ) def test_image_family_views_client_from_service_account_file( client_class, transport_name @@ -176,7 +184,9 @@ def test_image_family_views_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(ImageFamilyViewsClient, transports.ImageFamilyViewsRestTransport, "rest"),], + [ + (ImageFamilyViewsClient, transports.ImageFamilyViewsRestTransport, "rest"), + ], ) @mock.patch.object( ImageFamilyViewsClient, @@ -469,13 +479,17 @@ def test_image_family_views_client_get_mtls_endpoint_and_cert_source(client_clas @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(ImageFamilyViewsClient, transports.ImageFamilyViewsRestTransport, "rest"),], + [ + (ImageFamilyViewsClient, transports.ImageFamilyViewsRestTransport, "rest"), + ], ) def test_image_family_views_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -493,7 +507,14 @@ def test_image_family_views_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(ImageFamilyViewsClient, transports.ImageFamilyViewsRestTransport, "rest", None),], + [ + ( + ImageFamilyViewsClient, + transports.ImageFamilyViewsRestTransport, + "rest", + None, + ), + ], ) def test_image_family_views_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -516,10 +537,17 @@ def test_image_family_views_client_client_options_credentials_file( ) -@pytest.mark.parametrize("request_type", [compute.GetImageFamilyViewRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetImageFamilyViewRequest, + dict, + ], +) def test_get_rest(request_type): client = ImageFamilyViewsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -584,7 +612,8 @@ def test_get_rest_required_fields(request_type=compute.GetImageFamilyViewRequest assert jsonified_request["zone"] == "zone_value" client = ImageFamilyViewsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -624,7 +653,16 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("family", "project", "zone",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "family", + "project", + "zone", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -670,7 +708,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.ImageFamilyView - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -680,7 +724,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetImageFamilyViewRequest ): client = ImageFamilyViewsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -701,7 +746,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = ImageFamilyViewsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -714,7 +760,9 @@ def test_get_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", zone="zone_value", family="family_value", + project="project_value", + zone="zone_value", + family="family_value", ) mock_args.update(sample_request) @@ -741,7 +789,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = ImageFamilyViewsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -768,7 +817,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ImageFamilyViewsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -788,7 +838,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = ImageFamilyViewsClient(client_options=options, transport=transport,) + client = ImageFamilyViewsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -804,7 +857,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ImageFamilyViewsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -817,7 +871,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.ImageFamilyViewsRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.ImageFamilyViewsRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -866,7 +925,8 @@ def test_image_family_views_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ImageFamilyViewsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -918,7 +978,12 @@ def test_image_family_views_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_image_family_views_host_no_port(transport_name): client = ImageFamilyViewsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -934,7 +999,12 @@ def test_image_family_views_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_image_family_views_host_with_port(transport_name): client = ImageFamilyViewsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -972,7 +1042,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = ImageFamilyViewsClient.common_folder_path(folder) assert expected == actual @@ -990,7 +1062,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = ImageFamilyViewsClient.common_organization_path(organization) assert expected == actual @@ -1008,7 +1082,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = ImageFamilyViewsClient.common_project_path(project) assert expected == actual @@ -1028,7 +1104,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = ImageFamilyViewsClient.common_location_path(project, location) assert expected == actual @@ -1053,7 +1130,8 @@ def test_client_with_default_client_info(): transports.ImageFamilyViewsTransport, "_prep_wrapped_messages" ) as prep: client = ImageFamilyViewsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1062,7 +1140,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ImageFamilyViewsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1102,7 +1181,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(ImageFamilyViewsClient, transports.ImageFamilyViewsRestTransport),], + [ + (ImageFamilyViewsClient, transports.ImageFamilyViewsRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_images.py b/tests/unit/gapic/compute_v1/test_images.py index 70c60382f..bead0a020 100644 --- a/tests/unit/gapic/compute_v1/test_images.py +++ b/tests/unit/gapic/compute_v1/test_images.py @@ -82,7 +82,12 @@ def test__get_default_mtls_endpoint(): assert ImagesClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class,transport_name", [(ImagesClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (ImagesClient, "rest"), + ], +) def test_images_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -102,7 +107,10 @@ def test_images_client_from_service_account_info(client_class, transport_name): @pytest.mark.parametrize( - "transport_class,transport_name", [(transports.ImagesRestTransport, "rest"),] + "transport_class,transport_name", + [ + (transports.ImagesRestTransport, "rest"), + ], ) def test_images_client_service_account_always_use_jwt(transport_class, transport_name): with mock.patch.object( @@ -120,7 +128,12 @@ def test_images_client_service_account_always_use_jwt(transport_class, transport use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class,transport_name", [(ImagesClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (ImagesClient, "rest"), + ], +) def test_images_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -159,7 +172,9 @@ def test_images_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(ImagesClient, transports.ImagesRestTransport, "rest"),], + [ + (ImagesClient, transports.ImagesRestTransport, "rest"), + ], ) @mock.patch.object( ImagesClient, "DEFAULT_ENDPOINT", modify_default_endpoint(ImagesClient) @@ -434,13 +449,17 @@ def test_images_client_get_mtls_endpoint_and_cert_source(client_class): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(ImagesClient, transports.ImagesRestTransport, "rest"),], + [ + (ImagesClient, transports.ImagesRestTransport, "rest"), + ], ) def test_images_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -458,7 +477,9 @@ def test_images_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(ImagesClient, transports.ImagesRestTransport, "rest", None),], + [ + (ImagesClient, transports.ImagesRestTransport, "rest", None), + ], ) def test_images_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -481,10 +502,17 @@ def test_images_client_client_options_credentials_file( ) -@pytest.mark.parametrize("request_type", [compute.DeleteImageRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteImageRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -592,7 +620,8 @@ def test_delete_unary_rest_required_fields(request_type=compute.DeleteImageReque assert jsonified_request["project"] == "project_value" client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -632,7 +661,15 @@ def test_delete_unary_rest_unset_required_fields(): ) unset_fields = transport.delete._get_unset_required_fields({}) - assert set(unset_fields) == (set(("requestId",)) & set(("image", "project",))) + assert set(unset_fields) == ( + set(("requestId",)) + & set( + ( + "image", + "project", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -675,7 +712,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -686,7 +727,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteImageRequest ): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -707,7 +749,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -719,7 +762,10 @@ def test_delete_unary_rest_flattened(): sample_request = {"project": "sample1", "image": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", image="image_value",) + mock_args = dict( + project="project_value", + image="image_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -745,14 +791,17 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_unary( - compute.DeleteImageRequest(), project="project_value", image="image_value", + compute.DeleteImageRequest(), + project="project_value", + image="image_value", ) @@ -762,10 +811,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.DeprecateImageRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeprecateImageRequest, + dict, + ], +) def test_deprecate_unary_rest(request_type): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -882,7 +938,8 @@ def test_deprecate_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -924,7 +981,14 @@ def test_deprecate_unary_rest_unset_required_fields(): unset_fields = transport.deprecate._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("deprecationStatusResource", "image", "project",)) + set(("requestId",)) + & set( + ( + "deprecationStatusResource", + "image", + "project", + ) + ) ) @@ -968,7 +1032,11 @@ def test_deprecate_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.deprecate_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -979,7 +1047,8 @@ def test_deprecate_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeprecateImageRequest ): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1007,7 +1076,8 @@ def test_deprecate_unary_rest_bad_request( def test_deprecate_unary_rest_flattened(): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1051,7 +1121,8 @@ def test_deprecate_unary_rest_flattened(): def test_deprecate_unary_rest_flattened_error(transport: str = "rest"): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1073,10 +1144,17 @@ def test_deprecate_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetImageRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetImageRequest, + dict, + ], +) def test_get_rest(request_type): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1182,7 +1260,8 @@ def test_get_rest_required_fields(request_type=compute.GetImageRequest): assert jsonified_request["project"] == "project_value" client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1222,7 +1301,15 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("image", "project",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "image", + "project", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1264,7 +1351,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Image - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1274,7 +1367,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetImageRequest ): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1295,7 +1389,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1307,7 +1402,10 @@ def test_get_rest_flattened(): sample_request = {"project": "sample1", "image": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", image="image_value",) + mock_args = dict( + project="project_value", + image="image_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1333,14 +1431,17 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get( - compute.GetImageRequest(), project="project_value", image="image_value", + compute.GetImageRequest(), + project="project_value", + image="image_value", ) @@ -1350,10 +1451,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetFromFamilyImageRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetFromFamilyImageRequest, + dict, + ], +) def test_get_from_family_rest(request_type): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1461,7 +1569,8 @@ def test_get_from_family_rest_required_fields( assert jsonified_request["project"] == "project_value" client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1501,7 +1610,15 @@ def test_get_from_family_rest_unset_required_fields(): ) unset_fields = transport.get_from_family._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("family", "project",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "family", + "project", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1544,7 +1661,11 @@ def test_get_from_family_rest_interceptors(null_interceptor): post.return_value = compute.Image client.get_from_family( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1555,7 +1676,8 @@ def test_get_from_family_rest_bad_request( transport: str = "rest", request_type=compute.GetFromFamilyImageRequest ): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1576,7 +1698,8 @@ def test_get_from_family_rest_bad_request( def test_get_from_family_rest_flattened(): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1588,7 +1711,10 @@ def test_get_from_family_rest_flattened(): sample_request = {"project": "sample1", "family": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", family="family_value",) + mock_args = dict( + project="project_value", + family="family_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1614,7 +1740,8 @@ def test_get_from_family_rest_flattened(): def test_get_from_family_rest_flattened_error(transport: str = "rest"): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1633,10 +1760,17 @@ def test_get_from_family_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetIamPolicyImageRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetIamPolicyImageRequest, + dict, + ], +) def test_get_iam_policy_rest(request_type): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1646,7 +1780,11 @@ def test_get_iam_policy_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = compute.Policy(etag="etag_value", iam_owned=True, version=774,) + return_value = compute.Policy( + etag="etag_value", + iam_owned=True, + version=774, + ) # Wrap the value into a proper Response obj response_value = Response() @@ -1704,7 +1842,8 @@ def test_get_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1745,7 +1884,13 @@ def test_get_iam_policy_rest_unset_required_fields(): unset_fields = transport.get_iam_policy._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("optionsRequestedPolicyVersion",)) & set(("project", "resource",)) + set(("optionsRequestedPolicyVersion",)) + & set( + ( + "project", + "resource", + ) + ) ) @@ -1789,7 +1934,11 @@ def test_get_iam_policy_rest_interceptors(null_interceptor): post.return_value = compute.Policy client.get_iam_policy( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1800,7 +1949,8 @@ def test_get_iam_policy_rest_bad_request( transport: str = "rest", request_type=compute.GetIamPolicyImageRequest ): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1821,7 +1971,8 @@ def test_get_iam_policy_rest_bad_request( def test_get_iam_policy_rest_flattened(): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1833,7 +1984,10 @@ def test_get_iam_policy_rest_flattened(): sample_request = {"project": "sample1", "resource": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", resource="resource_value",) + mock_args = dict( + project="project_value", + resource="resource_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1859,7 +2013,8 @@ def test_get_iam_policy_rest_flattened(): def test_get_iam_policy_rest_flattened_error(transport: str = "rest"): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1878,10 +2033,17 @@ def test_get_iam_policy_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertImageRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertImageRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2031,7 +2193,12 @@ def test_insert_unary_rest_required_fields(request_type=compute.InsertImageReque credentials=ga_credentials.AnonymousCredentials() ).insert._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("force_create", "request_id",)) + assert not set(unset_fields) - set( + ( + "force_create", + "request_id", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -2039,7 +2206,8 @@ def test_insert_unary_rest_required_fields(request_type=compute.InsertImageReque assert jsonified_request["project"] == "project_value" client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2081,7 +2249,18 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("forceCreate", "requestId",)) & set(("imageResource", "project",)) + set( + ( + "forceCreate", + "requestId", + ) + ) + & set( + ( + "imageResource", + "project", + ) + ) ) @@ -2125,7 +2304,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2136,7 +2319,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertImageRequest ): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2211,7 +2395,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2251,7 +2436,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2270,10 +2456,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListImagesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListImagesRequest, + dict, + ], +) def test_list_rest(request_type): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2334,7 +2527,13 @@ def test_list_rest_required_fields(request_type=compute.ListImagesRequest): ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -2343,7 +2542,8 @@ def test_list_rest_required_fields(request_type=compute.ListImagesRequest): assert jsonified_request["project"] == "project_value" client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2384,7 +2584,15 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set(("project",)) ) @@ -2428,7 +2636,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.ImageList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2438,7 +2652,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListImagesRequest ): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2459,7 +2674,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2471,7 +2687,9 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2496,20 +2714,23 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list( - compute.ListImagesRequest(), project="project_value", + compute.ListImagesRequest(), + project="project_value", ) def test_list_rest_pager(transport: str = "rest"): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2519,12 +2740,29 @@ def test_list_rest_pager(transport: str = "rest"): # Set the response as a series of pages response = ( compute.ImageList( - items=[compute.Image(), compute.Image(), compute.Image(),], + items=[ + compute.Image(), + compute.Image(), + compute.Image(), + ], next_page_token="abc", ), - compute.ImageList(items=[], next_page_token="def",), - compute.ImageList(items=[compute.Image(),], next_page_token="ghi",), - compute.ImageList(items=[compute.Image(), compute.Image(),],), + compute.ImageList( + items=[], + next_page_token="def", + ), + compute.ImageList( + items=[ + compute.Image(), + ], + next_page_token="ghi", + ), + compute.ImageList( + items=[ + compute.Image(), + compute.Image(), + ], + ), ) # Two responses for two calls response = response + response @@ -2550,10 +2788,17 @@ def test_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.PatchImageRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.PatchImageRequest, + dict, + ], +) def test_patch_unary_rest(request_type): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2715,7 +2960,8 @@ def test_patch_unary_rest_required_fields(request_type=compute.PatchImageRequest assert jsonified_request["project"] == "project_value" client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2757,7 +3003,14 @@ def test_patch_unary_rest_unset_required_fields(): unset_fields = transport.patch._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("image", "imageResource", "project",)) + set(("requestId",)) + & set( + ( + "image", + "imageResource", + "project", + ) + ) ) @@ -2800,7 +3053,13 @@ def test_patch_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.patch_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2810,7 +3069,8 @@ def test_patch_unary_rest_bad_request( transport: str = "rest", request_type=compute.PatchImageRequest ): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2885,7 +3145,8 @@ def test_patch_unary_rest_bad_request( def test_patch_unary_rest_flattened(): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2927,7 +3188,8 @@ def test_patch_unary_rest_flattened(): def test_patch_unary_rest_flattened_error(transport: str = "rest"): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2947,10 +3209,17 @@ def test_patch_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.SetIamPolicyImageRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.SetIamPolicyImageRequest, + dict, + ], +) def test_set_iam_policy_rest(request_type): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3037,7 +3306,11 @@ def test_set_iam_policy_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = compute.Policy(etag="etag_value", iam_owned=True, version=774,) + return_value = compute.Policy( + etag="etag_value", + iam_owned=True, + version=774, + ) # Wrap the value into a proper Response obj response_value = Response() @@ -3093,7 +3366,8 @@ def test_set_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3135,7 +3409,14 @@ def test_set_iam_policy_rest_unset_required_fields(): unset_fields = transport.set_iam_policy._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("globalSetPolicyRequestResource", "project", "resource",)) + set(()) + & set( + ( + "globalSetPolicyRequestResource", + "project", + "resource", + ) + ) ) @@ -3179,7 +3460,11 @@ def test_set_iam_policy_rest_interceptors(null_interceptor): post.return_value = compute.Policy client.set_iam_policy( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3190,7 +3475,8 @@ def test_set_iam_policy_rest_bad_request( transport: str = "rest", request_type=compute.SetIamPolicyImageRequest ): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3288,7 +3574,8 @@ def test_set_iam_policy_rest_bad_request( def test_set_iam_policy_rest_flattened(): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3332,7 +3619,8 @@ def test_set_iam_policy_rest_flattened(): def test_set_iam_policy_rest_flattened_error(transport: str = "rest"): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3354,10 +3642,17 @@ def test_set_iam_policy_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.SetLabelsImageRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.SetLabelsImageRequest, + dict, + ], +) def test_set_labels_unary_rest(request_type): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3469,7 +3764,8 @@ def test_set_labels_unary_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3511,7 +3807,14 @@ def test_set_labels_unary_rest_unset_required_fields(): unset_fields = transport.set_labels._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("globalSetLabelsRequestResource", "project", "resource",)) + set(()) + & set( + ( + "globalSetLabelsRequestResource", + "project", + "resource", + ) + ) ) @@ -3555,7 +3858,11 @@ def test_set_labels_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_labels_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3566,7 +3873,8 @@ def test_set_labels_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetLabelsImageRequest ): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3591,7 +3899,8 @@ def test_set_labels_unary_rest_bad_request( def test_set_labels_unary_rest_flattened(): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3635,7 +3944,8 @@ def test_set_labels_unary_rest_flattened(): def test_set_labels_unary_rest_flattened_error(transport: str = "rest"): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3658,11 +3968,16 @@ def test_set_labels_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.TestIamPermissionsImageRequest, dict,] + "request_type", + [ + compute.TestIamPermissionsImageRequest, + dict, + ], ) def test_test_iam_permissions_rest(request_type): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3731,7 +4046,8 @@ def test_test_iam_permissions_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3773,7 +4089,14 @@ def test_test_iam_permissions_rest_unset_required_fields(): unset_fields = transport.test_iam_permissions._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("project", "resource", "testPermissionsRequestResource",)) + set(()) + & set( + ( + "project", + "resource", + "testPermissionsRequestResource", + ) + ) ) @@ -3819,7 +4142,11 @@ def test_test_iam_permissions_rest_interceptors(null_interceptor): post.return_value = compute.TestPermissionsResponse client.test_iam_permissions( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3830,7 +4157,8 @@ def test_test_iam_permissions_rest_bad_request( transport: str = "rest", request_type=compute.TestIamPermissionsImageRequest ): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3854,7 +4182,8 @@ def test_test_iam_permissions_rest_bad_request( def test_test_iam_permissions_rest_flattened(): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3898,7 +4227,8 @@ def test_test_iam_permissions_rest_flattened(): def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3927,7 +4257,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -3947,7 +4278,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = ImagesClient(client_options=options, transport=transport,) + client = ImagesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -3963,7 +4297,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ImagesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -3976,7 +4311,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.ImagesRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.ImagesRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -4037,7 +4377,8 @@ def test_images_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ImagesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -4087,7 +4428,12 @@ def test_images_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_images_host_no_port(transport_name): client = ImagesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4103,7 +4449,12 @@ def test_images_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_images_host_with_port(transport_name): client = ImagesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4141,7 +4492,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = ImagesClient.common_folder_path(folder) assert expected == actual @@ -4159,7 +4512,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = ImagesClient.common_organization_path(organization) assert expected == actual @@ -4177,7 +4532,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = ImagesClient.common_project_path(project) assert expected == actual @@ -4197,7 +4554,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = ImagesClient.common_location_path(project, location) assert expected == actual @@ -4222,7 +4580,8 @@ def test_client_with_default_client_info(): transports.ImagesTransport, "_prep_wrapped_messages" ) as prep: client = ImagesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4231,7 +4590,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ImagesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4270,7 +4630,10 @@ def test_client_ctx(): @pytest.mark.parametrize( - "client_class,transport_class", [(ImagesClient, transports.ImagesRestTransport),] + "client_class,transport_class", + [ + (ImagesClient, transports.ImagesRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_instance_group_managers.py b/tests/unit/gapic/compute_v1/test_instance_group_managers.py index 6eb8479c0..faece53b9 100644 --- a/tests/unit/gapic/compute_v1/test_instance_group_managers.py +++ b/tests/unit/gapic/compute_v1/test_instance_group_managers.py @@ -92,7 +92,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(InstanceGroupManagersClient, "rest"),] + "client_class,transport_name", + [ + (InstanceGroupManagersClient, "rest"), + ], ) def test_instance_group_managers_client_from_service_account_info( client_class, transport_name @@ -116,7 +119,9 @@ def test_instance_group_managers_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.InstanceGroupManagersRestTransport, "rest"),], + [ + (transports.InstanceGroupManagersRestTransport, "rest"), + ], ) def test_instance_group_managers_client_service_account_always_use_jwt( transport_class, transport_name @@ -137,7 +142,10 @@ def test_instance_group_managers_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(InstanceGroupManagersClient, "rest"),] + "client_class,transport_name", + [ + (InstanceGroupManagersClient, "rest"), + ], ) def test_instance_group_managers_client_from_service_account_file( client_class, transport_name @@ -490,7 +498,9 @@ def test_instance_group_managers_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -539,11 +549,16 @@ def test_instance_group_managers_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.AbandonInstancesInstanceGroupManagerRequest, dict,] + "request_type", + [ + compute.AbandonInstancesInstanceGroupManagerRequest, + dict, + ], ) def test_abandon_instances_unary_rest(request_type): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -664,7 +679,8 @@ def test_abandon_instances_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -760,7 +776,11 @@ def test_abandon_instances_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.abandon_instances_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -772,7 +792,8 @@ def test_abandon_instances_unary_rest_bad_request( request_type=compute.AbandonInstancesInstanceGroupManagerRequest, ): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -800,7 +821,8 @@ def test_abandon_instances_unary_rest_bad_request( def test_abandon_instances_unary_rest_flattened(): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -849,7 +871,8 @@ def test_abandon_instances_unary_rest_flattened(): def test_abandon_instances_unary_rest_flattened_error(transport: str = "rest"): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -873,11 +896,16 @@ def test_abandon_instances_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.AggregatedListInstanceGroupManagersRequest, dict,] + "request_type", + [ + compute.AggregatedListInstanceGroupManagersRequest, + dict, + ], ) def test_aggregated_list_rest(request_type): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -960,7 +988,8 @@ def test_aggregated_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1061,7 +1090,11 @@ def test_aggregated_list_rest_interceptors(null_interceptor): post.return_value = compute.InstanceGroupManagerAggregatedList client.aggregated_list( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1073,7 +1106,8 @@ def test_aggregated_list_rest_bad_request( request_type=compute.AggregatedListInstanceGroupManagersRequest, ): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1094,7 +1128,8 @@ def test_aggregated_list_rest_bad_request( def test_aggregated_list_rest_flattened(): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1106,7 +1141,9 @@ def test_aggregated_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1134,7 +1171,8 @@ def test_aggregated_list_rest_flattened(): def test_aggregated_list_rest_flattened_error(transport: str = "rest"): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1148,7 +1186,8 @@ def test_aggregated_list_rest_flattened_error(transport: str = "rest"): def test_aggregated_list_rest_pager(transport: str = "rest"): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1166,10 +1205,13 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): next_page_token="abc", ), compute.InstanceGroupManagerAggregatedList( - items={}, next_page_token="def", + items={}, + next_page_token="def", ), compute.InstanceGroupManagerAggregatedList( - items={"g": compute.InstanceGroupManagersScopedList(),}, + items={ + "g": compute.InstanceGroupManagersScopedList(), + }, next_page_token="ghi", ), compute.InstanceGroupManagerAggregatedList( @@ -1218,11 +1260,16 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.ApplyUpdatesToInstancesInstanceGroupManagerRequest, dict,] + "request_type", + [ + compute.ApplyUpdatesToInstancesInstanceGroupManagerRequest, + dict, + ], ) def test_apply_updates_to_instances_unary_rest(request_type): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1344,7 +1391,8 @@ def test_apply_updates_to_instances_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1442,7 +1490,11 @@ def test_apply_updates_to_instances_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.apply_updates_to_instances_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1454,7 +1506,8 @@ def test_apply_updates_to_instances_unary_rest_bad_request( request_type=compute.ApplyUpdatesToInstancesInstanceGroupManagerRequest, ): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1485,7 +1538,8 @@ def test_apply_updates_to_instances_unary_rest_bad_request( def test_apply_updates_to_instances_unary_rest_flattened(): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1534,7 +1588,8 @@ def test_apply_updates_to_instances_unary_rest_flattened(): def test_apply_updates_to_instances_unary_rest_flattened_error(transport: str = "rest"): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1558,11 +1613,16 @@ def test_apply_updates_to_instances_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.CreateInstancesInstanceGroupManagerRequest, dict,] + "request_type", + [ + compute.CreateInstancesInstanceGroupManagerRequest, + dict, + ], ) def test_create_instances_unary_rest(request_type): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1690,7 +1750,8 @@ def test_create_instances_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1786,7 +1847,11 @@ def test_create_instances_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.create_instances_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1798,7 +1863,8 @@ def test_create_instances_unary_rest_bad_request( request_type=compute.CreateInstancesInstanceGroupManagerRequest, ): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1833,7 +1899,8 @@ def test_create_instances_unary_rest_bad_request( def test_create_instances_unary_rest_flattened(): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1882,7 +1949,8 @@ def test_create_instances_unary_rest_flattened(): def test_create_instances_unary_rest_flattened_error(transport: str = "rest"): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1906,11 +1974,16 @@ def test_create_instances_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.DeleteInstanceGroupManagerRequest, dict,] + "request_type", + [ + compute.DeleteInstanceGroupManagerRequest, + dict, + ], ) def test_delete_unary_rest(request_type): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2028,7 +2101,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2069,7 +2143,14 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("instanceGroupManager", "project", "zone",)) + set(("requestId",)) + & set( + ( + "instanceGroupManager", + "project", + "zone", + ) + ) ) @@ -2115,7 +2196,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2126,7 +2211,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteInstanceGroupManagerRequest ): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2151,7 +2237,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2197,7 +2284,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2218,11 +2306,16 @@ def test_delete_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.DeleteInstancesInstanceGroupManagerRequest, dict,] + "request_type", + [ + compute.DeleteInstancesInstanceGroupManagerRequest, + dict, + ], ) def test_delete_instances_unary_rest(request_type): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2344,7 +2437,8 @@ def test_delete_instances_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2440,7 +2534,11 @@ def test_delete_instances_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_instances_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2452,7 +2550,8 @@ def test_delete_instances_unary_rest_bad_request( request_type=compute.DeleteInstancesInstanceGroupManagerRequest, ): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2481,7 +2580,8 @@ def test_delete_instances_unary_rest_bad_request( def test_delete_instances_unary_rest_flattened(): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2530,7 +2630,8 @@ def test_delete_instances_unary_rest_flattened(): def test_delete_instances_unary_rest_flattened_error(transport: str = "rest"): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2554,11 +2655,16 @@ def test_delete_instances_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.DeletePerInstanceConfigsInstanceGroupManagerRequest, dict,] + "request_type", + [ + compute.DeletePerInstanceConfigsInstanceGroupManagerRequest, + dict, + ], ) def test_delete_per_instance_configs_unary_rest(request_type): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2677,7 +2783,8 @@ def test_delete_per_instance_configs_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2775,7 +2882,11 @@ def test_delete_per_instance_configs_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_per_instance_configs_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2787,7 +2898,8 @@ def test_delete_per_instance_configs_unary_rest_bad_request( request_type=compute.DeletePerInstanceConfigsInstanceGroupManagerRequest, ): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2815,7 +2927,8 @@ def test_delete_per_instance_configs_unary_rest_bad_request( def test_delete_per_instance_configs_unary_rest_flattened(): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2866,7 +2979,8 @@ def test_delete_per_instance_configs_unary_rest_flattened_error( transport: str = "rest", ): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2890,11 +3004,16 @@ def test_delete_per_instance_configs_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.GetInstanceGroupManagerRequest, dict,] + "request_type", + [ + compute.GetInstanceGroupManagerRequest, + dict, + ], ) def test_get_rest(request_type): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2992,7 +3111,8 @@ def test_get_rest_required_fields(request_type=compute.GetInstanceGroupManagerRe assert jsonified_request["zone"] == "zone_value" client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3033,7 +3153,14 @@ def test_get_rest_unset_required_fields(): unset_fields = transport.get._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("instanceGroupManager", "project", "zone",)) + set(()) + & set( + ( + "instanceGroupManager", + "project", + "zone", + ) + ) ) @@ -3080,7 +3207,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.InstanceGroupManager - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -3090,7 +3223,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetInstanceGroupManagerRequest ): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3115,7 +3249,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3161,7 +3296,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3182,11 +3318,16 @@ def test_get_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.InsertInstanceGroupManagerRequest, dict,] + "request_type", + [ + compute.InsertInstanceGroupManagerRequest, + dict, + ], ) def test_insert_unary_rest(request_type): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3361,7 +3502,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3403,7 +3545,14 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("instanceGroupManagerResource", "project", "zone",)) + set(("requestId",)) + & set( + ( + "instanceGroupManagerResource", + "project", + "zone", + ) + ) ) @@ -3449,7 +3598,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3460,7 +3613,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertInstanceGroupManagerRequest ): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3546,7 +3700,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3594,7 +3749,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3621,11 +3777,16 @@ def test_insert_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.ListInstanceGroupManagersRequest, dict,] + "request_type", + [ + compute.ListInstanceGroupManagersRequest, + dict, + ], ) def test_list_rest(request_type): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3690,7 +3851,13 @@ def test_list_rest_required_fields( ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -3701,7 +3868,8 @@ def test_list_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3742,8 +3910,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "zone",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "zone", + ) + ) ) @@ -3790,7 +3971,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.InstanceGroupManagerList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -3800,7 +3987,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListInstanceGroupManagersRequest ): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3821,7 +4009,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3833,7 +4022,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "zone": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", zone="zone_value",) + mock_args = dict( + project="project_value", + zone="zone_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -3859,7 +4051,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3874,7 +4067,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -3891,12 +4085,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.InstanceGroupManagerList(items=[], next_page_token="def",), compute.InstanceGroupManagerList( - items=[compute.InstanceGroupManager(),], next_page_token="ghi", + items=[], + next_page_token="def", + ), + compute.InstanceGroupManagerList( + items=[ + compute.InstanceGroupManager(), + ], + next_page_token="ghi", ), compute.InstanceGroupManagerList( - items=[compute.InstanceGroupManager(), compute.InstanceGroupManager(),], + items=[ + compute.InstanceGroupManager(), + compute.InstanceGroupManager(), + ], ), ) # Two responses for two calls @@ -3924,11 +4127,16 @@ def test_list_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.ListErrorsInstanceGroupManagersRequest, dict,] + "request_type", + [ + compute.ListErrorsInstanceGroupManagersRequest, + dict, + ], ) def test_list_errors_rest(request_type): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3995,7 +4203,13 @@ def test_list_errors_rest_required_fields( ).list_errors._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -4008,7 +4222,8 @@ def test_list_errors_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -4051,8 +4266,22 @@ def test_list_errors_rest_unset_required_fields(): unset_fields = transport.list_errors._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("instanceGroupManager", "project", "zone",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "instanceGroupManager", + "project", + "zone", + ) + ) ) @@ -4087,8 +4316,10 @@ def test_list_errors_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = compute.InstanceGroupManagersListErrorsResponse.to_json( - compute.InstanceGroupManagersListErrorsResponse() + req.return_value._content = ( + compute.InstanceGroupManagersListErrorsResponse.to_json( + compute.InstanceGroupManagersListErrorsResponse() + ) ) request = compute.ListErrorsInstanceGroupManagersRequest() @@ -4099,7 +4330,13 @@ def test_list_errors_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.InstanceGroupManagersListErrorsResponse - client.list_errors(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list_errors( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -4109,7 +4346,8 @@ def test_list_errors_rest_bad_request( transport: str = "rest", request_type=compute.ListErrorsInstanceGroupManagersRequest ): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -4134,7 +4372,8 @@ def test_list_errors_rest_bad_request( def test_list_errors_rest_flattened(): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -4182,7 +4421,8 @@ def test_list_errors_rest_flattened(): def test_list_errors_rest_flattened_error(transport: str = "rest"): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -4198,7 +4438,8 @@ def test_list_errors_rest_flattened_error(transport: str = "rest"): def test_list_errors_rest_pager(transport: str = "rest"): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -4216,10 +4457,14 @@ def test_list_errors_rest_pager(transport: str = "rest"): next_page_token="abc", ), compute.InstanceGroupManagersListErrorsResponse( - items=[], next_page_token="def", + items=[], + next_page_token="def", ), compute.InstanceGroupManagersListErrorsResponse( - items=[compute.InstanceManagedByIgmError(),], next_page_token="ghi", + items=[ + compute.InstanceManagedByIgmError(), + ], + next_page_token="ghi", ), compute.InstanceGroupManagersListErrorsResponse( items=[ @@ -4259,11 +4504,16 @@ def test_list_errors_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.ListManagedInstancesInstanceGroupManagersRequest, dict,] + "request_type", + [ + compute.ListManagedInstancesInstanceGroupManagersRequest, + dict, + ], ) def test_list_managed_instances_rest(request_type): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -4284,8 +4534,10 @@ def test_list_managed_instances_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = compute.InstanceGroupManagersListManagedInstancesResponse.to_json( - return_value + json_return_value = ( + compute.InstanceGroupManagersListManagedInstancesResponse.to_json( + return_value + ) ) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -4330,7 +4582,13 @@ def test_list_managed_instances_rest_required_fields( ).list_managed_instances._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -4343,7 +4601,8 @@ def test_list_managed_instances_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -4366,8 +4625,10 @@ def test_list_managed_instances_rest_required_fields( response_value = Response() response_value.status_code = 200 - json_return_value = compute.InstanceGroupManagersListManagedInstancesResponse.to_json( - return_value + json_return_value = ( + compute.InstanceGroupManagersListManagedInstancesResponse.to_json( + return_value + ) ) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -4386,8 +4647,22 @@ def test_list_managed_instances_rest_unset_required_fields(): unset_fields = transport.list_managed_instances._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("instanceGroupManager", "project", "zone",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "instanceGroupManager", + "project", + "zone", + ) + ) ) @@ -4422,8 +4697,10 @@ def test_list_managed_instances_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = compute.InstanceGroupManagersListManagedInstancesResponse.to_json( - compute.InstanceGroupManagersListManagedInstancesResponse() + req.return_value._content = ( + compute.InstanceGroupManagersListManagedInstancesResponse.to_json( + compute.InstanceGroupManagersListManagedInstancesResponse() + ) ) request = compute.ListManagedInstancesInstanceGroupManagersRequest() @@ -4435,7 +4712,11 @@ def test_list_managed_instances_rest_interceptors(null_interceptor): post.return_value = compute.InstanceGroupManagersListManagedInstancesResponse client.list_managed_instances( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -4447,7 +4728,8 @@ def test_list_managed_instances_rest_bad_request( request_type=compute.ListManagedInstancesInstanceGroupManagersRequest, ): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -4472,7 +4754,8 @@ def test_list_managed_instances_rest_bad_request( def test_list_managed_instances_rest_flattened(): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -4498,8 +4781,10 @@ def test_list_managed_instances_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = compute.InstanceGroupManagersListManagedInstancesResponse.to_json( - return_value + json_return_value = ( + compute.InstanceGroupManagersListManagedInstancesResponse.to_json( + return_value + ) ) response_value._content = json_return_value.encode("UTF-8") @@ -4520,7 +4805,8 @@ def test_list_managed_instances_rest_flattened(): def test_list_managed_instances_rest_flattened_error(transport: str = "rest"): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -4536,7 +4822,8 @@ def test_list_managed_instances_rest_flattened_error(transport: str = "rest"): def test_list_managed_instances_rest_pager(transport: str = "rest"): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -4554,10 +4841,14 @@ def test_list_managed_instances_rest_pager(transport: str = "rest"): next_page_token="abc", ), compute.InstanceGroupManagersListManagedInstancesResponse( - managed_instances=[], next_page_token="def", + managed_instances=[], + next_page_token="def", ), compute.InstanceGroupManagersListManagedInstancesResponse( - managed_instances=[compute.ManagedInstance(),], next_page_token="ghi", + managed_instances=[ + compute.ManagedInstance(), + ], + next_page_token="ghi", ), compute.InstanceGroupManagersListManagedInstancesResponse( managed_instances=[ @@ -4598,11 +4889,16 @@ def test_list_managed_instances_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.ListPerInstanceConfigsInstanceGroupManagersRequest, dict,] + "request_type", + [ + compute.ListPerInstanceConfigsInstanceGroupManagersRequest, + dict, + ], ) def test_list_per_instance_configs_rest(request_type): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -4623,8 +4919,10 @@ def test_list_per_instance_configs_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = compute.InstanceGroupManagersListPerInstanceConfigsResp.to_json( - return_value + json_return_value = ( + compute.InstanceGroupManagersListPerInstanceConfigsResp.to_json( + return_value + ) ) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -4669,7 +4967,13 @@ def test_list_per_instance_configs_rest_required_fields( ).list_per_instance_configs._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -4682,7 +4986,8 @@ def test_list_per_instance_configs_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -4705,8 +5010,10 @@ def test_list_per_instance_configs_rest_required_fields( response_value = Response() response_value.status_code = 200 - json_return_value = compute.InstanceGroupManagersListPerInstanceConfigsResp.to_json( - return_value + json_return_value = ( + compute.InstanceGroupManagersListPerInstanceConfigsResp.to_json( + return_value + ) ) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -4725,8 +5032,22 @@ def test_list_per_instance_configs_rest_unset_required_fields(): unset_fields = transport.list_per_instance_configs._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("instanceGroupManager", "project", "zone",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "instanceGroupManager", + "project", + "zone", + ) + ) ) @@ -4762,8 +5083,10 @@ def test_list_per_instance_configs_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = compute.InstanceGroupManagersListPerInstanceConfigsResp.to_json( - compute.InstanceGroupManagersListPerInstanceConfigsResp() + req.return_value._content = ( + compute.InstanceGroupManagersListPerInstanceConfigsResp.to_json( + compute.InstanceGroupManagersListPerInstanceConfigsResp() + ) ) request = compute.ListPerInstanceConfigsInstanceGroupManagersRequest() @@ -4775,7 +5098,11 @@ def test_list_per_instance_configs_rest_interceptors(null_interceptor): post.return_value = compute.InstanceGroupManagersListPerInstanceConfigsResp client.list_per_instance_configs( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -4787,7 +5114,8 @@ def test_list_per_instance_configs_rest_bad_request( request_type=compute.ListPerInstanceConfigsInstanceGroupManagersRequest, ): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -4812,7 +5140,8 @@ def test_list_per_instance_configs_rest_bad_request( def test_list_per_instance_configs_rest_flattened(): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -4838,8 +5167,10 @@ def test_list_per_instance_configs_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = compute.InstanceGroupManagersListPerInstanceConfigsResp.to_json( - return_value + json_return_value = ( + compute.InstanceGroupManagersListPerInstanceConfigsResp.to_json( + return_value + ) ) response_value._content = json_return_value.encode("UTF-8") @@ -4860,7 +5191,8 @@ def test_list_per_instance_configs_rest_flattened(): def test_list_per_instance_configs_rest_flattened_error(transport: str = "rest"): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -4876,7 +5208,8 @@ def test_list_per_instance_configs_rest_flattened_error(transport: str = "rest") def test_list_per_instance_configs_rest_pager(transport: str = "rest"): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -4894,13 +5227,20 @@ def test_list_per_instance_configs_rest_pager(transport: str = "rest"): next_page_token="abc", ), compute.InstanceGroupManagersListPerInstanceConfigsResp( - items=[], next_page_token="def", + items=[], + next_page_token="def", ), compute.InstanceGroupManagersListPerInstanceConfigsResp( - items=[compute.PerInstanceConfig(),], next_page_token="ghi", + items=[ + compute.PerInstanceConfig(), + ], + next_page_token="ghi", ), compute.InstanceGroupManagersListPerInstanceConfigsResp( - items=[compute.PerInstanceConfig(), compute.PerInstanceConfig(),], + items=[ + compute.PerInstanceConfig(), + compute.PerInstanceConfig(), + ], ), ) # Two responses for two calls @@ -4935,11 +5275,16 @@ def test_list_per_instance_configs_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.PatchInstanceGroupManagerRequest, dict,] + "request_type", + [ + compute.PatchInstanceGroupManagerRequest, + dict, + ], ) def test_patch_unary_rest(request_type): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -5122,7 +5467,8 @@ def test_patch_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -5166,7 +5512,12 @@ def test_patch_unary_rest_unset_required_fields(): assert set(unset_fields) == ( set(("requestId",)) & set( - ("instanceGroupManager", "instanceGroupManagerResource", "project", "zone",) + ( + "instanceGroupManager", + "instanceGroupManagerResource", + "project", + "zone", + ) ) ) @@ -5212,7 +5563,13 @@ def test_patch_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.patch_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -5222,7 +5579,8 @@ def test_patch_unary_rest_bad_request( transport: str = "rest", request_type=compute.PatchInstanceGroupManagerRequest ): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -5312,7 +5670,8 @@ def test_patch_unary_rest_bad_request( def test_patch_unary_rest_flattened(): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -5365,7 +5724,8 @@ def test_patch_unary_rest_flattened(): def test_patch_unary_rest_flattened_error(transport: str = "rest"): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -5393,11 +5753,16 @@ def test_patch_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.PatchPerInstanceConfigsInstanceGroupManagerRequest, dict,] + "request_type", + [ + compute.PatchPerInstanceConfigsInstanceGroupManagerRequest, + dict, + ], ) def test_patch_per_instance_configs_unary_rest(request_type): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -5525,7 +5890,8 @@ def test_patch_per_instance_configs_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -5623,7 +5989,11 @@ def test_patch_per_instance_configs_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.patch_per_instance_configs_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -5635,7 +6005,8 @@ def test_patch_per_instance_configs_unary_rest_bad_request( request_type=compute.PatchPerInstanceConfigsInstanceGroupManagerRequest, ): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -5670,7 +6041,8 @@ def test_patch_per_instance_configs_unary_rest_bad_request( def test_patch_per_instance_configs_unary_rest_flattened(): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -5721,7 +6093,8 @@ def test_patch_per_instance_configs_unary_rest_flattened(): def test_patch_per_instance_configs_unary_rest_flattened_error(transport: str = "rest"): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -5747,11 +6120,16 @@ def test_patch_per_instance_configs_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.RecreateInstancesInstanceGroupManagerRequest, dict,] + "request_type", + [ + compute.RecreateInstancesInstanceGroupManagerRequest, + dict, + ], ) def test_recreate_instances_unary_rest(request_type): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -5872,7 +6250,8 @@ def test_recreate_instances_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -5968,7 +6347,11 @@ def test_recreate_instances_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.recreate_instances_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -5980,7 +6363,8 @@ def test_recreate_instances_unary_rest_bad_request( request_type=compute.RecreateInstancesInstanceGroupManagerRequest, ): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -6008,7 +6392,8 @@ def test_recreate_instances_unary_rest_bad_request( def test_recreate_instances_unary_rest_flattened(): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -6057,7 +6442,8 @@ def test_recreate_instances_unary_rest_flattened(): def test_recreate_instances_unary_rest_flattened_error(transport: str = "rest"): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -6081,11 +6467,16 @@ def test_recreate_instances_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.ResizeInstanceGroupManagerRequest, dict,] + "request_type", + [ + compute.ResizeInstanceGroupManagerRequest, + dict, + ], ) def test_resize_unary_rest(request_type): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -6196,7 +6587,12 @@ def test_resize_unary_rest_required_fields( credentials=ga_credentials.AnonymousCredentials() ).resize._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("request_id", "size",)) + assert not set(unset_fields) - set( + ( + "request_id", + "size", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -6210,7 +6606,8 @@ def test_resize_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -6240,7 +6637,10 @@ def test_resize_unary_rest_required_fields( response = client.resize_unary(request) expected_params = [ - ("size", 0,), + ( + "size", + 0, + ), ] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -6253,8 +6653,20 @@ def test_resize_unary_rest_unset_required_fields(): unset_fields = transport.resize._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId", "size",)) - & set(("instanceGroupManager", "project", "size", "zone",)) + set( + ( + "requestId", + "size", + ) + ) + & set( + ( + "instanceGroupManager", + "project", + "size", + "zone", + ) + ) ) @@ -6300,7 +6712,11 @@ def test_resize_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.resize_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -6311,7 +6727,8 @@ def test_resize_unary_rest_bad_request( transport: str = "rest", request_type=compute.ResizeInstanceGroupManagerRequest ): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -6336,7 +6753,8 @@ def test_resize_unary_rest_bad_request( def test_resize_unary_rest_flattened(): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -6383,7 +6801,8 @@ def test_resize_unary_rest_flattened(): def test_resize_unary_rest_flattened_error(transport: str = "rest"): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -6405,11 +6824,16 @@ def test_resize_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SetInstanceTemplateInstanceGroupManagerRequest, dict,] + "request_type", + [ + compute.SetInstanceTemplateInstanceGroupManagerRequest, + dict, + ], ) def test_set_instance_template_unary_rest(request_type): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -6530,7 +6954,8 @@ def test_set_instance_template_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -6626,7 +7051,11 @@ def test_set_instance_template_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_instance_template_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -6638,7 +7067,8 @@ def test_set_instance_template_unary_rest_bad_request( request_type=compute.SetInstanceTemplateInstanceGroupManagerRequest, ): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -6666,7 +7096,8 @@ def test_set_instance_template_unary_rest_bad_request( def test_set_instance_template_unary_rest_flattened(): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -6715,7 +7146,8 @@ def test_set_instance_template_unary_rest_flattened(): def test_set_instance_template_unary_rest_flattened_error(transport: str = "rest"): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -6739,11 +7171,16 @@ def test_set_instance_template_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SetTargetPoolsInstanceGroupManagerRequest, dict,] + "request_type", + [ + compute.SetTargetPoolsInstanceGroupManagerRequest, + dict, + ], ) def test_set_target_pools_unary_rest(request_type): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -6865,7 +7302,8 @@ def test_set_target_pools_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -6961,7 +7399,11 @@ def test_set_target_pools_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_target_pools_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -6973,7 +7415,8 @@ def test_set_target_pools_unary_rest_bad_request( request_type=compute.SetTargetPoolsInstanceGroupManagerRequest, ): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -7002,7 +7445,8 @@ def test_set_target_pools_unary_rest_bad_request( def test_set_target_pools_unary_rest_flattened(): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -7051,7 +7495,8 @@ def test_set_target_pools_unary_rest_flattened(): def test_set_target_pools_unary_rest_flattened_error(transport: str = "rest"): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -7075,11 +7520,16 @@ def test_set_target_pools_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.UpdatePerInstanceConfigsInstanceGroupManagerRequest, dict,] + "request_type", + [ + compute.UpdatePerInstanceConfigsInstanceGroupManagerRequest, + dict, + ], ) def test_update_per_instance_configs_unary_rest(request_type): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -7207,7 +7657,8 @@ def test_update_per_instance_configs_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -7305,7 +7756,11 @@ def test_update_per_instance_configs_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.update_per_instance_configs_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -7317,7 +7772,8 @@ def test_update_per_instance_configs_unary_rest_bad_request( request_type=compute.UpdatePerInstanceConfigsInstanceGroupManagerRequest, ): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -7352,7 +7808,8 @@ def test_update_per_instance_configs_unary_rest_bad_request( def test_update_per_instance_configs_unary_rest_flattened(): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -7405,7 +7862,8 @@ def test_update_per_instance_configs_unary_rest_flattened_error( transport: str = "rest", ): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -7437,7 +7895,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -7458,7 +7917,8 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = InstanceGroupManagersClient( - client_options=options, transport=transport, + client_options=options, + transport=transport, ) # It is an error to provide an api_key and a credential. @@ -7475,7 +7935,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = InstanceGroupManagersClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -7489,7 +7950,10 @@ def test_transport_instance(): @pytest.mark.parametrize( - "transport_class", [transports.InstanceGroupManagersRestTransport,] + "transport_class", + [ + transports.InstanceGroupManagersRestTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -7560,7 +8024,8 @@ def test_instance_group_managers_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.InstanceGroupManagersTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -7610,7 +8075,12 @@ def test_instance_group_managers_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_instance_group_managers_host_no_port(transport_name): client = InstanceGroupManagersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7626,7 +8096,12 @@ def test_instance_group_managers_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_instance_group_managers_host_with_port(transport_name): client = InstanceGroupManagersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7664,7 +8139,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = InstanceGroupManagersClient.common_folder_path(folder) assert expected == actual @@ -7682,7 +8159,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = InstanceGroupManagersClient.common_organization_path(organization) assert expected == actual @@ -7700,7 +8179,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = InstanceGroupManagersClient.common_project_path(project) assert expected == actual @@ -7720,7 +8201,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = InstanceGroupManagersClient.common_location_path(project, location) assert expected == actual @@ -7745,7 +8227,8 @@ def test_client_with_default_client_info(): transports.InstanceGroupManagersTransport, "_prep_wrapped_messages" ) as prep: client = InstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -7754,7 +8237,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = InstanceGroupManagersClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -7794,7 +8278,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(InstanceGroupManagersClient, transports.InstanceGroupManagersRestTransport),], + [ + (InstanceGroupManagersClient, transports.InstanceGroupManagersRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_instance_groups.py b/tests/unit/gapic/compute_v1/test_instance_groups.py index fa7ced0e4..651a5fa36 100644 --- a/tests/unit/gapic/compute_v1/test_instance_groups.py +++ b/tests/unit/gapic/compute_v1/test_instance_groups.py @@ -89,7 +89,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(InstanceGroupsClient, "rest"),] + "client_class,transport_name", + [ + (InstanceGroupsClient, "rest"), + ], ) def test_instance_groups_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() @@ -111,7 +114,9 @@ def test_instance_groups_client_from_service_account_info(client_class, transpor @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.InstanceGroupsRestTransport, "rest"),], + [ + (transports.InstanceGroupsRestTransport, "rest"), + ], ) def test_instance_groups_client_service_account_always_use_jwt( transport_class, transport_name @@ -132,7 +137,10 @@ def test_instance_groups_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(InstanceGroupsClient, "rest"),] + "client_class,transport_name", + [ + (InstanceGroupsClient, "rest"), + ], ) def test_instance_groups_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() @@ -172,7 +180,9 @@ def test_instance_groups_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(InstanceGroupsClient, transports.InstanceGroupsRestTransport, "rest"),], + [ + (InstanceGroupsClient, transports.InstanceGroupsRestTransport, "rest"), + ], ) @mock.patch.object( InstanceGroupsClient, @@ -455,13 +465,17 @@ def test_instance_groups_client_get_mtls_endpoint_and_cert_source(client_class): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(InstanceGroupsClient, transports.InstanceGroupsRestTransport, "rest"),], + [ + (InstanceGroupsClient, transports.InstanceGroupsRestTransport, "rest"), + ], ) def test_instance_groups_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -479,7 +493,9 @@ def test_instance_groups_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(InstanceGroupsClient, transports.InstanceGroupsRestTransport, "rest", None),], + [ + (InstanceGroupsClient, transports.InstanceGroupsRestTransport, "rest", None), + ], ) def test_instance_groups_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -503,11 +519,16 @@ def test_instance_groups_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.AddInstancesInstanceGroupRequest, dict,] + "request_type", + [ + compute.AddInstancesInstanceGroupRequest, + dict, + ], ) def test_add_instances_unary_rest(request_type): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -628,7 +649,8 @@ def test_add_instances_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -724,7 +746,11 @@ def test_add_instances_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.add_instances_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -735,7 +761,8 @@ def test_add_instances_unary_rest_bad_request( transport: str = "rest", request_type=compute.AddInstancesInstanceGroupRequest ): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -763,7 +790,8 @@ def test_add_instances_unary_rest_bad_request( def test_add_instances_unary_rest_flattened(): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -812,7 +840,8 @@ def test_add_instances_unary_rest_flattened(): def test_add_instances_unary_rest_flattened_error(transport: str = "rest"): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -836,11 +865,16 @@ def test_add_instances_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.AggregatedListInstanceGroupsRequest, dict,] + "request_type", + [ + compute.AggregatedListInstanceGroupsRequest, + dict, + ], ) def test_aggregated_list_rest(request_type): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -921,7 +955,8 @@ def test_aggregated_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1022,7 +1057,11 @@ def test_aggregated_list_rest_interceptors(null_interceptor): post.return_value = compute.InstanceGroupAggregatedList client.aggregated_list( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1033,7 +1072,8 @@ def test_aggregated_list_rest_bad_request( transport: str = "rest", request_type=compute.AggregatedListInstanceGroupsRequest ): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1054,7 +1094,8 @@ def test_aggregated_list_rest_bad_request( def test_aggregated_list_rest_flattened(): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1066,7 +1107,9 @@ def test_aggregated_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1092,20 +1135,23 @@ def test_aggregated_list_rest_flattened(): def test_aggregated_list_rest_flattened_error(transport: str = "rest"): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.aggregated_list( - compute.AggregatedListInstanceGroupsRequest(), project="project_value", + compute.AggregatedListInstanceGroupsRequest(), + project="project_value", ) def test_aggregated_list_rest_pager(transport: str = "rest"): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1122,9 +1168,15 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): }, next_page_token="abc", ), - compute.InstanceGroupAggregatedList(items={}, next_page_token="def",), compute.InstanceGroupAggregatedList( - items={"g": compute.InstanceGroupsScopedList(),}, next_page_token="ghi", + items={}, + next_page_token="def", + ), + compute.InstanceGroupAggregatedList( + items={ + "g": compute.InstanceGroupsScopedList(), + }, + next_page_token="ghi", ), compute.InstanceGroupAggregatedList( items={ @@ -1171,10 +1223,17 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.DeleteInstanceGroupRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteInstanceGroupRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1292,7 +1351,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1333,7 +1393,14 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("instanceGroup", "project", "zone",)) + set(("requestId",)) + & set( + ( + "instanceGroup", + "project", + "zone", + ) + ) ) @@ -1379,7 +1446,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1390,7 +1461,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteInstanceGroupRequest ): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1415,7 +1487,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1461,7 +1534,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1481,10 +1555,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetInstanceGroupRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetInstanceGroupRequest, + dict, + ], +) def test_get_rest(request_type): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1578,7 +1659,8 @@ def test_get_rest_required_fields(request_type=compute.GetInstanceGroupRequest): assert jsonified_request["zone"] == "zone_value" client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1618,7 +1700,16 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("instanceGroup", "project", "zone",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "instanceGroup", + "project", + "zone", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1664,7 +1755,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.InstanceGroup - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1674,7 +1771,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetInstanceGroupRequest ): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1699,7 +1797,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1745,7 +1844,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1765,10 +1865,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertInstanceGroupRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertInstanceGroupRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1893,7 +2000,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1935,7 +2043,14 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("instanceGroupResource", "project", "zone",)) + set(("requestId",)) + & set( + ( + "instanceGroupResource", + "project", + "zone", + ) + ) ) @@ -1981,7 +2096,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1992,7 +2111,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertInstanceGroupRequest ): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2028,7 +2148,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2072,7 +2193,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2094,10 +2216,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListInstanceGroupsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListInstanceGroupsRequest, + dict, + ], +) def test_list_rest(request_type): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2160,7 +2289,13 @@ def test_list_rest_required_fields(request_type=compute.ListInstanceGroupsReques ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -2171,7 +2306,8 @@ def test_list_rest_required_fields(request_type=compute.ListInstanceGroupsReques assert jsonified_request["zone"] == "zone_value" client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2212,8 +2348,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "zone",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "zone", + ) + ) ) @@ -2260,7 +2409,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.InstanceGroupList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2270,7 +2425,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListInstanceGroupsRequest ): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2291,7 +2447,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2303,7 +2460,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "zone": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", zone="zone_value",) + mock_args = dict( + project="project_value", + zone="zone_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2329,7 +2489,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2344,7 +2505,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2361,12 +2523,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.InstanceGroupList(items=[], next_page_token="def",), compute.InstanceGroupList( - items=[compute.InstanceGroup(),], next_page_token="ghi", + items=[], + next_page_token="def", + ), + compute.InstanceGroupList( + items=[ + compute.InstanceGroup(), + ], + next_page_token="ghi", ), compute.InstanceGroupList( - items=[compute.InstanceGroup(), compute.InstanceGroup(),], + items=[ + compute.InstanceGroup(), + compute.InstanceGroup(), + ], ), ) # Two responses for two calls @@ -2394,11 +2565,16 @@ def test_list_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.ListInstancesInstanceGroupsRequest, dict,] + "request_type", + [ + compute.ListInstancesInstanceGroupsRequest, + dict, + ], ) def test_list_instances_rest(request_type): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2472,7 +2648,13 @@ def test_list_instances_rest_required_fields( ).list_instances._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -2485,7 +2667,8 @@ def test_list_instances_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2529,7 +2712,15 @@ def test_list_instances_rest_unset_required_fields(): unset_fields = transport.list_instances._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set( ( "instanceGroup", @@ -2585,7 +2776,11 @@ def test_list_instances_rest_interceptors(null_interceptor): post.return_value = compute.InstanceGroupsListInstances client.list_instances( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2596,7 +2791,8 @@ def test_list_instances_rest_bad_request( transport: str = "rest", request_type=compute.ListInstancesInstanceGroupsRequest ): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2624,7 +2820,8 @@ def test_list_instances_rest_bad_request( def test_list_instances_rest_flattened(): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2673,7 +2870,8 @@ def test_list_instances_rest_flattened(): def test_list_instances_rest_flattened_error(transport: str = "rest"): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2692,7 +2890,8 @@ def test_list_instances_rest_flattened_error(transport: str = "rest"): def test_list_instances_rest_pager(transport: str = "rest"): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2709,9 +2908,15 @@ def test_list_instances_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.InstanceGroupsListInstances(items=[], next_page_token="def",), compute.InstanceGroupsListInstances( - items=[compute.InstanceWithNamedPorts(),], next_page_token="ghi", + items=[], + next_page_token="def", + ), + compute.InstanceGroupsListInstances( + items=[ + compute.InstanceWithNamedPorts(), + ], + next_page_token="ghi", ), compute.InstanceGroupsListInstances( items=[ @@ -2756,11 +2961,16 @@ def test_list_instances_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.RemoveInstancesInstanceGroupRequest, dict,] + "request_type", + [ + compute.RemoveInstancesInstanceGroupRequest, + dict, + ], ) def test_remove_instances_unary_rest(request_type): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2881,7 +3091,8 @@ def test_remove_instances_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2977,7 +3188,11 @@ def test_remove_instances_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.remove_instances_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2988,7 +3203,8 @@ def test_remove_instances_unary_rest_bad_request( transport: str = "rest", request_type=compute.RemoveInstancesInstanceGroupRequest ): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3016,7 +3232,8 @@ def test_remove_instances_unary_rest_bad_request( def test_remove_instances_unary_rest_flattened(): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3065,7 +3282,8 @@ def test_remove_instances_unary_rest_flattened(): def test_remove_instances_unary_rest_flattened_error(transport: str = "rest"): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3089,11 +3307,16 @@ def test_remove_instances_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SetNamedPortsInstanceGroupRequest, dict,] + "request_type", + [ + compute.SetNamedPortsInstanceGroupRequest, + dict, + ], ) def test_set_named_ports_unary_rest(request_type): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3215,7 +3438,8 @@ def test_set_named_ports_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3311,7 +3535,11 @@ def test_set_named_ports_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_named_ports_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3322,7 +3550,8 @@ def test_set_named_ports_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetNamedPortsInstanceGroupRequest ): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3351,7 +3580,8 @@ def test_set_named_ports_unary_rest_bad_request( def test_set_named_ports_unary_rest_flattened(): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3400,7 +3630,8 @@ def test_set_named_ports_unary_rest_flattened(): def test_set_named_ports_unary_rest_flattened_error(transport: str = "rest"): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3430,7 +3661,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -3450,7 +3682,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = InstanceGroupsClient(client_options=options, transport=transport,) + client = InstanceGroupsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -3466,7 +3701,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = InstanceGroupsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -3479,7 +3715,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.InstanceGroupsRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.InstanceGroupsRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -3538,7 +3779,8 @@ def test_instance_groups_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.InstanceGroupsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -3588,7 +3830,12 @@ def test_instance_groups_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_instance_groups_host_no_port(transport_name): client = InstanceGroupsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3604,7 +3851,12 @@ def test_instance_groups_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_instance_groups_host_with_port(transport_name): client = InstanceGroupsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3642,7 +3894,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = InstanceGroupsClient.common_folder_path(folder) assert expected == actual @@ -3660,7 +3914,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = InstanceGroupsClient.common_organization_path(organization) assert expected == actual @@ -3678,7 +3934,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = InstanceGroupsClient.common_project_path(project) assert expected == actual @@ -3698,7 +3956,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = InstanceGroupsClient.common_location_path(project, location) assert expected == actual @@ -3723,7 +3982,8 @@ def test_client_with_default_client_info(): transports.InstanceGroupsTransport, "_prep_wrapped_messages" ) as prep: client = InstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3732,7 +3992,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = InstanceGroupsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3772,7 +4033,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(InstanceGroupsClient, transports.InstanceGroupsRestTransport),], + [ + (InstanceGroupsClient, transports.InstanceGroupsRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_instance_templates.py b/tests/unit/gapic/compute_v1/test_instance_templates.py index 148633db5..bda147203 100644 --- a/tests/unit/gapic/compute_v1/test_instance_templates.py +++ b/tests/unit/gapic/compute_v1/test_instance_templates.py @@ -90,7 +90,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(InstanceTemplatesClient, "rest"),] + "client_class,transport_name", + [ + (InstanceTemplatesClient, "rest"), + ], ) def test_instance_templates_client_from_service_account_info( client_class, transport_name @@ -114,7 +117,9 @@ def test_instance_templates_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.InstanceTemplatesRestTransport, "rest"),], + [ + (transports.InstanceTemplatesRestTransport, "rest"), + ], ) def test_instance_templates_client_service_account_always_use_jwt( transport_class, transport_name @@ -135,7 +140,10 @@ def test_instance_templates_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(InstanceTemplatesClient, "rest"),] + "client_class,transport_name", + [ + (InstanceTemplatesClient, "rest"), + ], ) def test_instance_templates_client_from_service_account_file( client_class, transport_name @@ -177,7 +185,9 @@ def test_instance_templates_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(InstanceTemplatesClient, transports.InstanceTemplatesRestTransport, "rest"),], + [ + (InstanceTemplatesClient, transports.InstanceTemplatesRestTransport, "rest"), + ], ) @mock.patch.object( InstanceTemplatesClient, @@ -470,13 +480,17 @@ def test_instance_templates_client_get_mtls_endpoint_and_cert_source(client_clas @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(InstanceTemplatesClient, transports.InstanceTemplatesRestTransport, "rest"),], + [ + (InstanceTemplatesClient, transports.InstanceTemplatesRestTransport, "rest"), + ], ) def test_instance_templates_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -524,10 +538,17 @@ def test_instance_templates_client_client_options_credentials_file( ) -@pytest.mark.parametrize("request_type", [compute.DeleteInstanceTemplateRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteInstanceTemplateRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -637,7 +658,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -678,7 +700,13 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("instanceTemplate", "project",)) + set(("requestId",)) + & set( + ( + "instanceTemplate", + "project", + ) + ) ) @@ -724,7 +752,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -735,7 +767,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteInstanceTemplateRequest ): client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -756,7 +789,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -769,7 +803,8 @@ def test_delete_unary_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", instance_template="instance_template_value", + project="project_value", + instance_template="instance_template_value", ) mock_args.update(sample_request) @@ -796,7 +831,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -815,10 +851,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetInstanceTemplateRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetInstanceTemplateRequest, + dict, + ], +) def test_get_rest(request_type): client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -894,7 +937,8 @@ def test_get_rest_required_fields(request_type=compute.GetInstanceTemplateReques assert jsonified_request["project"] == "project_value" client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -934,7 +978,15 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("instanceTemplate", "project",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "instanceTemplate", + "project", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -980,7 +1032,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.InstanceTemplate - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -990,7 +1048,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetInstanceTemplateRequest ): client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1011,7 +1070,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1024,7 +1084,8 @@ def test_get_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", instance_template="instance_template_value", + project="project_value", + instance_template="instance_template_value", ) mock_args.update(sample_request) @@ -1051,7 +1112,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1071,11 +1133,16 @@ def test_get_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.GetIamPolicyInstanceTemplateRequest, dict,] + "request_type", + [ + compute.GetIamPolicyInstanceTemplateRequest, + dict, + ], ) def test_get_iam_policy_rest(request_type): client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1085,7 +1152,11 @@ def test_get_iam_policy_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = compute.Policy(etag="etag_value", iam_owned=True, version=774,) + return_value = compute.Policy( + etag="etag_value", + iam_owned=True, + version=774, + ) # Wrap the value into a proper Response obj response_value = Response() @@ -1143,7 +1214,8 @@ def test_get_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1184,7 +1256,13 @@ def test_get_iam_policy_rest_unset_required_fields(): unset_fields = transport.get_iam_policy._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("optionsRequestedPolicyVersion",)) & set(("project", "resource",)) + set(("optionsRequestedPolicyVersion",)) + & set( + ( + "project", + "resource", + ) + ) ) @@ -1230,7 +1308,11 @@ def test_get_iam_policy_rest_interceptors(null_interceptor): post.return_value = compute.Policy client.get_iam_policy( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1241,7 +1323,8 @@ def test_get_iam_policy_rest_bad_request( transport: str = "rest", request_type=compute.GetIamPolicyInstanceTemplateRequest ): client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1262,7 +1345,8 @@ def test_get_iam_policy_rest_bad_request( def test_get_iam_policy_rest_flattened(): client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1274,7 +1358,10 @@ def test_get_iam_policy_rest_flattened(): sample_request = {"project": "sample1", "resource": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", resource="resource_value",) + mock_args = dict( + project="project_value", + resource="resource_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1300,7 +1387,8 @@ def test_get_iam_policy_rest_flattened(): def test_get_iam_policy_rest_flattened_error(transport: str = "rest"): client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1319,10 +1407,17 @@ def test_get_iam_policy_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertInstanceTemplateRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertInstanceTemplateRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1597,7 +1692,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1639,7 +1735,13 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("instanceTemplateResource", "project",)) + set(("requestId",)) + & set( + ( + "instanceTemplateResource", + "project", + ) + ) ) @@ -1685,7 +1787,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1696,7 +1802,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertInstanceTemplateRequest ): client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1886,7 +1993,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1929,7 +2037,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1950,10 +2059,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListInstanceTemplatesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListInstanceTemplatesRequest, + dict, + ], +) def test_list_rest(request_type): client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2014,7 +2130,13 @@ def test_list_rest_required_fields(request_type=compute.ListInstanceTemplatesReq ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -2023,7 +2145,8 @@ def test_list_rest_required_fields(request_type=compute.ListInstanceTemplatesReq assert jsonified_request["project"] == "project_value" client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2064,7 +2187,15 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set(("project",)) ) @@ -2112,7 +2243,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.InstanceTemplateList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2122,7 +2259,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListInstanceTemplatesRequest ): client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2143,7 +2281,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2155,7 +2294,9 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2181,20 +2322,23 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list( - compute.ListInstanceTemplatesRequest(), project="project_value", + compute.ListInstanceTemplatesRequest(), + project="project_value", ) def test_list_rest_pager(transport: str = "rest"): client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2211,12 +2355,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.InstanceTemplateList(items=[], next_page_token="def",), compute.InstanceTemplateList( - items=[compute.InstanceTemplate(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.InstanceTemplateList( - items=[compute.InstanceTemplate(), compute.InstanceTemplate(),], + items=[ + compute.InstanceTemplate(), + ], + next_page_token="ghi", + ), + compute.InstanceTemplateList( + items=[ + compute.InstanceTemplate(), + compute.InstanceTemplate(), + ], ), ) # Two responses for two calls @@ -2244,11 +2397,16 @@ def test_list_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.SetIamPolicyInstanceTemplateRequest, dict,] + "request_type", + [ + compute.SetIamPolicyInstanceTemplateRequest, + dict, + ], ) def test_set_iam_policy_rest(request_type): client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2335,7 +2493,11 @@ def test_set_iam_policy_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = compute.Policy(etag="etag_value", iam_owned=True, version=774,) + return_value = compute.Policy( + etag="etag_value", + iam_owned=True, + version=774, + ) # Wrap the value into a proper Response obj response_value = Response() @@ -2391,7 +2553,8 @@ def test_set_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2433,7 +2596,14 @@ def test_set_iam_policy_rest_unset_required_fields(): unset_fields = transport.set_iam_policy._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("globalSetPolicyRequestResource", "project", "resource",)) + set(()) + & set( + ( + "globalSetPolicyRequestResource", + "project", + "resource", + ) + ) ) @@ -2479,7 +2649,11 @@ def test_set_iam_policy_rest_interceptors(null_interceptor): post.return_value = compute.Policy client.set_iam_policy( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2490,7 +2664,8 @@ def test_set_iam_policy_rest_bad_request( transport: str = "rest", request_type=compute.SetIamPolicyInstanceTemplateRequest ): client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2588,7 +2763,8 @@ def test_set_iam_policy_rest_bad_request( def test_set_iam_policy_rest_flattened(): client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2632,7 +2808,8 @@ def test_set_iam_policy_rest_flattened(): def test_set_iam_policy_rest_flattened_error(transport: str = "rest"): client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2655,11 +2832,16 @@ def test_set_iam_policy_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.TestIamPermissionsInstanceTemplateRequest, dict,] + "request_type", + [ + compute.TestIamPermissionsInstanceTemplateRequest, + dict, + ], ) def test_test_iam_permissions_rest(request_type): client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2728,7 +2910,8 @@ def test_test_iam_permissions_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2770,7 +2953,14 @@ def test_test_iam_permissions_rest_unset_required_fields(): unset_fields = transport.test_iam_permissions._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("project", "resource", "testPermissionsRequestResource",)) + set(()) + & set( + ( + "project", + "resource", + "testPermissionsRequestResource", + ) + ) ) @@ -2818,7 +3008,11 @@ def test_test_iam_permissions_rest_interceptors(null_interceptor): post.return_value = compute.TestPermissionsResponse client.test_iam_permissions( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2830,7 +3024,8 @@ def test_test_iam_permissions_rest_bad_request( request_type=compute.TestIamPermissionsInstanceTemplateRequest, ): client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2854,7 +3049,8 @@ def test_test_iam_permissions_rest_bad_request( def test_test_iam_permissions_rest_flattened(): client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2898,7 +3094,8 @@ def test_test_iam_permissions_rest_flattened(): def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2927,7 +3124,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2947,7 +3145,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = InstanceTemplatesClient(client_options=options, transport=transport,) + client = InstanceTemplatesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2963,7 +3164,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = InstanceTemplatesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2977,7 +3179,10 @@ def test_transport_instance(): @pytest.mark.parametrize( - "transport_class", [transports.InstanceTemplatesRestTransport,] + "transport_class", + [ + transports.InstanceTemplatesRestTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -3035,7 +3240,8 @@ def test_instance_templates_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.InstanceTemplatesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -3085,7 +3291,12 @@ def test_instance_templates_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_instance_templates_host_no_port(transport_name): client = InstanceTemplatesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3101,7 +3312,12 @@ def test_instance_templates_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_instance_templates_host_with_port(transport_name): client = InstanceTemplatesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3139,7 +3355,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = InstanceTemplatesClient.common_folder_path(folder) assert expected == actual @@ -3157,7 +3375,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = InstanceTemplatesClient.common_organization_path(organization) assert expected == actual @@ -3175,7 +3395,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = InstanceTemplatesClient.common_project_path(project) assert expected == actual @@ -3195,7 +3417,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = InstanceTemplatesClient.common_location_path(project, location) assert expected == actual @@ -3220,7 +3443,8 @@ def test_client_with_default_client_info(): transports.InstanceTemplatesTransport, "_prep_wrapped_messages" ) as prep: client = InstanceTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3229,7 +3453,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = InstanceTemplatesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3269,7 +3494,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(InstanceTemplatesClient, transports.InstanceTemplatesRestTransport),], + [ + (InstanceTemplatesClient, transports.InstanceTemplatesRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_instances.py b/tests/unit/gapic/compute_v1/test_instances.py index 6241bfbda..65ac6645d 100644 --- a/tests/unit/gapic/compute_v1/test_instances.py +++ b/tests/unit/gapic/compute_v1/test_instances.py @@ -83,7 +83,12 @@ def test__get_default_mtls_endpoint(): assert InstancesClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class,transport_name", [(InstancesClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (InstancesClient, "rest"), + ], +) def test_instances_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -103,7 +108,10 @@ def test_instances_client_from_service_account_info(client_class, transport_name @pytest.mark.parametrize( - "transport_class,transport_name", [(transports.InstancesRestTransport, "rest"),] + "transport_class,transport_name", + [ + (transports.InstancesRestTransport, "rest"), + ], ) def test_instances_client_service_account_always_use_jwt( transport_class, transport_name @@ -123,7 +131,12 @@ def test_instances_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class,transport_name", [(InstancesClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (InstancesClient, "rest"), + ], +) def test_instances_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -162,7 +175,9 @@ def test_instances_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(InstancesClient, transports.InstancesRestTransport, "rest"),], + [ + (InstancesClient, transports.InstancesRestTransport, "rest"), + ], ) @mock.patch.object( InstancesClient, "DEFAULT_ENDPOINT", modify_default_endpoint(InstancesClient) @@ -437,13 +452,17 @@ def test_instances_client_get_mtls_endpoint_and_cert_source(client_class): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(InstancesClient, transports.InstancesRestTransport, "rest"),], + [ + (InstancesClient, transports.InstancesRestTransport, "rest"), + ], ) def test_instances_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -461,7 +480,9 @@ def test_instances_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(InstancesClient, transports.InstancesRestTransport, "rest", None),], + [ + (InstancesClient, transports.InstancesRestTransport, "rest", None), + ], ) def test_instances_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -485,11 +506,16 @@ def test_instances_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.AddAccessConfigInstanceRequest, dict,] + "request_type", + [ + compute.AddAccessConfigInstanceRequest, + dict, + ], ) def test_add_access_config_unary_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -607,7 +633,12 @@ def test_add_access_config_unary_rest_required_fields( credentials=ga_credentials.AnonymousCredentials() ).add_access_config._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("network_interface", "request_id",)) + assert not set(unset_fields) - set( + ( + "network_interface", + "request_id", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -621,7 +652,8 @@ def test_add_access_config_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -652,7 +684,10 @@ def test_add_access_config_unary_rest_required_fields( response = client.add_access_config_unary(request) expected_params = [ - ("networkInterface", "",), + ( + "networkInterface", + "", + ), ] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -665,9 +700,20 @@ def test_add_access_config_unary_rest_unset_required_fields(): unset_fields = transport.add_access_config._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("networkInterface", "requestId",)) + set( + ( + "networkInterface", + "requestId", + ) + ) & set( - ("accessConfigResource", "instance", "networkInterface", "project", "zone",) + ( + "accessConfigResource", + "instance", + "networkInterface", + "project", + "zone", + ) ) ) @@ -712,7 +758,11 @@ def test_add_access_config_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.add_access_config_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -723,7 +773,8 @@ def test_add_access_config_unary_rest_bad_request( transport: str = "rest", request_type=compute.AddAccessConfigInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -755,7 +806,8 @@ def test_add_access_config_unary_rest_bad_request( def test_add_access_config_unary_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -805,7 +857,8 @@ def test_add_access_config_unary_rest_flattened(): def test_add_access_config_unary_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -830,11 +883,16 @@ def test_add_access_config_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.AddResourcePoliciesInstanceRequest, dict,] + "request_type", + [ + compute.AddResourcePoliciesInstanceRequest, + dict, + ], ) def test_add_resource_policies_unary_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -951,7 +1009,8 @@ def test_add_resource_policies_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1045,7 +1104,11 @@ def test_add_resource_policies_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.add_resource_policies_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1056,7 +1119,8 @@ def test_add_resource_policies_unary_rest_bad_request( transport: str = "rest", request_type=compute.AddResourcePoliciesInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1080,7 +1144,8 @@ def test_add_resource_policies_unary_rest_bad_request( def test_add_resource_policies_unary_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1129,7 +1194,8 @@ def test_add_resource_policies_unary_rest_flattened(): def test_add_resource_policies_unary_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1153,11 +1219,16 @@ def test_add_resource_policies_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.AggregatedListInstancesRequest, dict,] + "request_type", + [ + compute.AggregatedListInstancesRequest, + dict, + ], ) def test_aggregated_list_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1238,7 +1309,8 @@ def test_aggregated_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1335,7 +1407,11 @@ def test_aggregated_list_rest_interceptors(null_interceptor): post.return_value = compute.InstanceAggregatedList client.aggregated_list( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1346,7 +1422,8 @@ def test_aggregated_list_rest_bad_request( transport: str = "rest", request_type=compute.AggregatedListInstancesRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1367,7 +1444,8 @@ def test_aggregated_list_rest_bad_request( def test_aggregated_list_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1379,7 +1457,9 @@ def test_aggregated_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1405,20 +1485,23 @@ def test_aggregated_list_rest_flattened(): def test_aggregated_list_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.aggregated_list( - compute.AggregatedListInstancesRequest(), project="project_value", + compute.AggregatedListInstancesRequest(), + project="project_value", ) def test_aggregated_list_rest_pager(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1435,9 +1518,15 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): }, next_page_token="abc", ), - compute.InstanceAggregatedList(items={}, next_page_token="def",), compute.InstanceAggregatedList( - items={"g": compute.InstancesScopedList(),}, next_page_token="ghi", + items={}, + next_page_token="def", + ), + compute.InstanceAggregatedList( + items={ + "g": compute.InstancesScopedList(), + }, + next_page_token="ghi", ), compute.InstanceAggregatedList( items={ @@ -1479,10 +1568,17 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.AttachDiskInstanceRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.AttachDiskInstanceRequest, + dict, + ], +) def test_attach_disk_unary_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1629,7 +1725,12 @@ def test_attach_disk_unary_rest_required_fields( credentials=ga_credentials.AnonymousCredentials() ).attach_disk._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("force_attach", "request_id",)) + assert not set(unset_fields) - set( + ( + "force_attach", + "request_id", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -1641,7 +1742,8 @@ def test_attach_disk_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1683,8 +1785,20 @@ def test_attach_disk_unary_rest_unset_required_fields(): unset_fields = transport.attach_disk._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("forceAttach", "requestId",)) - & set(("attachedDiskResource", "instance", "project", "zone",)) + set( + ( + "forceAttach", + "requestId", + ) + ) + & set( + ( + "attachedDiskResource", + "instance", + "project", + "zone", + ) + ) ) @@ -1728,7 +1842,11 @@ def test_attach_disk_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.attach_disk_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1739,7 +1857,8 @@ def test_attach_disk_unary_rest_bad_request( transport: str = "rest", request_type=compute.AttachDiskInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1805,7 +1924,8 @@ def test_attach_disk_unary_rest_bad_request( def test_attach_disk_unary_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1852,7 +1972,8 @@ def test_attach_disk_unary_rest_flattened(): def test_attach_disk_unary_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1873,10 +1994,17 @@ def test_attach_disk_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.BulkInsertInstanceRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.BulkInsertInstanceRequest, + dict, + ], +) def test_bulk_insert_unary_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2144,7 +2272,8 @@ def test_bulk_insert_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2187,7 +2316,13 @@ def test_bulk_insert_unary_rest_unset_required_fields(): unset_fields = transport.bulk_insert._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("bulkInsertInstanceResourceResource", "project", "zone",)) + & set( + ( + "bulkInsertInstanceResourceResource", + "project", + "zone", + ) + ) ) @@ -2231,7 +2366,11 @@ def test_bulk_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.bulk_insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2242,7 +2381,8 @@ def test_bulk_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.BulkInsertInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2421,7 +2561,8 @@ def test_bulk_insert_unary_rest_bad_request( def test_bulk_insert_unary_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2465,7 +2606,8 @@ def test_bulk_insert_unary_rest_flattened(): def test_bulk_insert_unary_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2487,10 +2629,17 @@ def test_bulk_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.DeleteInstanceRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteInstanceRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2602,7 +2751,8 @@ def test_delete_unary_rest_required_fields(request_type=compute.DeleteInstanceRe assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2643,7 +2793,14 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("instance", "project", "zone",)) + set(("requestId",)) + & set( + ( + "instance", + "project", + "zone", + ) + ) ) @@ -2687,7 +2844,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2698,7 +2859,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2719,7 +2881,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2736,7 +2899,9 @@ def test_delete_unary_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", zone="zone_value", instance="instance_value", + project="project_value", + zone="zone_value", + instance="instance_value", ) mock_args.update(sample_request) @@ -2763,7 +2928,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2784,11 +2950,16 @@ def test_delete_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.DeleteAccessConfigInstanceRequest, dict,] + "request_type", + [ + compute.DeleteAccessConfigInstanceRequest, + dict, + ], ) def test_delete_access_config_unary_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2901,7 +3072,11 @@ def test_delete_access_config_unary_rest_required_fields( ).delete_access_config._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("access_config", "network_interface", "request_id",) + ( + "access_config", + "network_interface", + "request_id", + ) ) jsonified_request.update(unset_fields) @@ -2918,7 +3093,8 @@ def test_delete_access_config_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2948,8 +3124,14 @@ def test_delete_access_config_unary_rest_required_fields( response = client.delete_access_config_unary(request) expected_params = [ - ("accessConfig", "",), - ("networkInterface", "",), + ( + "accessConfig", + "", + ), + ( + "networkInterface", + "", + ), ] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -2962,8 +3144,22 @@ def test_delete_access_config_unary_rest_unset_required_fields(): unset_fields = transport.delete_access_config._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("accessConfig", "networkInterface", "requestId",)) - & set(("accessConfig", "instance", "networkInterface", "project", "zone",)) + set( + ( + "accessConfig", + "networkInterface", + "requestId", + ) + ) + & set( + ( + "accessConfig", + "instance", + "networkInterface", + "project", + "zone", + ) + ) ) @@ -3007,7 +3203,11 @@ def test_delete_access_config_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_access_config_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3018,7 +3218,8 @@ def test_delete_access_config_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteAccessConfigInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3039,7 +3240,8 @@ def test_delete_access_config_unary_rest_bad_request( def test_delete_access_config_unary_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3087,7 +3289,8 @@ def test_delete_access_config_unary_rest_flattened(): def test_delete_access_config_unary_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3109,10 +3312,17 @@ def test_delete_access_config_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.DetachDiskInstanceRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DetachDiskInstanceRequest, + dict, + ], +) def test_detach_disk_unary_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3219,7 +3429,12 @@ def test_detach_disk_unary_rest_required_fields( credentials=ga_credentials.AnonymousCredentials() ).detach_disk._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("device_name", "request_id",)) + assert not set(unset_fields) - set( + ( + "device_name", + "request_id", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -3233,7 +3448,8 @@ def test_detach_disk_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3263,7 +3479,10 @@ def test_detach_disk_unary_rest_required_fields( response = client.detach_disk_unary(request) expected_params = [ - ("deviceName", "",), + ( + "deviceName", + "", + ), ] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -3276,8 +3495,20 @@ def test_detach_disk_unary_rest_unset_required_fields(): unset_fields = transport.detach_disk._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("deviceName", "requestId",)) - & set(("deviceName", "instance", "project", "zone",)) + set( + ( + "deviceName", + "requestId", + ) + ) + & set( + ( + "deviceName", + "instance", + "project", + "zone", + ) + ) ) @@ -3321,7 +3552,11 @@ def test_detach_disk_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.detach_disk_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3332,7 +3567,8 @@ def test_detach_disk_unary_rest_bad_request( transport: str = "rest", request_type=compute.DetachDiskInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3353,7 +3589,8 @@ def test_detach_disk_unary_rest_bad_request( def test_detach_disk_unary_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3400,7 +3637,8 @@ def test_detach_disk_unary_rest_flattened(): def test_detach_disk_unary_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3421,10 +3659,17 @@ def test_detach_disk_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetInstanceRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetInstanceRequest, + dict, + ], +) def test_get_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3540,7 +3785,8 @@ def test_get_rest_required_fields(request_type=compute.GetInstanceRequest): assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3580,7 +3826,16 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("instance", "project", "zone",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "instance", + "project", + "zone", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -3622,7 +3877,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Instance - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -3632,7 +3893,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3653,7 +3915,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3670,7 +3933,9 @@ def test_get_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", zone="zone_value", instance="instance_value", + project="project_value", + zone="zone_value", + instance="instance_value", ) mock_args.update(sample_request) @@ -3697,7 +3962,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3718,11 +3984,16 @@ def test_get_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.GetEffectiveFirewallsInstanceRequest, dict,] + "request_type", + [ + compute.GetEffectiveFirewallsInstanceRequest, + dict, + ], ) def test_get_effective_firewalls_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3800,7 +4071,8 @@ def test_get_effective_firewalls_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3832,7 +4104,10 @@ def test_get_effective_firewalls_rest_required_fields( response = client.get_effective_firewalls(request) expected_params = [ - ("networkInterface", "",), + ( + "networkInterface", + "", + ), ] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -3846,7 +4121,14 @@ def test_get_effective_firewalls_rest_unset_required_fields(): unset_fields = transport.get_effective_firewalls._get_unset_required_fields({}) assert set(unset_fields) == ( set(("networkInterface",)) - & set(("instance", "networkInterface", "project", "zone",)) + & set( + ( + "instance", + "networkInterface", + "project", + "zone", + ) + ) ) @@ -3879,8 +4161,10 @@ def test_get_effective_firewalls_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = compute.InstancesGetEffectiveFirewallsResponse.to_json( - compute.InstancesGetEffectiveFirewallsResponse() + req.return_value._content = ( + compute.InstancesGetEffectiveFirewallsResponse.to_json( + compute.InstancesGetEffectiveFirewallsResponse() + ) ) request = compute.GetEffectiveFirewallsInstanceRequest() @@ -3892,7 +4176,11 @@ def test_get_effective_firewalls_rest_interceptors(null_interceptor): post.return_value = compute.InstancesGetEffectiveFirewallsResponse client.get_effective_firewalls( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3903,7 +4191,8 @@ def test_get_effective_firewalls_rest_bad_request( transport: str = "rest", request_type=compute.GetEffectiveFirewallsInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3924,7 +4213,8 @@ def test_get_effective_firewalls_rest_bad_request( def test_get_effective_firewalls_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3973,7 +4263,8 @@ def test_get_effective_firewalls_rest_flattened(): def test_get_effective_firewalls_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3995,11 +4286,16 @@ def test_get_effective_firewalls_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.GetGuestAttributesInstanceRequest, dict,] + "request_type", + [ + compute.GetGuestAttributesInstanceRequest, + dict, + ], ) def test_get_guest_attributes_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -4067,7 +4363,12 @@ def test_get_guest_attributes_rest_required_fields( credentials=ga_credentials.AnonymousCredentials() ).get_guest_attributes._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("query_path", "variable_key",)) + assert not set(unset_fields) - set( + ( + "query_path", + "variable_key", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -4079,7 +4380,8 @@ def test_get_guest_attributes_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -4120,7 +4422,19 @@ def test_get_guest_attributes_rest_unset_required_fields(): unset_fields = transport.get_guest_attributes._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("queryPath", "variableKey",)) & set(("instance", "project", "zone",)) + set( + ( + "queryPath", + "variableKey", + ) + ) + & set( + ( + "instance", + "project", + "zone", + ) + ) ) @@ -4166,7 +4480,11 @@ def test_get_guest_attributes_rest_interceptors(null_interceptor): post.return_value = compute.GuestAttributes client.get_guest_attributes( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -4177,7 +4495,8 @@ def test_get_guest_attributes_rest_bad_request( transport: str = "rest", request_type=compute.GetGuestAttributesInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -4198,7 +4517,8 @@ def test_get_guest_attributes_rest_bad_request( def test_get_guest_attributes_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -4215,7 +4535,9 @@ def test_get_guest_attributes_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", zone="zone_value", instance="instance_value", + project="project_value", + zone="zone_value", + instance="instance_value", ) mock_args.update(sample_request) @@ -4242,7 +4564,8 @@ def test_get_guest_attributes_rest_flattened(): def test_get_guest_attributes_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -4262,10 +4585,17 @@ def test_get_guest_attributes_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetIamPolicyInstanceRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetIamPolicyInstanceRequest, + dict, + ], +) def test_get_iam_policy_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -4275,7 +4605,11 @@ def test_get_iam_policy_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = compute.Policy(etag="etag_value", iam_owned=True, version=774,) + return_value = compute.Policy( + etag="etag_value", + iam_owned=True, + version=774, + ) # Wrap the value into a proper Response obj response_value = Response() @@ -4337,7 +4671,8 @@ def test_get_iam_policy_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -4378,7 +4713,14 @@ def test_get_iam_policy_rest_unset_required_fields(): unset_fields = transport.get_iam_policy._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("optionsRequestedPolicyVersion",)) & set(("project", "resource", "zone",)) + set(("optionsRequestedPolicyVersion",)) + & set( + ( + "project", + "resource", + "zone", + ) + ) ) @@ -4422,7 +4764,11 @@ def test_get_iam_policy_rest_interceptors(null_interceptor): post.return_value = compute.Policy client.get_iam_policy( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -4433,7 +4779,8 @@ def test_get_iam_policy_rest_bad_request( transport: str = "rest", request_type=compute.GetIamPolicyInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -4454,7 +4801,8 @@ def test_get_iam_policy_rest_bad_request( def test_get_iam_policy_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -4471,7 +4819,9 @@ def test_get_iam_policy_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", zone="zone_value", resource="resource_value", + project="project_value", + zone="zone_value", + resource="resource_value", ) mock_args.update(sample_request) @@ -4498,7 +4848,8 @@ def test_get_iam_policy_rest_flattened(): def test_get_iam_policy_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -4518,10 +4869,17 @@ def test_get_iam_policy_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetScreenshotInstanceRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetScreenshotInstanceRequest, + dict, + ], +) def test_get_screenshot_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -4531,7 +4889,10 @@ def test_get_screenshot_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = compute.Screenshot(contents="contents_value", kind="kind_value",) + return_value = compute.Screenshot( + contents="contents_value", + kind="kind_value", + ) # Wrap the value into a proper Response obj response_value = Response() @@ -4590,7 +4951,8 @@ def test_get_screenshot_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -4630,7 +4992,16 @@ def test_get_screenshot_rest_unset_required_fields(): ) unset_fields = transport.get_screenshot._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("instance", "project", "zone",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "instance", + "project", + "zone", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -4673,7 +5044,11 @@ def test_get_screenshot_rest_interceptors(null_interceptor): post.return_value = compute.Screenshot client.get_screenshot( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -4684,7 +5059,8 @@ def test_get_screenshot_rest_bad_request( transport: str = "rest", request_type=compute.GetScreenshotInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -4705,7 +5081,8 @@ def test_get_screenshot_rest_bad_request( def test_get_screenshot_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -4722,7 +5099,9 @@ def test_get_screenshot_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", zone="zone_value", instance="instance_value", + project="project_value", + zone="zone_value", + instance="instance_value", ) mock_args.update(sample_request) @@ -4749,7 +5128,8 @@ def test_get_screenshot_rest_flattened(): def test_get_screenshot_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -4770,11 +5150,16 @@ def test_get_screenshot_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.GetSerialPortOutputInstanceRequest, dict,] + "request_type", + [ + compute.GetSerialPortOutputInstanceRequest, + dict, + ], ) def test_get_serial_port_output_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -4842,7 +5227,12 @@ def test_get_serial_port_output_rest_required_fields( credentials=ga_credentials.AnonymousCredentials() ).get_serial_port_output._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("port", "start",)) + assert not set(unset_fields) - set( + ( + "port", + "start", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -4854,7 +5244,8 @@ def test_get_serial_port_output_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -4895,7 +5286,19 @@ def test_get_serial_port_output_rest_unset_required_fields(): unset_fields = transport.get_serial_port_output._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("port", "start",)) & set(("instance", "project", "zone",)) + set( + ( + "port", + "start", + ) + ) + & set( + ( + "instance", + "project", + "zone", + ) + ) ) @@ -4941,7 +5344,11 @@ def test_get_serial_port_output_rest_interceptors(null_interceptor): post.return_value = compute.SerialPortOutput client.get_serial_port_output( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -4952,7 +5359,8 @@ def test_get_serial_port_output_rest_bad_request( transport: str = "rest", request_type=compute.GetSerialPortOutputInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -4973,7 +5381,8 @@ def test_get_serial_port_output_rest_bad_request( def test_get_serial_port_output_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -4990,7 +5399,9 @@ def test_get_serial_port_output_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", zone="zone_value", instance="instance_value", + project="project_value", + zone="zone_value", + instance="instance_value", ) mock_args.update(sample_request) @@ -5017,7 +5428,8 @@ def test_get_serial_port_output_rest_flattened(): def test_get_serial_port_output_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -5038,11 +5450,16 @@ def test_get_serial_port_output_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.GetShieldedInstanceIdentityInstanceRequest, dict,] + "request_type", + [ + compute.GetShieldedInstanceIdentityInstanceRequest, + dict, + ], ) def test_get_shielded_instance_identity_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -5052,7 +5469,9 @@ def test_get_shielded_instance_identity_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = compute.ShieldedInstanceIdentity(kind="kind_value",) + return_value = compute.ShieldedInstanceIdentity( + kind="kind_value", + ) # Wrap the value into a proper Response obj response_value = Response() @@ -5110,7 +5529,8 @@ def test_get_shielded_instance_identity_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -5152,7 +5572,16 @@ def test_get_shielded_instance_identity_rest_unset_required_fields(): unset_fields = transport.get_shielded_instance_identity._get_unset_required_fields( {} ) - assert set(unset_fields) == (set(()) & set(("instance", "project", "zone",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "instance", + "project", + "zone", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -5197,7 +5626,11 @@ def test_get_shielded_instance_identity_rest_interceptors(null_interceptor): post.return_value = compute.ShieldedInstanceIdentity client.get_shielded_instance_identity( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -5209,7 +5642,8 @@ def test_get_shielded_instance_identity_rest_bad_request( request_type=compute.GetShieldedInstanceIdentityInstanceRequest, ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -5230,7 +5664,8 @@ def test_get_shielded_instance_identity_rest_bad_request( def test_get_shielded_instance_identity_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -5247,7 +5682,9 @@ def test_get_shielded_instance_identity_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", zone="zone_value", instance="instance_value", + project="project_value", + zone="zone_value", + instance="instance_value", ) mock_args.update(sample_request) @@ -5274,7 +5711,8 @@ def test_get_shielded_instance_identity_rest_flattened(): def test_get_shielded_instance_identity_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -5294,10 +5732,17 @@ def test_get_shielded_instance_identity_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertInstanceRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertInstanceRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -5561,7 +6006,11 @@ def test_insert_unary_rest_required_fields(request_type=compute.InsertInstanceRe ).insert._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("request_id", "source_instance_template", "source_machine_image",) + ( + "request_id", + "source_instance_template", + "source_machine_image", + ) ) jsonified_request.update(unset_fields) @@ -5572,7 +6021,8 @@ def test_insert_unary_rest_required_fields(request_type=compute.InsertInstanceRe assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -5614,8 +6064,20 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId", "sourceInstanceTemplate", "sourceMachineImage",)) - & set(("instanceResource", "project", "zone",)) + set( + ( + "requestId", + "sourceInstanceTemplate", + "sourceMachineImage", + ) + ) + & set( + ( + "instanceResource", + "project", + "zone", + ) + ) ) @@ -5659,7 +6121,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -5670,7 +6136,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -5856,7 +6323,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -5902,7 +6370,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -5926,10 +6395,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListInstancesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListInstancesRequest, + dict, + ], +) def test_list_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -5992,7 +6468,13 @@ def test_list_rest_required_fields(request_type=compute.ListInstancesRequest): ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -6003,7 +6485,8 @@ def test_list_rest_required_fields(request_type=compute.ListInstancesRequest): assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -6044,8 +6527,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "zone",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "zone", + ) + ) ) @@ -6088,7 +6584,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.InstanceList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -6098,7 +6600,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListInstancesRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -6119,7 +6622,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -6131,7 +6635,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "zone": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", zone="zone_value",) + mock_args = dict( + project="project_value", + zone="zone_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -6157,20 +6664,24 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list( - compute.ListInstancesRequest(), project="project_value", zone="zone_value", + compute.ListInstancesRequest(), + project="project_value", + zone="zone_value", ) def test_list_rest_pager(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -6180,12 +6691,29 @@ def test_list_rest_pager(transport: str = "rest"): # Set the response as a series of pages response = ( compute.InstanceList( - items=[compute.Instance(), compute.Instance(), compute.Instance(),], + items=[ + compute.Instance(), + compute.Instance(), + compute.Instance(), + ], next_page_token="abc", ), - compute.InstanceList(items=[], next_page_token="def",), - compute.InstanceList(items=[compute.Instance(),], next_page_token="ghi",), - compute.InstanceList(items=[compute.Instance(), compute.Instance(),],), + compute.InstanceList( + items=[], + next_page_token="def", + ), + compute.InstanceList( + items=[ + compute.Instance(), + ], + next_page_token="ghi", + ), + compute.InstanceList( + items=[ + compute.Instance(), + compute.Instance(), + ], + ), ) # Two responses for two calls response = response + response @@ -6211,10 +6739,17 @@ def test_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.ListReferrersInstancesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListReferrersInstancesRequest, + dict, + ], +) def test_list_referrers_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -6281,7 +6816,13 @@ def test_list_referrers_rest_required_fields( ).list_referrers._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -6294,7 +6835,8 @@ def test_list_referrers_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -6335,8 +6877,22 @@ def test_list_referrers_rest_unset_required_fields(): unset_fields = transport.list_referrers._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("instance", "project", "zone",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "instance", + "project", + "zone", + ) + ) ) @@ -6382,7 +6938,11 @@ def test_list_referrers_rest_interceptors(null_interceptor): post.return_value = compute.InstanceListReferrers client.list_referrers( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -6393,7 +6953,8 @@ def test_list_referrers_rest_bad_request( transport: str = "rest", request_type=compute.ListReferrersInstancesRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -6414,7 +6975,8 @@ def test_list_referrers_rest_bad_request( def test_list_referrers_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -6431,7 +6993,9 @@ def test_list_referrers_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", zone="zone_value", instance="instance_value", + project="project_value", + zone="zone_value", + instance="instance_value", ) mock_args.update(sample_request) @@ -6458,7 +7022,8 @@ def test_list_referrers_rest_flattened(): def test_list_referrers_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -6474,7 +7039,8 @@ def test_list_referrers_rest_flattened_error(transport: str = "rest"): def test_list_referrers_rest_pager(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -6484,15 +7050,28 @@ def test_list_referrers_rest_pager(transport: str = "rest"): # Set the response as a series of pages response = ( compute.InstanceListReferrers( - items=[compute.Reference(), compute.Reference(), compute.Reference(),], + items=[ + compute.Reference(), + compute.Reference(), + compute.Reference(), + ], next_page_token="abc", ), - compute.InstanceListReferrers(items=[], next_page_token="def",), compute.InstanceListReferrers( - items=[compute.Reference(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.InstanceListReferrers( - items=[compute.Reference(), compute.Reference(),], + items=[ + compute.Reference(), + ], + next_page_token="ghi", + ), + compute.InstanceListReferrers( + items=[ + compute.Reference(), + compute.Reference(), + ], ), ) # Two responses for two calls @@ -6524,11 +7103,16 @@ def test_list_referrers_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.RemoveResourcePoliciesInstanceRequest, dict,] + "request_type", + [ + compute.RemoveResourcePoliciesInstanceRequest, + dict, + ], ) def test_remove_resource_policies_unary_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -6645,7 +7229,8 @@ def test_remove_resource_policies_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -6739,7 +7324,11 @@ def test_remove_resource_policies_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.remove_resource_policies_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -6750,7 +7339,8 @@ def test_remove_resource_policies_unary_rest_bad_request( transport: str = "rest", request_type=compute.RemoveResourcePoliciesInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -6774,7 +7364,8 @@ def test_remove_resource_policies_unary_rest_bad_request( def test_remove_resource_policies_unary_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -6823,7 +7414,8 @@ def test_remove_resource_policies_unary_rest_flattened(): def test_remove_resource_policies_unary_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -6846,10 +7438,17 @@ def test_remove_resource_policies_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ResetInstanceRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ResetInstanceRequest, + dict, + ], +) def test_reset_unary_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -6961,7 +7560,8 @@ def test_reset_unary_rest_required_fields(request_type=compute.ResetInstanceRequ assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -7002,7 +7602,14 @@ def test_reset_unary_rest_unset_required_fields(): unset_fields = transport.reset._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("instance", "project", "zone",)) + set(("requestId",)) + & set( + ( + "instance", + "project", + "zone", + ) + ) ) @@ -7045,7 +7652,13 @@ def test_reset_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.reset_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.reset_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -7055,7 +7668,8 @@ def test_reset_unary_rest_bad_request( transport: str = "rest", request_type=compute.ResetInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -7076,7 +7690,8 @@ def test_reset_unary_rest_bad_request( def test_reset_unary_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -7093,7 +7708,9 @@ def test_reset_unary_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", zone="zone_value", instance="instance_value", + project="project_value", + zone="zone_value", + instance="instance_value", ) mock_args.update(sample_request) @@ -7120,7 +7737,8 @@ def test_reset_unary_rest_flattened(): def test_reset_unary_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -7140,10 +7758,17 @@ def test_reset_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ResumeInstanceRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ResumeInstanceRequest, + dict, + ], +) def test_resume_unary_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -7255,7 +7880,8 @@ def test_resume_unary_rest_required_fields(request_type=compute.ResumeInstanceRe assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -7296,7 +7922,14 @@ def test_resume_unary_rest_unset_required_fields(): unset_fields = transport.resume._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("instance", "project", "zone",)) + set(("requestId",)) + & set( + ( + "instance", + "project", + "zone", + ) + ) ) @@ -7340,7 +7973,11 @@ def test_resume_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.resume_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -7351,7 +7988,8 @@ def test_resume_unary_rest_bad_request( transport: str = "rest", request_type=compute.ResumeInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -7372,7 +8010,8 @@ def test_resume_unary_rest_bad_request( def test_resume_unary_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -7389,7 +8028,9 @@ def test_resume_unary_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", zone="zone_value", instance="instance_value", + project="project_value", + zone="zone_value", + instance="instance_value", ) mock_args.update(sample_request) @@ -7416,7 +8057,8 @@ def test_resume_unary_rest_flattened(): def test_resume_unary_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -7437,11 +8079,16 @@ def test_resume_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SendDiagnosticInterruptInstanceRequest, dict,] + "request_type", + [ + compute.SendDiagnosticInterruptInstanceRequest, + dict, + ], ) def test_send_diagnostic_interrupt_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -7510,7 +8157,8 @@ def test_send_diagnostic_interrupt_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -7552,7 +8200,16 @@ def test_send_diagnostic_interrupt_rest_unset_required_fields(): ) unset_fields = transport.send_diagnostic_interrupt._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("instance", "project", "zone",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "instance", + "project", + "zone", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -7584,8 +8241,10 @@ def test_send_diagnostic_interrupt_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = compute.SendDiagnosticInterruptInstanceResponse.to_json( - compute.SendDiagnosticInterruptInstanceResponse() + req.return_value._content = ( + compute.SendDiagnosticInterruptInstanceResponse.to_json( + compute.SendDiagnosticInterruptInstanceResponse() + ) ) request = compute.SendDiagnosticInterruptInstanceRequest() @@ -7597,7 +8256,11 @@ def test_send_diagnostic_interrupt_rest_interceptors(null_interceptor): post.return_value = compute.SendDiagnosticInterruptInstanceResponse client.send_diagnostic_interrupt( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -7608,7 +8271,8 @@ def test_send_diagnostic_interrupt_rest_bad_request( transport: str = "rest", request_type=compute.SendDiagnosticInterruptInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -7629,7 +8293,8 @@ def test_send_diagnostic_interrupt_rest_bad_request( def test_send_diagnostic_interrupt_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -7646,7 +8311,9 @@ def test_send_diagnostic_interrupt_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", zone="zone_value", instance="instance_value", + project="project_value", + zone="zone_value", + instance="instance_value", ) mock_args.update(sample_request) @@ -7675,7 +8342,8 @@ def test_send_diagnostic_interrupt_rest_flattened(): def test_send_diagnostic_interrupt_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -7696,11 +8364,16 @@ def test_send_diagnostic_interrupt_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SetDeletionProtectionInstanceRequest, dict,] + "request_type", + [ + compute.SetDeletionProtectionInstanceRequest, + dict, + ], ) def test_set_deletion_protection_unary_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -7802,7 +8475,12 @@ def test_set_deletion_protection_unary_rest_required_fields( credentials=ga_credentials.AnonymousCredentials() ).set_deletion_protection._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("deletion_protection", "request_id",)) + assert not set(unset_fields) - set( + ( + "deletion_protection", + "request_id", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -7814,7 +8492,8 @@ def test_set_deletion_protection_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -7855,8 +8534,19 @@ def test_set_deletion_protection_unary_rest_unset_required_fields(): unset_fields = transport.set_deletion_protection._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("deletionProtection", "requestId",)) - & set(("project", "resource", "zone",)) + set( + ( + "deletionProtection", + "requestId", + ) + ) + & set( + ( + "project", + "resource", + "zone", + ) + ) ) @@ -7900,7 +8590,11 @@ def test_set_deletion_protection_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_deletion_protection_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -7911,7 +8605,8 @@ def test_set_deletion_protection_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetDeletionProtectionInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -7932,7 +8627,8 @@ def test_set_deletion_protection_unary_rest_bad_request( def test_set_deletion_protection_unary_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -7949,7 +8645,9 @@ def test_set_deletion_protection_unary_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", zone="zone_value", resource="resource_value", + project="project_value", + zone="zone_value", + resource="resource_value", ) mock_args.update(sample_request) @@ -7976,7 +8674,8 @@ def test_set_deletion_protection_unary_rest_flattened(): def test_set_deletion_protection_unary_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -7997,11 +8696,16 @@ def test_set_deletion_protection_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SetDiskAutoDeleteInstanceRequest, dict,] + "request_type", + [ + compute.SetDiskAutoDeleteInstanceRequest, + dict, + ], ) def test_set_disk_auto_delete_unary_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -8113,7 +8817,13 @@ def test_set_disk_auto_delete_unary_rest_required_fields( credentials=ga_credentials.AnonymousCredentials() ).set_disk_auto_delete._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("auto_delete", "device_name", "request_id",)) + assert not set(unset_fields) - set( + ( + "auto_delete", + "device_name", + "request_id", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -8129,7 +8839,8 @@ def test_set_disk_auto_delete_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -8159,8 +8870,14 @@ def test_set_disk_auto_delete_unary_rest_required_fields( response = client.set_disk_auto_delete_unary(request) expected_params = [ - ("autoDelete", False,), - ("deviceName", "",), + ( + "autoDelete", + False, + ), + ( + "deviceName", + "", + ), ] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -8173,8 +8890,22 @@ def test_set_disk_auto_delete_unary_rest_unset_required_fields(): unset_fields = transport.set_disk_auto_delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("autoDelete", "deviceName", "requestId",)) - & set(("autoDelete", "deviceName", "instance", "project", "zone",)) + set( + ( + "autoDelete", + "deviceName", + "requestId", + ) + ) + & set( + ( + "autoDelete", + "deviceName", + "instance", + "project", + "zone", + ) + ) ) @@ -8218,7 +8949,11 @@ def test_set_disk_auto_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_disk_auto_delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -8229,7 +8964,8 @@ def test_set_disk_auto_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetDiskAutoDeleteInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -8250,7 +8986,8 @@ def test_set_disk_auto_delete_unary_rest_bad_request( def test_set_disk_auto_delete_unary_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -8298,7 +9035,8 @@ def test_set_disk_auto_delete_unary_rest_flattened(): def test_set_disk_auto_delete_unary_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -8320,10 +9058,17 @@ def test_set_disk_auto_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.SetIamPolicyInstanceRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.SetIamPolicyInstanceRequest, + dict, + ], +) def test_set_iam_policy_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -8410,7 +9155,11 @@ def test_set_iam_policy_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = compute.Policy(etag="etag_value", iam_owned=True, version=774,) + return_value = compute.Policy( + etag="etag_value", + iam_owned=True, + version=774, + ) # Wrap the value into a proper Response obj response_value = Response() @@ -8470,7 +9219,8 @@ def test_set_iam_policy_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -8512,7 +9262,15 @@ def test_set_iam_policy_rest_unset_required_fields(): unset_fields = transport.set_iam_policy._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("project", "resource", "zone", "zoneSetPolicyRequestResource",)) + set(()) + & set( + ( + "project", + "resource", + "zone", + "zoneSetPolicyRequestResource", + ) + ) ) @@ -8556,7 +9314,11 @@ def test_set_iam_policy_rest_interceptors(null_interceptor): post.return_value = compute.Policy client.set_iam_policy( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -8567,7 +9329,8 @@ def test_set_iam_policy_rest_bad_request( transport: str = "rest", request_type=compute.SetIamPolicyInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -8665,7 +9428,8 @@ def test_set_iam_policy_rest_bad_request( def test_set_iam_policy_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -8714,7 +9478,8 @@ def test_set_iam_policy_rest_flattened(): def test_set_iam_policy_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -8737,10 +9502,17 @@ def test_set_iam_policy_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.SetLabelsInstanceRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.SetLabelsInstanceRequest, + dict, + ], +) def test_set_labels_unary_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -8858,7 +9630,8 @@ def test_set_labels_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -8901,7 +9674,14 @@ def test_set_labels_unary_rest_unset_required_fields(): unset_fields = transport.set_labels._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("instance", "instancesSetLabelsRequestResource", "project", "zone",)) + & set( + ( + "instance", + "instancesSetLabelsRequestResource", + "project", + "zone", + ) + ) ) @@ -8945,7 +9725,11 @@ def test_set_labels_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_labels_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -8956,7 +9740,8 @@ def test_set_labels_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetLabelsInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -8981,7 +9766,8 @@ def test_set_labels_unary_rest_bad_request( def test_set_labels_unary_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -9030,7 +9816,8 @@ def test_set_labels_unary_rest_flattened(): def test_set_labels_unary_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -9054,11 +9841,16 @@ def test_set_labels_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SetMachineResourcesInstanceRequest, dict,] + "request_type", + [ + compute.SetMachineResourcesInstanceRequest, + dict, + ], ) def test_set_machine_resources_unary_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -9177,7 +9969,8 @@ def test_set_machine_resources_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -9271,7 +10064,11 @@ def test_set_machine_resources_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_machine_resources_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -9282,7 +10079,8 @@ def test_set_machine_resources_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetMachineResourcesInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -9308,7 +10106,8 @@ def test_set_machine_resources_unary_rest_bad_request( def test_set_machine_resources_unary_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -9357,7 +10156,8 @@ def test_set_machine_resources_unary_rest_flattened(): def test_set_machine_resources_unary_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -9380,10 +10180,17 @@ def test_set_machine_resources_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.SetMachineTypeInstanceRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.SetMachineTypeInstanceRequest, + dict, + ], +) def test_set_machine_type_unary_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -9500,7 +10307,8 @@ def test_set_machine_type_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -9544,7 +10352,12 @@ def test_set_machine_type_unary_rest_unset_required_fields(): assert set(unset_fields) == ( set(("requestId",)) & set( - ("instance", "instancesSetMachineTypeRequestResource", "project", "zone",) + ( + "instance", + "instancesSetMachineTypeRequestResource", + "project", + "zone", + ) ) ) @@ -9589,7 +10402,11 @@ def test_set_machine_type_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_machine_type_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -9600,7 +10417,8 @@ def test_set_machine_type_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetMachineTypeInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -9624,7 +10442,8 @@ def test_set_machine_type_unary_rest_bad_request( def test_set_machine_type_unary_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -9673,7 +10492,8 @@ def test_set_machine_type_unary_rest_flattened(): def test_set_machine_type_unary_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -9696,10 +10516,17 @@ def test_set_machine_type_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.SetMetadataInstanceRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.SetMetadataInstanceRequest, + dict, + ], +) def test_set_metadata_unary_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -9818,7 +10645,8 @@ def test_set_metadata_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -9860,7 +10688,15 @@ def test_set_metadata_unary_rest_unset_required_fields(): unset_fields = transport.set_metadata._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("instance", "metadataResource", "project", "zone",)) + set(("requestId",)) + & set( + ( + "instance", + "metadataResource", + "project", + "zone", + ) + ) ) @@ -9904,7 +10740,11 @@ def test_set_metadata_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_metadata_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -9915,7 +10755,8 @@ def test_set_metadata_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetMetadataInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -9941,7 +10782,8 @@ def test_set_metadata_unary_rest_bad_request( def test_set_metadata_unary_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -9988,7 +10830,8 @@ def test_set_metadata_unary_rest_flattened(): def test_set_metadata_unary_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -10010,11 +10853,16 @@ def test_set_metadata_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SetMinCpuPlatformInstanceRequest, dict,] + "request_type", + [ + compute.SetMinCpuPlatformInstanceRequest, + dict, + ], ) def test_set_min_cpu_platform_unary_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -10131,7 +10979,8 @@ def test_set_min_cpu_platform_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -10225,7 +11074,11 @@ def test_set_min_cpu_platform_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_min_cpu_platform_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -10236,7 +11089,8 @@ def test_set_min_cpu_platform_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetMinCpuPlatformInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -10260,7 +11114,8 @@ def test_set_min_cpu_platform_unary_rest_bad_request( def test_set_min_cpu_platform_unary_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -10309,7 +11164,8 @@ def test_set_min_cpu_platform_unary_rest_flattened(): def test_set_min_cpu_platform_unary_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -10332,10 +11188,17 @@ def test_set_min_cpu_platform_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.SetSchedulingInstanceRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.SetSchedulingInstanceRequest, + dict, + ], +) def test_set_scheduling_unary_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -10465,7 +11328,8 @@ def test_set_scheduling_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -10508,7 +11372,14 @@ def test_set_scheduling_unary_rest_unset_required_fields(): unset_fields = transport.set_scheduling._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("instance", "project", "schedulingResource", "zone",)) + & set( + ( + "instance", + "project", + "schedulingResource", + "zone", + ) + ) ) @@ -10552,7 +11423,11 @@ def test_set_scheduling_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_scheduling_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -10563,7 +11438,8 @@ def test_set_scheduling_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetSchedulingInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -10600,7 +11476,8 @@ def test_set_scheduling_unary_rest_bad_request( def test_set_scheduling_unary_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -10647,7 +11524,8 @@ def test_set_scheduling_unary_rest_flattened(): def test_set_scheduling_unary_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -10669,11 +11547,16 @@ def test_set_scheduling_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SetServiceAccountInstanceRequest, dict,] + "request_type", + [ + compute.SetServiceAccountInstanceRequest, + dict, + ], ) def test_set_service_account_unary_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -10791,7 +11674,8 @@ def test_set_service_account_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -10885,7 +11769,11 @@ def test_set_service_account_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_service_account_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -10896,7 +11784,8 @@ def test_set_service_account_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetServiceAccountInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -10921,7 +11810,8 @@ def test_set_service_account_unary_rest_bad_request( def test_set_service_account_unary_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -10970,7 +11860,8 @@ def test_set_service_account_unary_rest_flattened(): def test_set_service_account_unary_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -10994,11 +11885,16 @@ def test_set_service_account_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SetShieldedInstanceIntegrityPolicyInstanceRequest, dict,] + "request_type", + [ + compute.SetShieldedInstanceIntegrityPolicyInstanceRequest, + dict, + ], ) def test_set_shielded_instance_integrity_policy_unary_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -11119,7 +12015,8 @@ def test_set_shielded_instance_integrity_policy_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -11159,13 +12056,18 @@ def test_set_shielded_instance_integrity_policy_unary_rest_unset_required_fields credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.set_shielded_instance_integrity_policy._get_unset_required_fields( - {} + unset_fields = ( + transport.set_shielded_instance_integrity_policy._get_unset_required_fields({}) ) assert set(unset_fields) == ( set(("requestId",)) & set( - ("instance", "project", "shieldedInstanceIntegrityPolicyResource", "zone",) + ( + "instance", + "project", + "shieldedInstanceIntegrityPolicyResource", + "zone", + ) ) ) @@ -11214,7 +12116,11 @@ def test_set_shielded_instance_integrity_policy_unary_rest_interceptors( post.return_value = compute.Operation client.set_shielded_instance_integrity_policy_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -11226,7 +12132,8 @@ def test_set_shielded_instance_integrity_policy_unary_rest_bad_request( request_type=compute.SetShieldedInstanceIntegrityPolicyInstanceRequest, ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -11250,7 +12157,8 @@ def test_set_shielded_instance_integrity_policy_unary_rest_bad_request( def test_set_shielded_instance_integrity_policy_unary_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -11301,7 +12209,8 @@ def test_set_shielded_instance_integrity_policy_unary_rest_flattened_error( transport: str = "rest", ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -11324,10 +12233,17 @@ def test_set_shielded_instance_integrity_policy_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.SetTagsInstanceRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.SetTagsInstanceRequest, + dict, + ], +) def test_set_tags_unary_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -11445,7 +12361,8 @@ def test_set_tags_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -11487,7 +12404,15 @@ def test_set_tags_unary_rest_unset_required_fields(): unset_fields = transport.set_tags._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("instance", "project", "tagsResource", "zone",)) + set(("requestId",)) + & set( + ( + "instance", + "project", + "tagsResource", + "zone", + ) + ) ) @@ -11531,7 +12456,11 @@ def test_set_tags_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_tags_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -11542,7 +12471,8 @@ def test_set_tags_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetTagsInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -11567,7 +12497,8 @@ def test_set_tags_unary_rest_bad_request( def test_set_tags_unary_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -11614,7 +12545,8 @@ def test_set_tags_unary_rest_flattened(): def test_set_tags_unary_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -11636,11 +12568,16 @@ def test_set_tags_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SimulateMaintenanceEventInstanceRequest, dict,] + "request_type", + [ + compute.SimulateMaintenanceEventInstanceRequest, + dict, + ], ) def test_simulate_maintenance_event_unary_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -11752,7 +12689,8 @@ def test_simulate_maintenance_event_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -11792,7 +12730,16 @@ def test_simulate_maintenance_event_unary_rest_unset_required_fields(): ) unset_fields = transport.simulate_maintenance_event._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("instance", "project", "zone",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "instance", + "project", + "zone", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -11835,7 +12782,11 @@ def test_simulate_maintenance_event_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.simulate_maintenance_event_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -11847,7 +12798,8 @@ def test_simulate_maintenance_event_unary_rest_bad_request( request_type=compute.SimulateMaintenanceEventInstanceRequest, ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -11868,7 +12820,8 @@ def test_simulate_maintenance_event_unary_rest_bad_request( def test_simulate_maintenance_event_unary_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -11885,7 +12838,9 @@ def test_simulate_maintenance_event_unary_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", zone="zone_value", instance="instance_value", + project="project_value", + zone="zone_value", + instance="instance_value", ) mock_args.update(sample_request) @@ -11912,7 +12867,8 @@ def test_simulate_maintenance_event_unary_rest_flattened(): def test_simulate_maintenance_event_unary_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -11932,10 +12888,17 @@ def test_simulate_maintenance_event_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.StartInstanceRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.StartInstanceRequest, + dict, + ], +) def test_start_unary_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -12047,7 +13010,8 @@ def test_start_unary_rest_required_fields(request_type=compute.StartInstanceRequ assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -12088,7 +13052,14 @@ def test_start_unary_rest_unset_required_fields(): unset_fields = transport.start._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("instance", "project", "zone",)) + set(("requestId",)) + & set( + ( + "instance", + "project", + "zone", + ) + ) ) @@ -12131,7 +13102,13 @@ def test_start_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.start_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.start_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -12141,7 +13118,8 @@ def test_start_unary_rest_bad_request( transport: str = "rest", request_type=compute.StartInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -12162,7 +13140,8 @@ def test_start_unary_rest_bad_request( def test_start_unary_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -12179,7 +13158,9 @@ def test_start_unary_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", zone="zone_value", instance="instance_value", + project="project_value", + zone="zone_value", + instance="instance_value", ) mock_args.update(sample_request) @@ -12206,7 +13187,8 @@ def test_start_unary_rest_flattened(): def test_start_unary_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -12227,11 +13209,16 @@ def test_start_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.StartWithEncryptionKeyInstanceRequest, dict,] + "request_type", + [ + compute.StartWithEncryptionKeyInstanceRequest, + dict, + ], ) def test_start_with_encryption_key_unary_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -12359,7 +13346,8 @@ def test_start_with_encryption_key_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -12453,7 +13441,11 @@ def test_start_with_encryption_key_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.start_with_encryption_key_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -12464,7 +13456,8 @@ def test_start_with_encryption_key_unary_rest_bad_request( transport: str = "rest", request_type=compute.StartWithEncryptionKeyInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -12499,7 +13492,8 @@ def test_start_with_encryption_key_unary_rest_bad_request( def test_start_with_encryption_key_unary_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -12554,7 +13548,8 @@ def test_start_with_encryption_key_unary_rest_flattened(): def test_start_with_encryption_key_unary_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -12583,10 +13578,17 @@ def test_start_with_encryption_key_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.StopInstanceRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.StopInstanceRequest, + dict, + ], +) def test_stop_unary_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -12698,7 +13700,8 @@ def test_stop_unary_rest_required_fields(request_type=compute.StopInstanceReques assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -12739,7 +13742,14 @@ def test_stop_unary_rest_unset_required_fields(): unset_fields = transport.stop._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("instance", "project", "zone",)) + set(("requestId",)) + & set( + ( + "instance", + "project", + "zone", + ) + ) ) @@ -12782,7 +13792,13 @@ def test_stop_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.stop_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.stop_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -12792,7 +13808,8 @@ def test_stop_unary_rest_bad_request( transport: str = "rest", request_type=compute.StopInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -12813,7 +13830,8 @@ def test_stop_unary_rest_bad_request( def test_stop_unary_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -12830,7 +13848,9 @@ def test_stop_unary_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", zone="zone_value", instance="instance_value", + project="project_value", + zone="zone_value", + instance="instance_value", ) mock_args.update(sample_request) @@ -12857,7 +13877,8 @@ def test_stop_unary_rest_flattened(): def test_stop_unary_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -12877,10 +13898,17 @@ def test_stop_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.SuspendInstanceRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.SuspendInstanceRequest, + dict, + ], +) def test_suspend_unary_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -12994,7 +14022,8 @@ def test_suspend_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -13035,7 +14064,14 @@ def test_suspend_unary_rest_unset_required_fields(): unset_fields = transport.suspend._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("instance", "project", "zone",)) + set(("requestId",)) + & set( + ( + "instance", + "project", + "zone", + ) + ) ) @@ -13079,7 +14115,11 @@ def test_suspend_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.suspend_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -13090,7 +14130,8 @@ def test_suspend_unary_rest_bad_request( transport: str = "rest", request_type=compute.SuspendInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -13111,7 +14152,8 @@ def test_suspend_unary_rest_bad_request( def test_suspend_unary_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -13128,7 +14170,9 @@ def test_suspend_unary_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", zone="zone_value", instance="instance_value", + project="project_value", + zone="zone_value", + instance="instance_value", ) mock_args.update(sample_request) @@ -13155,7 +14199,8 @@ def test_suspend_unary_rest_flattened(): def test_suspend_unary_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -13176,11 +14221,16 @@ def test_suspend_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.TestIamPermissionsInstanceRequest, dict,] + "request_type", + [ + compute.TestIamPermissionsInstanceRequest, + dict, + ], ) def test_test_iam_permissions_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -13253,7 +14303,8 @@ def test_test_iam_permissions_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -13296,7 +14347,14 @@ def test_test_iam_permissions_rest_unset_required_fields(): unset_fields = transport.test_iam_permissions._get_unset_required_fields({}) assert set(unset_fields) == ( set(()) - & set(("project", "resource", "testPermissionsRequestResource", "zone",)) + & set( + ( + "project", + "resource", + "testPermissionsRequestResource", + "zone", + ) + ) ) @@ -13342,7 +14400,11 @@ def test_test_iam_permissions_rest_interceptors(null_interceptor): post.return_value = compute.TestPermissionsResponse client.test_iam_permissions( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -13353,7 +14415,8 @@ def test_test_iam_permissions_rest_bad_request( transport: str = "rest", request_type=compute.TestIamPermissionsInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -13377,7 +14440,8 @@ def test_test_iam_permissions_rest_bad_request( def test_test_iam_permissions_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -13426,7 +14490,8 @@ def test_test_iam_permissions_rest_flattened(): def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -13449,10 +14514,17 @@ def test_test_iam_permissions_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.UpdateInstanceRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.UpdateInstanceRequest, + dict, + ], +) def test_update_unary_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -13718,7 +14790,11 @@ def test_update_unary_rest_required_fields(request_type=compute.UpdateInstanceRe ).update._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("minimal_action", "most_disruptive_allowed_action", "request_id",) + ( + "minimal_action", + "most_disruptive_allowed_action", + "request_id", + ) ) jsonified_request.update(unset_fields) @@ -13731,7 +14807,8 @@ def test_update_unary_rest_required_fields(request_type=compute.UpdateInstanceRe assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -13773,8 +14850,21 @@ def test_update_unary_rest_unset_required_fields(): unset_fields = transport.update._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("minimalAction", "mostDisruptiveAllowedAction", "requestId",)) - & set(("instance", "instanceResource", "project", "zone",)) + set( + ( + "minimalAction", + "mostDisruptiveAllowedAction", + "requestId", + ) + ) + & set( + ( + "instance", + "instanceResource", + "project", + "zone", + ) + ) ) @@ -13818,7 +14908,11 @@ def test_update_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.update_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -13829,7 +14923,8 @@ def test_update_unary_rest_bad_request( transport: str = "rest", request_type=compute.UpdateInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -14015,7 +15110,8 @@ def test_update_unary_rest_bad_request( def test_update_unary_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -14066,7 +15162,8 @@ def test_update_unary_rest_flattened(): def test_update_unary_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -14092,11 +15189,16 @@ def test_update_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.UpdateAccessConfigInstanceRequest, dict,] + "request_type", + [ + compute.UpdateAccessConfigInstanceRequest, + dict, + ], ) def test_update_access_config_unary_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -14214,7 +15316,12 @@ def test_update_access_config_unary_rest_required_fields( credentials=ga_credentials.AnonymousCredentials() ).update_access_config._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("network_interface", "request_id",)) + assert not set(unset_fields) - set( + ( + "network_interface", + "request_id", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -14228,7 +15335,8 @@ def test_update_access_config_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -14259,7 +15367,10 @@ def test_update_access_config_unary_rest_required_fields( response = client.update_access_config_unary(request) expected_params = [ - ("networkInterface", "",), + ( + "networkInterface", + "", + ), ] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -14272,9 +15383,20 @@ def test_update_access_config_unary_rest_unset_required_fields(): unset_fields = transport.update_access_config._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("networkInterface", "requestId",)) + set( + ( + "networkInterface", + "requestId", + ) + ) & set( - ("accessConfigResource", "instance", "networkInterface", "project", "zone",) + ( + "accessConfigResource", + "instance", + "networkInterface", + "project", + "zone", + ) ) ) @@ -14319,7 +15441,11 @@ def test_update_access_config_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.update_access_config_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -14330,7 +15456,8 @@ def test_update_access_config_unary_rest_bad_request( transport: str = "rest", request_type=compute.UpdateAccessConfigInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -14362,7 +15489,8 @@ def test_update_access_config_unary_rest_bad_request( def test_update_access_config_unary_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -14412,7 +15540,8 @@ def test_update_access_config_unary_rest_flattened(): def test_update_access_config_unary_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -14437,11 +15566,16 @@ def test_update_access_config_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.UpdateDisplayDeviceInstanceRequest, dict,] + "request_type", + [ + compute.UpdateDisplayDeviceInstanceRequest, + dict, + ], ) def test_update_display_device_unary_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -14556,7 +15690,8 @@ def test_update_display_device_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -14599,7 +15734,14 @@ def test_update_display_device_unary_rest_unset_required_fields(): unset_fields = transport.update_display_device._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("displayDeviceResource", "instance", "project", "zone",)) + & set( + ( + "displayDeviceResource", + "instance", + "project", + "zone", + ) + ) ) @@ -14643,7 +15785,11 @@ def test_update_display_device_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.update_display_device_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -14654,7 +15800,8 @@ def test_update_display_device_unary_rest_bad_request( transport: str = "rest", request_type=compute.UpdateDisplayDeviceInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -14676,7 +15823,8 @@ def test_update_display_device_unary_rest_bad_request( def test_update_display_device_unary_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -14723,7 +15871,8 @@ def test_update_display_device_unary_rest_flattened(): def test_update_display_device_unary_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -14745,11 +15894,16 @@ def test_update_display_device_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.UpdateNetworkInterfaceInstanceRequest, dict,] + "request_type", + [ + compute.UpdateNetworkInterfaceInstanceRequest, + dict, + ], ) def test_update_network_interface_unary_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -14889,7 +16043,12 @@ def test_update_network_interface_unary_rest_required_fields( credentials=ga_credentials.AnonymousCredentials() ).update_network_interface._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("network_interface", "request_id",)) + assert not set(unset_fields) - set( + ( + "network_interface", + "request_id", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -14903,7 +16062,8 @@ def test_update_network_interface_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -14934,7 +16094,10 @@ def test_update_network_interface_unary_rest_required_fields( response = client.update_network_interface_unary(request) expected_params = [ - ("networkInterface", "",), + ( + "networkInterface", + "", + ), ] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -14947,7 +16110,12 @@ def test_update_network_interface_unary_rest_unset_required_fields(): unset_fields = transport.update_network_interface._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("networkInterface", "requestId",)) + set( + ( + "networkInterface", + "requestId", + ) + ) & set( ( "instance", @@ -15000,7 +16168,11 @@ def test_update_network_interface_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.update_network_interface_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -15011,7 +16183,8 @@ def test_update_network_interface_unary_rest_bad_request( transport: str = "rest", request_type=compute.UpdateNetworkInterfaceInstanceRequest ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -15065,7 +16238,8 @@ def test_update_network_interface_unary_rest_bad_request( def test_update_network_interface_unary_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -15117,7 +16291,8 @@ def test_update_network_interface_unary_rest_flattened(): def test_update_network_interface_unary_rest_flattened_error(transport: str = "rest"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -15144,11 +16319,16 @@ def test_update_network_interface_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.UpdateShieldedInstanceConfigInstanceRequest, dict,] + "request_type", + [ + compute.UpdateShieldedInstanceConfigInstanceRequest, + dict, + ], ) def test_update_shielded_instance_config_unary_rest(request_type): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -15267,7 +16447,8 @@ def test_update_shielded_instance_config_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -15312,7 +16493,14 @@ def test_update_shielded_instance_config_unary_rest_unset_required_fields(): ) assert set(unset_fields) == ( set(("requestId",)) - & set(("instance", "project", "shieldedInstanceConfigResource", "zone",)) + & set( + ( + "instance", + "project", + "shieldedInstanceConfigResource", + "zone", + ) + ) ) @@ -15356,7 +16544,11 @@ def test_update_shielded_instance_config_unary_rest_interceptors(null_intercepto post.return_value = compute.Operation client.update_shielded_instance_config_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -15368,7 +16560,8 @@ def test_update_shielded_instance_config_unary_rest_bad_request( request_type=compute.UpdateShieldedInstanceConfigInstanceRequest, ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -15394,7 +16587,8 @@ def test_update_shielded_instance_config_unary_rest_bad_request( def test_update_shielded_instance_config_unary_rest_flattened(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -15445,7 +16639,8 @@ def test_update_shielded_instance_config_unary_rest_flattened_error( transport: str = "rest", ): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -15475,7 +16670,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -15495,7 +16691,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = InstancesClient(client_options=options, transport=transport,) + client = InstancesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -15511,7 +16710,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = InstancesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -15524,7 +16724,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.InstancesRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.InstancesRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -15619,7 +16824,8 @@ def test_instances_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.InstancesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -15669,7 +16875,12 @@ def test_instances_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_instances_host_no_port(transport_name): client = InstancesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15685,7 +16896,12 @@ def test_instances_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_instances_host_with_port(transport_name): client = InstancesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15723,7 +16939,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = InstancesClient.common_folder_path(folder) assert expected == actual @@ -15741,7 +16959,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = InstancesClient.common_organization_path(organization) assert expected == actual @@ -15759,7 +16979,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = InstancesClient.common_project_path(project) assert expected == actual @@ -15779,7 +17001,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = InstancesClient.common_location_path(project, location) assert expected == actual @@ -15804,7 +17027,8 @@ def test_client_with_default_client_info(): transports.InstancesTransport, "_prep_wrapped_messages" ) as prep: client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -15813,7 +17037,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = InstancesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -15853,7 +17078,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(InstancesClient, transports.InstancesRestTransport),], + [ + (InstancesClient, transports.InstancesRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_interconnect_attachments.py b/tests/unit/gapic/compute_v1/test_interconnect_attachments.py index 98eeb2392..a0660f217 100644 --- a/tests/unit/gapic/compute_v1/test_interconnect_attachments.py +++ b/tests/unit/gapic/compute_v1/test_interconnect_attachments.py @@ -92,7 +92,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(InterconnectAttachmentsClient, "rest"),] + "client_class,transport_name", + [ + (InterconnectAttachmentsClient, "rest"), + ], ) def test_interconnect_attachments_client_from_service_account_info( client_class, transport_name @@ -116,7 +119,9 @@ def test_interconnect_attachments_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.InterconnectAttachmentsRestTransport, "rest"),], + [ + (transports.InterconnectAttachmentsRestTransport, "rest"), + ], ) def test_interconnect_attachments_client_service_account_always_use_jwt( transport_class, transport_name @@ -137,7 +142,10 @@ def test_interconnect_attachments_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(InterconnectAttachmentsClient, "rest"),] + "client_class,transport_name", + [ + (InterconnectAttachmentsClient, "rest"), + ], ) def test_interconnect_attachments_client_from_service_account_file( client_class, transport_name @@ -492,7 +500,9 @@ def test_interconnect_attachments_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -541,11 +551,16 @@ def test_interconnect_attachments_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.AggregatedListInterconnectAttachmentsRequest, dict,] + "request_type", + [ + compute.AggregatedListInterconnectAttachmentsRequest, + dict, + ], ) def test_aggregated_list_rest(request_type): client = InterconnectAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -628,7 +643,8 @@ def test_aggregated_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = InterconnectAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -716,8 +732,10 @@ def test_aggregated_list_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = compute.InterconnectAttachmentAggregatedList.to_json( - compute.InterconnectAttachmentAggregatedList() + req.return_value._content = ( + compute.InterconnectAttachmentAggregatedList.to_json( + compute.InterconnectAttachmentAggregatedList() + ) ) request = compute.AggregatedListInterconnectAttachmentsRequest() @@ -729,7 +747,11 @@ def test_aggregated_list_rest_interceptors(null_interceptor): post.return_value = compute.InterconnectAttachmentAggregatedList client.aggregated_list( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -741,7 +763,8 @@ def test_aggregated_list_rest_bad_request( request_type=compute.AggregatedListInterconnectAttachmentsRequest, ): client = InterconnectAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -762,7 +785,8 @@ def test_aggregated_list_rest_bad_request( def test_aggregated_list_rest_flattened(): client = InterconnectAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -774,7 +798,9 @@ def test_aggregated_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -802,7 +828,8 @@ def test_aggregated_list_rest_flattened(): def test_aggregated_list_rest_flattened_error(transport: str = "rest"): client = InterconnectAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -816,7 +843,8 @@ def test_aggregated_list_rest_flattened_error(transport: str = "rest"): def test_aggregated_list_rest_pager(transport: str = "rest"): client = InterconnectAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -834,10 +862,13 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): next_page_token="abc", ), compute.InterconnectAttachmentAggregatedList( - items={}, next_page_token="def", + items={}, + next_page_token="def", ), compute.InterconnectAttachmentAggregatedList( - items={"g": compute.InterconnectAttachmentsScopedList(),}, + items={ + "g": compute.InterconnectAttachmentsScopedList(), + }, next_page_token="ghi", ), compute.InterconnectAttachmentAggregatedList( @@ -886,11 +917,16 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.DeleteInterconnectAttachmentRequest, dict,] + "request_type", + [ + compute.DeleteInterconnectAttachmentRequest, + dict, + ], ) def test_delete_unary_rest(request_type): client = InterconnectAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1010,7 +1046,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = InterconnectAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1051,7 +1088,14 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("interconnectAttachment", "project", "region",)) + set(("requestId",)) + & set( + ( + "interconnectAttachment", + "project", + "region", + ) + ) ) @@ -1097,7 +1141,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1108,7 +1156,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteInterconnectAttachmentRequest ): client = InterconnectAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1133,7 +1182,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = InterconnectAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1179,7 +1229,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = InterconnectAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1200,11 +1251,16 @@ def test_delete_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.GetInterconnectAttachmentRequest, dict,] + "request_type", + [ + compute.GetInterconnectAttachmentRequest, + dict, + ], ) def test_get_rest(request_type): client = InterconnectAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1350,7 +1406,8 @@ def test_get_rest_required_fields( assert jsonified_request["region"] == "region_value" client = InterconnectAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1391,7 +1448,14 @@ def test_get_rest_unset_required_fields(): unset_fields = transport.get._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("interconnectAttachment", "project", "region",)) + set(()) + & set( + ( + "interconnectAttachment", + "project", + "region", + ) + ) ) @@ -1438,7 +1502,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.InterconnectAttachment - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1448,7 +1518,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetInterconnectAttachmentRequest ): client = InterconnectAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1473,7 +1544,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = InterconnectAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1519,7 +1591,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = InterconnectAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1540,11 +1613,16 @@ def test_get_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.InsertInterconnectAttachmentRequest, dict,] + "request_type", + [ + compute.InsertInterconnectAttachmentRequest, + dict, + ], ) def test_insert_unary_rest(request_type): client = InterconnectAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1691,7 +1769,12 @@ def test_insert_unary_rest_required_fields( credentials=ga_credentials.AnonymousCredentials() ).insert._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("request_id", "validate_only",)) + assert not set(unset_fields) - set( + ( + "request_id", + "validate_only", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -1701,7 +1784,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = InterconnectAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1743,8 +1827,19 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId", "validateOnly",)) - & set(("interconnectAttachmentResource", "project", "region",)) + set( + ( + "requestId", + "validateOnly", + ) + ) + & set( + ( + "interconnectAttachmentResource", + "project", + "region", + ) + ) ) @@ -1790,7 +1885,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1801,7 +1900,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertInterconnectAttachmentRequest ): client = InterconnectAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1869,7 +1969,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = InterconnectAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1913,7 +2014,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = InterconnectAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1936,11 +2038,16 @@ def test_insert_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.ListInterconnectAttachmentsRequest, dict,] + "request_type", + [ + compute.ListInterconnectAttachmentsRequest, + dict, + ], ) def test_list_rest(request_type): client = InterconnectAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2005,7 +2112,13 @@ def test_list_rest_required_fields( ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -2016,7 +2129,8 @@ def test_list_rest_required_fields( assert jsonified_request["region"] == "region_value" client = InterconnectAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2057,8 +2171,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "region",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "region", + ) + ) ) @@ -2105,7 +2232,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.InterconnectAttachmentList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2115,7 +2248,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListInterconnectAttachmentsRequest ): client = InterconnectAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2136,7 +2270,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = InterconnectAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2148,7 +2283,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "region": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", region="region_value",) + mock_args = dict( + project="project_value", + region="region_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2174,7 +2312,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = InterconnectAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2189,7 +2328,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = InterconnectAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2206,9 +2346,15 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.InterconnectAttachmentList(items=[], next_page_token="def",), compute.InterconnectAttachmentList( - items=[compute.InterconnectAttachment(),], next_page_token="ghi", + items=[], + next_page_token="def", + ), + compute.InterconnectAttachmentList( + items=[ + compute.InterconnectAttachment(), + ], + next_page_token="ghi", ), compute.InterconnectAttachmentList( items=[ @@ -2244,11 +2390,16 @@ def test_list_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.PatchInterconnectAttachmentRequest, dict,] + "request_type", + [ + compute.PatchInterconnectAttachmentRequest, + dict, + ], ) def test_patch_unary_rest(request_type): client = InterconnectAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2415,7 +2566,8 @@ def test_patch_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = InterconnectAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2510,7 +2662,13 @@ def test_patch_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.patch_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2520,7 +2678,8 @@ def test_patch_unary_rest_bad_request( transport: str = "rest", request_type=compute.PatchInterconnectAttachmentRequest ): client = InterconnectAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2592,7 +2751,8 @@ def test_patch_unary_rest_bad_request( def test_patch_unary_rest_flattened(): client = InterconnectAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2641,7 +2801,8 @@ def test_patch_unary_rest_flattened(): def test_patch_unary_rest_flattened_error(transport: str = "rest"): client = InterconnectAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2671,7 +2832,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = InterconnectAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2692,7 +2854,8 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = InterconnectAttachmentsClient( - client_options=options, transport=transport, + client_options=options, + transport=transport, ) # It is an error to provide an api_key and a credential. @@ -2709,7 +2872,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = InterconnectAttachmentsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2723,7 +2887,10 @@ def test_transport_instance(): @pytest.mark.parametrize( - "transport_class", [transports.InterconnectAttachmentsRestTransport,] + "transport_class", + [ + transports.InterconnectAttachmentsRestTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -2780,7 +2947,8 @@ def test_interconnect_attachments_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.InterconnectAttachmentsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2830,7 +2998,12 @@ def test_interconnect_attachments_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_interconnect_attachments_host_no_port(transport_name): client = InterconnectAttachmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2846,7 +3019,12 @@ def test_interconnect_attachments_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_interconnect_attachments_host_with_port(transport_name): client = InterconnectAttachmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2884,7 +3062,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = InterconnectAttachmentsClient.common_folder_path(folder) assert expected == actual @@ -2902,7 +3082,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = InterconnectAttachmentsClient.common_organization_path(organization) assert expected == actual @@ -2920,7 +3102,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = InterconnectAttachmentsClient.common_project_path(project) assert expected == actual @@ -2940,7 +3124,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = InterconnectAttachmentsClient.common_location_path(project, location) assert expected == actual @@ -2965,7 +3150,8 @@ def test_client_with_default_client_info(): transports.InterconnectAttachmentsTransport, "_prep_wrapped_messages" ) as prep: client = InterconnectAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2974,7 +3160,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = InterconnectAttachmentsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3014,7 +3201,12 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(InterconnectAttachmentsClient, transports.InterconnectAttachmentsRestTransport),], + [ + ( + InterconnectAttachmentsClient, + transports.InterconnectAttachmentsRestTransport, + ), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_interconnect_locations.py b/tests/unit/gapic/compute_v1/test_interconnect_locations.py index 0fbb9c762..2711fe6be 100644 --- a/tests/unit/gapic/compute_v1/test_interconnect_locations.py +++ b/tests/unit/gapic/compute_v1/test_interconnect_locations.py @@ -92,7 +92,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(InterconnectLocationsClient, "rest"),] + "client_class,transport_name", + [ + (InterconnectLocationsClient, "rest"), + ], ) def test_interconnect_locations_client_from_service_account_info( client_class, transport_name @@ -116,7 +119,9 @@ def test_interconnect_locations_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.InterconnectLocationsRestTransport, "rest"),], + [ + (transports.InterconnectLocationsRestTransport, "rest"), + ], ) def test_interconnect_locations_client_service_account_always_use_jwt( transport_class, transport_name @@ -137,7 +142,10 @@ def test_interconnect_locations_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(InterconnectLocationsClient, "rest"),] + "client_class,transport_name", + [ + (InterconnectLocationsClient, "rest"), + ], ) def test_interconnect_locations_client_from_service_account_file( client_class, transport_name @@ -490,7 +498,9 @@ def test_interconnect_locations_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -539,11 +549,16 @@ def test_interconnect_locations_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.GetInterconnectLocationRequest, dict,] + "request_type", + [ + compute.GetInterconnectLocationRequest, + dict, + ], ) def test_get_rest(request_type): client = InterconnectLocationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -637,7 +652,8 @@ def test_get_rest_required_fields(request_type=compute.GetInterconnectLocationRe assert jsonified_request["project"] == "project_value" client = InterconnectLocationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -677,7 +693,15 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("interconnectLocation", "project",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "interconnectLocation", + "project", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -723,7 +747,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.InterconnectLocation - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -733,7 +763,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetInterconnectLocationRequest ): client = InterconnectLocationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -754,7 +785,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = InterconnectLocationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -795,7 +827,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = InterconnectLocationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -815,11 +848,16 @@ def test_get_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.ListInterconnectLocationsRequest, dict,] + "request_type", + [ + compute.ListInterconnectLocationsRequest, + dict, + ], ) def test_list_rest(request_type): client = InterconnectLocationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -882,7 +920,13 @@ def test_list_rest_required_fields( ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -891,7 +935,8 @@ def test_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = InterconnectLocationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -932,7 +977,15 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set(("project",)) ) @@ -980,7 +1033,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.InterconnectLocationList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -990,7 +1049,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListInterconnectLocationsRequest ): client = InterconnectLocationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1011,7 +1071,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = InterconnectLocationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1023,7 +1084,9 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1049,20 +1112,23 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = InterconnectLocationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list( - compute.ListInterconnectLocationsRequest(), project="project_value", + compute.ListInterconnectLocationsRequest(), + project="project_value", ) def test_list_rest_pager(transport: str = "rest"): client = InterconnectLocationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1079,12 +1145,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.InterconnectLocationList(items=[], next_page_token="def",), compute.InterconnectLocationList( - items=[compute.InterconnectLocation(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.InterconnectLocationList( - items=[compute.InterconnectLocation(), compute.InterconnectLocation(),], + items=[ + compute.InterconnectLocation(), + ], + next_page_token="ghi", + ), + compute.InterconnectLocationList( + items=[ + compute.InterconnectLocation(), + compute.InterconnectLocation(), + ], ), ) # Two responses for two calls @@ -1118,7 +1193,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = InterconnectLocationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1139,7 +1215,8 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = InterconnectLocationsClient( - client_options=options, transport=transport, + client_options=options, + transport=transport, ) # It is an error to provide an api_key and a credential. @@ -1156,7 +1233,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = InterconnectLocationsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1170,7 +1248,10 @@ def test_transport_instance(): @pytest.mark.parametrize( - "transport_class", [transports.InterconnectLocationsRestTransport,] + "transport_class", + [ + transports.InterconnectLocationsRestTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -1223,7 +1304,8 @@ def test_interconnect_locations_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.InterconnectLocationsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1275,7 +1357,12 @@ def test_interconnect_locations_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_interconnect_locations_host_no_port(transport_name): client = InterconnectLocationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1291,7 +1378,12 @@ def test_interconnect_locations_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_interconnect_locations_host_with_port(transport_name): client = InterconnectLocationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1329,7 +1421,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = InterconnectLocationsClient.common_folder_path(folder) assert expected == actual @@ -1347,7 +1441,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = InterconnectLocationsClient.common_organization_path(organization) assert expected == actual @@ -1365,7 +1461,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = InterconnectLocationsClient.common_project_path(project) assert expected == actual @@ -1385,7 +1483,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = InterconnectLocationsClient.common_location_path(project, location) assert expected == actual @@ -1410,7 +1509,8 @@ def test_client_with_default_client_info(): transports.InterconnectLocationsTransport, "_prep_wrapped_messages" ) as prep: client = InterconnectLocationsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1419,7 +1519,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = InterconnectLocationsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1459,7 +1560,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(InterconnectLocationsClient, transports.InterconnectLocationsRestTransport),], + [ + (InterconnectLocationsClient, transports.InterconnectLocationsRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_interconnects.py b/tests/unit/gapic/compute_v1/test_interconnects.py index 219cad74e..ea56abc41 100644 --- a/tests/unit/gapic/compute_v1/test_interconnects.py +++ b/tests/unit/gapic/compute_v1/test_interconnects.py @@ -89,7 +89,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(InterconnectsClient, "rest"),] + "client_class,transport_name", + [ + (InterconnectsClient, "rest"), + ], ) def test_interconnects_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() @@ -110,7 +113,10 @@ def test_interconnects_client_from_service_account_info(client_class, transport_ @pytest.mark.parametrize( - "transport_class,transport_name", [(transports.InterconnectsRestTransport, "rest"),] + "transport_class,transport_name", + [ + (transports.InterconnectsRestTransport, "rest"), + ], ) def test_interconnects_client_service_account_always_use_jwt( transport_class, transport_name @@ -131,7 +137,10 @@ def test_interconnects_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(InterconnectsClient, "rest"),] + "client_class,transport_name", + [ + (InterconnectsClient, "rest"), + ], ) def test_interconnects_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() @@ -171,7 +180,9 @@ def test_interconnects_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(InterconnectsClient, transports.InterconnectsRestTransport, "rest"),], + [ + (InterconnectsClient, transports.InterconnectsRestTransport, "rest"), + ], ) @mock.patch.object( InterconnectsClient, @@ -454,13 +465,17 @@ def test_interconnects_client_get_mtls_endpoint_and_cert_source(client_class): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(InterconnectsClient, transports.InterconnectsRestTransport, "rest"),], + [ + (InterconnectsClient, transports.InterconnectsRestTransport, "rest"), + ], ) def test_interconnects_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -478,7 +493,9 @@ def test_interconnects_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(InterconnectsClient, transports.InterconnectsRestTransport, "rest", None),], + [ + (InterconnectsClient, transports.InterconnectsRestTransport, "rest", None), + ], ) def test_interconnects_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -501,10 +518,17 @@ def test_interconnects_client_client_options_credentials_file( ) -@pytest.mark.parametrize("request_type", [compute.DeleteInterconnectRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteInterconnectRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = InterconnectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -614,7 +638,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = InterconnectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -655,7 +680,13 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("interconnect", "project",)) + set(("requestId",)) + & set( + ( + "interconnect", + "project", + ) + ) ) @@ -701,7 +732,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -712,7 +747,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteInterconnectRequest ): client = InterconnectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -733,7 +769,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = InterconnectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -745,7 +782,10 @@ def test_delete_unary_rest_flattened(): sample_request = {"project": "sample1", "interconnect": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", interconnect="interconnect_value",) + mock_args = dict( + project="project_value", + interconnect="interconnect_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -771,7 +811,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = InterconnectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -790,10 +831,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetInterconnectRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetInterconnectRequest, + dict, + ], +) def test_get_rest(request_type): client = InterconnectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -897,7 +945,8 @@ def test_get_rest_required_fields(request_type=compute.GetInterconnectRequest): assert jsonified_request["project"] == "project_value" client = InterconnectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -937,7 +986,15 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("interconnect", "project",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "interconnect", + "project", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -981,7 +1038,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Interconnect - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -991,7 +1054,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetInterconnectRequest ): client = InterconnectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1012,7 +1076,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = InterconnectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1024,7 +1089,10 @@ def test_get_rest_flattened(): sample_request = {"project": "sample1", "interconnect": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", interconnect="interconnect_value",) + mock_args = dict( + project="project_value", + interconnect="interconnect_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1050,7 +1118,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = InterconnectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1070,11 +1139,16 @@ def test_get_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.GetDiagnosticsInterconnectRequest, dict,] + "request_type", + [ + compute.GetDiagnosticsInterconnectRequest, + dict, + ], ) def test_get_diagnostics_rest(request_type): client = InterconnectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1139,7 +1213,8 @@ def test_get_diagnostics_rest_required_fields( assert jsonified_request["project"] == "project_value" client = InterconnectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1181,7 +1256,15 @@ def test_get_diagnostics_rest_unset_required_fields(): ) unset_fields = transport.get_diagnostics._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("interconnect", "project",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "interconnect", + "project", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1228,7 +1311,11 @@ def test_get_diagnostics_rest_interceptors(null_interceptor): post.return_value = compute.InterconnectsGetDiagnosticsResponse client.get_diagnostics( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1239,7 +1326,8 @@ def test_get_diagnostics_rest_bad_request( transport: str = "rest", request_type=compute.GetDiagnosticsInterconnectRequest ): client = InterconnectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1260,7 +1348,8 @@ def test_get_diagnostics_rest_bad_request( def test_get_diagnostics_rest_flattened(): client = InterconnectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1272,7 +1361,10 @@ def test_get_diagnostics_rest_flattened(): sample_request = {"project": "sample1", "interconnect": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", interconnect="interconnect_value",) + mock_args = dict( + project="project_value", + interconnect="interconnect_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1300,7 +1392,8 @@ def test_get_diagnostics_rest_flattened(): def test_get_diagnostics_rest_flattened_error(transport: str = "rest"): client = InterconnectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1319,10 +1412,17 @@ def test_get_diagnostics_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertInterconnectRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertInterconnectRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = InterconnectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1476,7 +1576,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = InterconnectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1518,7 +1619,13 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("interconnectResource", "project",)) + set(("requestId",)) + & set( + ( + "interconnectResource", + "project", + ) + ) ) @@ -1564,7 +1671,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1575,7 +1686,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertInterconnectRequest ): client = InterconnectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1644,7 +1756,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = InterconnectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1685,7 +1798,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = InterconnectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1704,10 +1818,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListInterconnectsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListInterconnectsRequest, + dict, + ], +) def test_list_rest(request_type): client = InterconnectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1768,7 +1889,13 @@ def test_list_rest_required_fields(request_type=compute.ListInterconnectsRequest ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1777,7 +1904,8 @@ def test_list_rest_required_fields(request_type=compute.ListInterconnectsRequest assert jsonified_request["project"] == "project_value" client = InterconnectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1818,7 +1946,15 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set(("project",)) ) @@ -1866,7 +2002,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.InterconnectList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1876,7 +2018,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListInterconnectsRequest ): client = InterconnectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1897,7 +2040,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = InterconnectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1909,7 +2053,9 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1935,20 +2081,23 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = InterconnectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list( - compute.ListInterconnectsRequest(), project="project_value", + compute.ListInterconnectsRequest(), + project="project_value", ) def test_list_rest_pager(transport: str = "rest"): client = InterconnectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1965,12 +2114,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.InterconnectList(items=[], next_page_token="def",), compute.InterconnectList( - items=[compute.Interconnect(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.InterconnectList( - items=[compute.Interconnect(), compute.Interconnect(),], + items=[ + compute.Interconnect(), + ], + next_page_token="ghi", + ), + compute.InterconnectList( + items=[ + compute.Interconnect(), + compute.Interconnect(), + ], ), ) # Two responses for two calls @@ -1997,10 +2155,17 @@ def test_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.PatchInterconnectRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.PatchInterconnectRequest, + dict, + ], +) def test_patch_unary_rest(request_type): client = InterconnectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2158,7 +2323,8 @@ def test_patch_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = InterconnectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2200,7 +2366,14 @@ def test_patch_unary_rest_unset_required_fields(): unset_fields = transport.patch._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("interconnect", "interconnectResource", "project",)) + set(("requestId",)) + & set( + ( + "interconnect", + "interconnectResource", + "project", + ) + ) ) @@ -2245,7 +2418,13 @@ def test_patch_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.patch_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2255,7 +2434,8 @@ def test_patch_unary_rest_bad_request( transport: str = "rest", request_type=compute.PatchInterconnectRequest ): client = InterconnectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2324,7 +2504,8 @@ def test_patch_unary_rest_bad_request( def test_patch_unary_rest_flattened(): client = InterconnectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2366,7 +2547,8 @@ def test_patch_unary_rest_flattened(): def test_patch_unary_rest_flattened_error(transport: str = "rest"): client = InterconnectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2393,7 +2575,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = InterconnectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2413,7 +2596,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = InterconnectsClient(client_options=options, transport=transport,) + client = InterconnectsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2429,7 +2615,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = InterconnectsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2442,7 +2629,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.InterconnectsRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.InterconnectsRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -2498,7 +2690,8 @@ def test_interconnects_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.InterconnectsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2548,7 +2741,12 @@ def test_interconnects_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_interconnects_host_no_port(transport_name): client = InterconnectsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2564,7 +2762,12 @@ def test_interconnects_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_interconnects_host_with_port(transport_name): client = InterconnectsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2602,7 +2805,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = InterconnectsClient.common_folder_path(folder) assert expected == actual @@ -2620,7 +2825,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = InterconnectsClient.common_organization_path(organization) assert expected == actual @@ -2638,7 +2845,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = InterconnectsClient.common_project_path(project) assert expected == actual @@ -2658,7 +2867,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = InterconnectsClient.common_location_path(project, location) assert expected == actual @@ -2683,7 +2893,8 @@ def test_client_with_default_client_info(): transports.InterconnectsTransport, "_prep_wrapped_messages" ) as prep: client = InterconnectsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2692,7 +2903,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = InterconnectsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2732,7 +2944,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(InterconnectsClient, transports.InterconnectsRestTransport),], + [ + (InterconnectsClient, transports.InterconnectsRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_license_codes.py b/tests/unit/gapic/compute_v1/test_license_codes.py index b3dafed0e..74b9e494c 100644 --- a/tests/unit/gapic/compute_v1/test_license_codes.py +++ b/tests/unit/gapic/compute_v1/test_license_codes.py @@ -84,7 +84,12 @@ def test__get_default_mtls_endpoint(): assert LicenseCodesClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class,transport_name", [(LicenseCodesClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (LicenseCodesClient, "rest"), + ], +) def test_license_codes_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -104,7 +109,10 @@ def test_license_codes_client_from_service_account_info(client_class, transport_ @pytest.mark.parametrize( - "transport_class,transport_name", [(transports.LicenseCodesRestTransport, "rest"),] + "transport_class,transport_name", + [ + (transports.LicenseCodesRestTransport, "rest"), + ], ) def test_license_codes_client_service_account_always_use_jwt( transport_class, transport_name @@ -124,7 +132,12 @@ def test_license_codes_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class,transport_name", [(LicenseCodesClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (LicenseCodesClient, "rest"), + ], +) def test_license_codes_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -163,7 +176,9 @@ def test_license_codes_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(LicenseCodesClient, transports.LicenseCodesRestTransport, "rest"),], + [ + (LicenseCodesClient, transports.LicenseCodesRestTransport, "rest"), + ], ) @mock.patch.object( LicenseCodesClient, "DEFAULT_ENDPOINT", modify_default_endpoint(LicenseCodesClient) @@ -440,13 +455,17 @@ def test_license_codes_client_get_mtls_endpoint_and_cert_source(client_class): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(LicenseCodesClient, transports.LicenseCodesRestTransport, "rest"),], + [ + (LicenseCodesClient, transports.LicenseCodesRestTransport, "rest"), + ], ) def test_license_codes_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -464,7 +483,9 @@ def test_license_codes_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(LicenseCodesClient, transports.LicenseCodesRestTransport, "rest", None),], + [ + (LicenseCodesClient, transports.LicenseCodesRestTransport, "rest", None), + ], ) def test_license_codes_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -487,10 +508,17 @@ def test_license_codes_client_client_options_credentials_file( ) -@pytest.mark.parametrize("request_type", [compute.GetLicenseCodeRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetLicenseCodeRequest, + dict, + ], +) def test_get_rest(request_type): client = LicenseCodesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -568,7 +596,8 @@ def test_get_rest_required_fields(request_type=compute.GetLicenseCodeRequest): assert jsonified_request["project"] == "project_value" client = LicenseCodesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -608,7 +637,15 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("licenseCode", "project",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "licenseCode", + "project", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -652,7 +689,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.LicenseCode - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -662,7 +705,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetLicenseCodeRequest ): client = LicenseCodesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -683,7 +727,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = LicenseCodesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -695,7 +740,10 @@ def test_get_rest_flattened(): sample_request = {"project": "sample1", "license_code": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", license_code="license_code_value",) + mock_args = dict( + project="project_value", + license_code="license_code_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -721,7 +769,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = LicenseCodesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -741,11 +790,16 @@ def test_get_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.TestIamPermissionsLicenseCodeRequest, dict,] + "request_type", + [ + compute.TestIamPermissionsLicenseCodeRequest, + dict, + ], ) def test_test_iam_permissions_rest(request_type): client = LicenseCodesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -814,7 +868,8 @@ def test_test_iam_permissions_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = LicenseCodesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -856,7 +911,14 @@ def test_test_iam_permissions_rest_unset_required_fields(): unset_fields = transport.test_iam_permissions._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("project", "resource", "testPermissionsRequestResource",)) + set(()) + & set( + ( + "project", + "resource", + "testPermissionsRequestResource", + ) + ) ) @@ -904,7 +966,11 @@ def test_test_iam_permissions_rest_interceptors(null_interceptor): post.return_value = compute.TestPermissionsResponse client.test_iam_permissions( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -915,7 +981,8 @@ def test_test_iam_permissions_rest_bad_request( transport: str = "rest", request_type=compute.TestIamPermissionsLicenseCodeRequest ): client = LicenseCodesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -939,7 +1006,8 @@ def test_test_iam_permissions_rest_bad_request( def test_test_iam_permissions_rest_flattened(): client = LicenseCodesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -983,7 +1051,8 @@ def test_test_iam_permissions_rest_flattened(): def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): client = LicenseCodesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1012,7 +1081,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = LicenseCodesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1032,7 +1102,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = LicenseCodesClient(client_options=options, transport=transport,) + client = LicenseCodesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1048,7 +1121,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = LicenseCodesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1061,7 +1135,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.LicenseCodesRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.LicenseCodesRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -1113,7 +1192,8 @@ def test_license_codes_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.LicenseCodesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1165,7 +1245,12 @@ def test_license_codes_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_license_codes_host_no_port(transport_name): client = LicenseCodesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1181,7 +1266,12 @@ def test_license_codes_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_license_codes_host_with_port(transport_name): client = LicenseCodesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1219,7 +1309,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = LicenseCodesClient.common_folder_path(folder) assert expected == actual @@ -1237,7 +1329,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = LicenseCodesClient.common_organization_path(organization) assert expected == actual @@ -1255,7 +1349,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = LicenseCodesClient.common_project_path(project) assert expected == actual @@ -1275,7 +1371,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = LicenseCodesClient.common_location_path(project, location) assert expected == actual @@ -1300,7 +1397,8 @@ def test_client_with_default_client_info(): transports.LicenseCodesTransport, "_prep_wrapped_messages" ) as prep: client = LicenseCodesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1309,7 +1407,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = LicenseCodesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1349,7 +1448,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(LicenseCodesClient, transports.LicenseCodesRestTransport),], + [ + (LicenseCodesClient, transports.LicenseCodesRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_licenses.py b/tests/unit/gapic/compute_v1/test_licenses.py index 4ea0e6c74..c3f6b9a60 100644 --- a/tests/unit/gapic/compute_v1/test_licenses.py +++ b/tests/unit/gapic/compute_v1/test_licenses.py @@ -83,7 +83,12 @@ def test__get_default_mtls_endpoint(): assert LicensesClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class,transport_name", [(LicensesClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (LicensesClient, "rest"), + ], +) def test_licenses_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -103,7 +108,10 @@ def test_licenses_client_from_service_account_info(client_class, transport_name) @pytest.mark.parametrize( - "transport_class,transport_name", [(transports.LicensesRestTransport, "rest"),] + "transport_class,transport_name", + [ + (transports.LicensesRestTransport, "rest"), + ], ) def test_licenses_client_service_account_always_use_jwt( transport_class, transport_name @@ -123,7 +131,12 @@ def test_licenses_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class,transport_name", [(LicensesClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (LicensesClient, "rest"), + ], +) def test_licenses_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -162,7 +175,9 @@ def test_licenses_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(LicensesClient, transports.LicensesRestTransport, "rest"),], + [ + (LicensesClient, transports.LicensesRestTransport, "rest"), + ], ) @mock.patch.object( LicensesClient, "DEFAULT_ENDPOINT", modify_default_endpoint(LicensesClient) @@ -437,13 +452,17 @@ def test_licenses_client_get_mtls_endpoint_and_cert_source(client_class): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(LicensesClient, transports.LicensesRestTransport, "rest"),], + [ + (LicensesClient, transports.LicensesRestTransport, "rest"), + ], ) def test_licenses_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -461,7 +480,9 @@ def test_licenses_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(LicensesClient, transports.LicensesRestTransport, "rest", None),], + [ + (LicensesClient, transports.LicensesRestTransport, "rest", None), + ], ) def test_licenses_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -484,10 +505,17 @@ def test_licenses_client_client_options_credentials_file( ) -@pytest.mark.parametrize("request_type", [compute.DeleteLicenseRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteLicenseRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -588,7 +616,12 @@ def test_delete_unary_rest_required_fields(request_type=compute.DeleteLicenseReq credentials=ga_credentials.AnonymousCredentials() ).delete._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("license_", "request_id",)) + assert not set(unset_fields) - set( + ( + "license_", + "request_id", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -598,7 +631,8 @@ def test_delete_unary_rest_required_fields(request_type=compute.DeleteLicenseReq assert jsonified_request["project"] == "project_value" client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -628,7 +662,10 @@ def test_delete_unary_rest_required_fields(request_type=compute.DeleteLicenseReq response = client.delete_unary(request) expected_params = [ - ("license", "",), + ( + "license", + "", + ), ] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -641,7 +678,18 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("license", "requestId",)) & set(("license", "project",)) + set( + ( + "license", + "requestId", + ) + ) + & set( + ( + "license", + "project", + ) + ) ) @@ -685,7 +733,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -696,7 +748,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteLicenseRequest ): client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -717,7 +770,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -729,7 +783,10 @@ def test_delete_unary_rest_flattened(): sample_request = {"project": "sample1", "license_": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", license_="license__value",) + mock_args = dict( + project="project_value", + license_="license__value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -755,7 +812,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -774,10 +832,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetLicenseRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetLicenseRequest, + dict, + ], +) def test_get_rest(request_type): client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -862,7 +927,8 @@ def test_get_rest_required_fields(request_type=compute.GetLicenseRequest): assert jsonified_request["project"] == "project_value" client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -892,7 +958,10 @@ def test_get_rest_required_fields(request_type=compute.GetLicenseRequest): response = client.get(request) expected_params = [ - ("license", "",), + ( + "license", + "", + ), ] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -904,7 +973,15 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(("license",)) & set(("license", "project",))) + assert set(unset_fields) == ( + set(("license",)) + & set( + ( + "license", + "project", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -946,7 +1023,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.License - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -956,7 +1039,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetLicenseRequest ): client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -977,7 +1061,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -989,7 +1074,10 @@ def test_get_rest_flattened(): sample_request = {"project": "sample1", "license_": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", license_="license__value",) + mock_args = dict( + project="project_value", + license_="license__value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1015,7 +1103,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1034,10 +1123,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetIamPolicyLicenseRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetIamPolicyLicenseRequest, + dict, + ], +) def test_get_iam_policy_rest(request_type): client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1047,7 +1143,11 @@ def test_get_iam_policy_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = compute.Policy(etag="etag_value", iam_owned=True, version=774,) + return_value = compute.Policy( + etag="etag_value", + iam_owned=True, + version=774, + ) # Wrap the value into a proper Response obj response_value = Response() @@ -1105,7 +1205,8 @@ def test_get_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1146,7 +1247,13 @@ def test_get_iam_policy_rest_unset_required_fields(): unset_fields = transport.get_iam_policy._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("optionsRequestedPolicyVersion",)) & set(("project", "resource",)) + set(("optionsRequestedPolicyVersion",)) + & set( + ( + "project", + "resource", + ) + ) ) @@ -1190,7 +1297,11 @@ def test_get_iam_policy_rest_interceptors(null_interceptor): post.return_value = compute.Policy client.get_iam_policy( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1201,7 +1312,8 @@ def test_get_iam_policy_rest_bad_request( transport: str = "rest", request_type=compute.GetIamPolicyLicenseRequest ): client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1222,7 +1334,8 @@ def test_get_iam_policy_rest_bad_request( def test_get_iam_policy_rest_flattened(): client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1234,7 +1347,10 @@ def test_get_iam_policy_rest_flattened(): sample_request = {"project": "sample1", "resource": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", resource="resource_value",) + mock_args = dict( + project="project_value", + resource="resource_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1260,7 +1376,8 @@ def test_get_iam_policy_rest_flattened(): def test_get_iam_policy_rest_flattened_error(transport: str = "rest"): client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1279,10 +1396,17 @@ def test_get_iam_policy_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertLicenseRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertLicenseRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1398,7 +1522,8 @@ def test_insert_unary_rest_required_fields(request_type=compute.InsertLicenseReq assert jsonified_request["project"] == "project_value" client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1440,7 +1565,13 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("licenseResource", "project",)) + set(("requestId",)) + & set( + ( + "licenseResource", + "project", + ) + ) ) @@ -1484,7 +1615,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1495,7 +1630,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertLicenseRequest ): client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1528,7 +1664,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1568,7 +1705,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1587,10 +1725,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListLicensesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListLicensesRequest, + dict, + ], +) def test_list_rest(request_type): client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1649,7 +1794,13 @@ def test_list_rest_required_fields(request_type=compute.ListLicensesRequest): ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1658,7 +1809,8 @@ def test_list_rest_required_fields(request_type=compute.ListLicensesRequest): assert jsonified_request["project"] == "project_value" client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1699,7 +1851,15 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set(("project",)) ) @@ -1745,7 +1905,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.LicensesListResponse - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1755,7 +1921,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListLicensesRequest ): client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1776,7 +1943,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1788,7 +1956,9 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1813,20 +1983,23 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list( - compute.ListLicensesRequest(), project="project_value", + compute.ListLicensesRequest(), + project="project_value", ) def test_list_rest_pager(transport: str = "rest"): client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1836,15 +2009,28 @@ def test_list_rest_pager(transport: str = "rest"): # Set the response as a series of pages response = ( compute.LicensesListResponse( - items=[compute.License(), compute.License(), compute.License(),], + items=[ + compute.License(), + compute.License(), + compute.License(), + ], next_page_token="abc", ), - compute.LicensesListResponse(items=[], next_page_token="def",), compute.LicensesListResponse( - items=[compute.License(),], next_page_token="ghi", + items=[], + next_page_token="def", + ), + compute.LicensesListResponse( + items=[ + compute.License(), + ], + next_page_token="ghi", ), compute.LicensesListResponse( - items=[compute.License(), compute.License(),], + items=[ + compute.License(), + compute.License(), + ], ), ) # Two responses for two calls @@ -1871,10 +2057,17 @@ def test_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.SetIamPolicyLicenseRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.SetIamPolicyLicenseRequest, + dict, + ], +) def test_set_iam_policy_rest(request_type): client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1961,7 +2154,11 @@ def test_set_iam_policy_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = compute.Policy(etag="etag_value", iam_owned=True, version=774,) + return_value = compute.Policy( + etag="etag_value", + iam_owned=True, + version=774, + ) # Wrap the value into a proper Response obj response_value = Response() @@ -2017,7 +2214,8 @@ def test_set_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2059,7 +2257,14 @@ def test_set_iam_policy_rest_unset_required_fields(): unset_fields = transport.set_iam_policy._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("globalSetPolicyRequestResource", "project", "resource",)) + set(()) + & set( + ( + "globalSetPolicyRequestResource", + "project", + "resource", + ) + ) ) @@ -2103,7 +2308,11 @@ def test_set_iam_policy_rest_interceptors(null_interceptor): post.return_value = compute.Policy client.set_iam_policy( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2114,7 +2323,8 @@ def test_set_iam_policy_rest_bad_request( transport: str = "rest", request_type=compute.SetIamPolicyLicenseRequest ): client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2212,7 +2422,8 @@ def test_set_iam_policy_rest_bad_request( def test_set_iam_policy_rest_flattened(): client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2256,7 +2467,8 @@ def test_set_iam_policy_rest_flattened(): def test_set_iam_policy_rest_flattened_error(transport: str = "rest"): client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2279,11 +2491,16 @@ def test_set_iam_policy_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.TestIamPermissionsLicenseRequest, dict,] + "request_type", + [ + compute.TestIamPermissionsLicenseRequest, + dict, + ], ) def test_test_iam_permissions_rest(request_type): client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2352,7 +2569,8 @@ def test_test_iam_permissions_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2394,7 +2612,14 @@ def test_test_iam_permissions_rest_unset_required_fields(): unset_fields = transport.test_iam_permissions._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("project", "resource", "testPermissionsRequestResource",)) + set(()) + & set( + ( + "project", + "resource", + "testPermissionsRequestResource", + ) + ) ) @@ -2440,7 +2665,11 @@ def test_test_iam_permissions_rest_interceptors(null_interceptor): post.return_value = compute.TestPermissionsResponse client.test_iam_permissions( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2451,7 +2680,8 @@ def test_test_iam_permissions_rest_bad_request( transport: str = "rest", request_type=compute.TestIamPermissionsLicenseRequest ): client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2475,7 +2705,8 @@ def test_test_iam_permissions_rest_bad_request( def test_test_iam_permissions_rest_flattened(): client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2519,7 +2750,8 @@ def test_test_iam_permissions_rest_flattened(): def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2548,7 +2780,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2568,7 +2801,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = LicensesClient(client_options=options, transport=transport,) + client = LicensesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2584,7 +2820,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = LicensesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2597,7 +2834,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.LicensesRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.LicensesRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -2654,7 +2896,8 @@ def test_licenses_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.LicensesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2704,7 +2947,12 @@ def test_licenses_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_licenses_host_no_port(transport_name): client = LicensesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2720,7 +2968,12 @@ def test_licenses_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_licenses_host_with_port(transport_name): client = LicensesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2758,7 +3011,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = LicensesClient.common_folder_path(folder) assert expected == actual @@ -2776,7 +3031,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = LicensesClient.common_organization_path(organization) assert expected == actual @@ -2794,7 +3051,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = LicensesClient.common_project_path(project) assert expected == actual @@ -2814,7 +3073,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = LicensesClient.common_location_path(project, location) assert expected == actual @@ -2839,7 +3099,8 @@ def test_client_with_default_client_info(): transports.LicensesTransport, "_prep_wrapped_messages" ) as prep: client = LicensesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2848,7 +3109,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = LicensesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2888,7 +3150,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(LicensesClient, transports.LicensesRestTransport),], + [ + (LicensesClient, transports.LicensesRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_machine_images.py b/tests/unit/gapic/compute_v1/test_machine_images.py index 8cc3a7c7b..9780a16fc 100644 --- a/tests/unit/gapic/compute_v1/test_machine_images.py +++ b/tests/unit/gapic/compute_v1/test_machine_images.py @@ -89,7 +89,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(MachineImagesClient, "rest"),] + "client_class,transport_name", + [ + (MachineImagesClient, "rest"), + ], ) def test_machine_images_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() @@ -110,7 +113,10 @@ def test_machine_images_client_from_service_account_info(client_class, transport @pytest.mark.parametrize( - "transport_class,transport_name", [(transports.MachineImagesRestTransport, "rest"),] + "transport_class,transport_name", + [ + (transports.MachineImagesRestTransport, "rest"), + ], ) def test_machine_images_client_service_account_always_use_jwt( transport_class, transport_name @@ -131,7 +137,10 @@ def test_machine_images_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(MachineImagesClient, "rest"),] + "client_class,transport_name", + [ + (MachineImagesClient, "rest"), + ], ) def test_machine_images_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() @@ -171,7 +180,9 @@ def test_machine_images_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(MachineImagesClient, transports.MachineImagesRestTransport, "rest"),], + [ + (MachineImagesClient, transports.MachineImagesRestTransport, "rest"), + ], ) @mock.patch.object( MachineImagesClient, @@ -454,13 +465,17 @@ def test_machine_images_client_get_mtls_endpoint_and_cert_source(client_class): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(MachineImagesClient, transports.MachineImagesRestTransport, "rest"),], + [ + (MachineImagesClient, transports.MachineImagesRestTransport, "rest"), + ], ) def test_machine_images_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -478,7 +493,9 @@ def test_machine_images_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(MachineImagesClient, transports.MachineImagesRestTransport, "rest", None),], + [ + (MachineImagesClient, transports.MachineImagesRestTransport, "rest", None), + ], ) def test_machine_images_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -501,10 +518,17 @@ def test_machine_images_client_client_options_credentials_file( ) -@pytest.mark.parametrize("request_type", [compute.DeleteMachineImageRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteMachineImageRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -614,7 +638,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -655,7 +680,13 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("machineImage", "project",)) + set(("requestId",)) + & set( + ( + "machineImage", + "project", + ) + ) ) @@ -701,7 +732,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -712,7 +747,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteMachineImageRequest ): client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -733,7 +769,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -745,7 +782,10 @@ def test_delete_unary_rest_flattened(): sample_request = {"project": "sample1", "machine_image": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", machine_image="machine_image_value",) + mock_args = dict( + project="project_value", + machine_image="machine_image_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -771,7 +811,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -790,10 +831,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetMachineImageRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetMachineImageRequest, + dict, + ], +) def test_get_rest(request_type): client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -879,7 +927,8 @@ def test_get_rest_required_fields(request_type=compute.GetMachineImageRequest): assert jsonified_request["project"] == "project_value" client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -919,7 +968,15 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("machineImage", "project",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "machineImage", + "project", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -963,7 +1020,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.MachineImage - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -973,7 +1036,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetMachineImageRequest ): client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -994,7 +1058,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1006,7 +1071,10 @@ def test_get_rest_flattened(): sample_request = {"project": "sample1", "machine_image": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", machine_image="machine_image_value",) + mock_args = dict( + project="project_value", + machine_image="machine_image_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1032,7 +1100,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1052,11 +1121,16 @@ def test_get_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.GetIamPolicyMachineImageRequest, dict,] + "request_type", + [ + compute.GetIamPolicyMachineImageRequest, + dict, + ], ) def test_get_iam_policy_rest(request_type): client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1066,7 +1140,11 @@ def test_get_iam_policy_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = compute.Policy(etag="etag_value", iam_owned=True, version=774,) + return_value = compute.Policy( + etag="etag_value", + iam_owned=True, + version=774, + ) # Wrap the value into a proper Response obj response_value = Response() @@ -1124,7 +1202,8 @@ def test_get_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1165,7 +1244,13 @@ def test_get_iam_policy_rest_unset_required_fields(): unset_fields = transport.get_iam_policy._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("optionsRequestedPolicyVersion",)) & set(("project", "resource",)) + set(("optionsRequestedPolicyVersion",)) + & set( + ( + "project", + "resource", + ) + ) ) @@ -1211,7 +1296,11 @@ def test_get_iam_policy_rest_interceptors(null_interceptor): post.return_value = compute.Policy client.get_iam_policy( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1222,7 +1311,8 @@ def test_get_iam_policy_rest_bad_request( transport: str = "rest", request_type=compute.GetIamPolicyMachineImageRequest ): client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1243,7 +1333,8 @@ def test_get_iam_policy_rest_bad_request( def test_get_iam_policy_rest_flattened(): client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1255,7 +1346,10 @@ def test_get_iam_policy_rest_flattened(): sample_request = {"project": "sample1", "resource": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", resource="resource_value",) + mock_args = dict( + project="project_value", + resource="resource_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1281,7 +1375,8 @@ def test_get_iam_policy_rest_flattened(): def test_get_iam_policy_rest_flattened_error(transport: str = "rest"): client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1300,10 +1395,17 @@ def test_get_iam_policy_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertMachineImageRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertMachineImageRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1611,7 +1713,12 @@ def test_insert_unary_rest_required_fields( credentials=ga_credentials.AnonymousCredentials() ).insert._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("request_id", "source_instance",)) + assert not set(unset_fields) - set( + ( + "request_id", + "source_instance", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -1619,7 +1726,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1661,8 +1769,18 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId", "sourceInstance",)) - & set(("machineImageResource", "project",)) + set( + ( + "requestId", + "sourceInstance", + ) + ) + & set( + ( + "machineImageResource", + "project", + ) + ) ) @@ -1708,7 +1826,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1719,7 +1841,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertMachineImageRequest ): client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1950,7 +2073,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1993,7 +2117,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2014,10 +2139,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListMachineImagesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListMachineImagesRequest, + dict, + ], +) def test_list_rest(request_type): client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2078,7 +2210,13 @@ def test_list_rest_required_fields(request_type=compute.ListMachineImagesRequest ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -2087,7 +2225,8 @@ def test_list_rest_required_fields(request_type=compute.ListMachineImagesRequest assert jsonified_request["project"] == "project_value" client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2128,7 +2267,15 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set(("project",)) ) @@ -2176,7 +2323,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.MachineImageList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2186,7 +2339,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListMachineImagesRequest ): client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2207,7 +2361,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2219,7 +2374,9 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2245,20 +2402,23 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list( - compute.ListMachineImagesRequest(), project="project_value", + compute.ListMachineImagesRequest(), + project="project_value", ) def test_list_rest_pager(transport: str = "rest"): client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2275,12 +2435,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.MachineImageList(items=[], next_page_token="def",), compute.MachineImageList( - items=[compute.MachineImage(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.MachineImageList( - items=[compute.MachineImage(), compute.MachineImage(),], + items=[ + compute.MachineImage(), + ], + next_page_token="ghi", + ), + compute.MachineImageList( + items=[ + compute.MachineImage(), + compute.MachineImage(), + ], ), ) # Two responses for two calls @@ -2308,11 +2477,16 @@ def test_list_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.SetIamPolicyMachineImageRequest, dict,] + "request_type", + [ + compute.SetIamPolicyMachineImageRequest, + dict, + ], ) def test_set_iam_policy_rest(request_type): client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2399,7 +2573,11 @@ def test_set_iam_policy_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = compute.Policy(etag="etag_value", iam_owned=True, version=774,) + return_value = compute.Policy( + etag="etag_value", + iam_owned=True, + version=774, + ) # Wrap the value into a proper Response obj response_value = Response() @@ -2455,7 +2633,8 @@ def test_set_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2497,7 +2676,14 @@ def test_set_iam_policy_rest_unset_required_fields(): unset_fields = transport.set_iam_policy._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("globalSetPolicyRequestResource", "project", "resource",)) + set(()) + & set( + ( + "globalSetPolicyRequestResource", + "project", + "resource", + ) + ) ) @@ -2543,7 +2729,11 @@ def test_set_iam_policy_rest_interceptors(null_interceptor): post.return_value = compute.Policy client.set_iam_policy( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2554,7 +2744,8 @@ def test_set_iam_policy_rest_bad_request( transport: str = "rest", request_type=compute.SetIamPolicyMachineImageRequest ): client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2652,7 +2843,8 @@ def test_set_iam_policy_rest_bad_request( def test_set_iam_policy_rest_flattened(): client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2696,7 +2888,8 @@ def test_set_iam_policy_rest_flattened(): def test_set_iam_policy_rest_flattened_error(transport: str = "rest"): client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2719,11 +2912,16 @@ def test_set_iam_policy_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.TestIamPermissionsMachineImageRequest, dict,] + "request_type", + [ + compute.TestIamPermissionsMachineImageRequest, + dict, + ], ) def test_test_iam_permissions_rest(request_type): client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2792,7 +2990,8 @@ def test_test_iam_permissions_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2834,7 +3033,14 @@ def test_test_iam_permissions_rest_unset_required_fields(): unset_fields = transport.test_iam_permissions._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("project", "resource", "testPermissionsRequestResource",)) + set(()) + & set( + ( + "project", + "resource", + "testPermissionsRequestResource", + ) + ) ) @@ -2882,7 +3088,11 @@ def test_test_iam_permissions_rest_interceptors(null_interceptor): post.return_value = compute.TestPermissionsResponse client.test_iam_permissions( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2893,7 +3103,8 @@ def test_test_iam_permissions_rest_bad_request( transport: str = "rest", request_type=compute.TestIamPermissionsMachineImageRequest ): client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2917,7 +3128,8 @@ def test_test_iam_permissions_rest_bad_request( def test_test_iam_permissions_rest_flattened(): client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2961,7 +3173,8 @@ def test_test_iam_permissions_rest_flattened(): def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2990,7 +3203,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -3010,7 +3224,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = MachineImagesClient(client_options=options, transport=transport,) + client = MachineImagesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -3026,7 +3243,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = MachineImagesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -3039,7 +3257,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.MachineImagesRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.MachineImagesRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -3096,7 +3319,8 @@ def test_machine_images_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.MachineImagesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -3146,7 +3370,12 @@ def test_machine_images_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_machine_images_host_no_port(transport_name): client = MachineImagesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3162,7 +3391,12 @@ def test_machine_images_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_machine_images_host_with_port(transport_name): client = MachineImagesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3200,7 +3434,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = MachineImagesClient.common_folder_path(folder) assert expected == actual @@ -3218,7 +3454,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = MachineImagesClient.common_organization_path(organization) assert expected == actual @@ -3236,7 +3474,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = MachineImagesClient.common_project_path(project) assert expected == actual @@ -3256,7 +3496,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = MachineImagesClient.common_location_path(project, location) assert expected == actual @@ -3281,7 +3522,8 @@ def test_client_with_default_client_info(): transports.MachineImagesTransport, "_prep_wrapped_messages" ) as prep: client = MachineImagesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3290,7 +3532,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = MachineImagesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3330,7 +3573,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(MachineImagesClient, transports.MachineImagesRestTransport),], + [ + (MachineImagesClient, transports.MachineImagesRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_machine_types.py b/tests/unit/gapic/compute_v1/test_machine_types.py index d3e99b52c..b9cd3558a 100644 --- a/tests/unit/gapic/compute_v1/test_machine_types.py +++ b/tests/unit/gapic/compute_v1/test_machine_types.py @@ -85,7 +85,12 @@ def test__get_default_mtls_endpoint(): assert MachineTypesClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class,transport_name", [(MachineTypesClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (MachineTypesClient, "rest"), + ], +) def test_machine_types_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -105,7 +110,10 @@ def test_machine_types_client_from_service_account_info(client_class, transport_ @pytest.mark.parametrize( - "transport_class,transport_name", [(transports.MachineTypesRestTransport, "rest"),] + "transport_class,transport_name", + [ + (transports.MachineTypesRestTransport, "rest"), + ], ) def test_machine_types_client_service_account_always_use_jwt( transport_class, transport_name @@ -125,7 +133,12 @@ def test_machine_types_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class,transport_name", [(MachineTypesClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (MachineTypesClient, "rest"), + ], +) def test_machine_types_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -164,7 +177,9 @@ def test_machine_types_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(MachineTypesClient, transports.MachineTypesRestTransport, "rest"),], + [ + (MachineTypesClient, transports.MachineTypesRestTransport, "rest"), + ], ) @mock.patch.object( MachineTypesClient, "DEFAULT_ENDPOINT", modify_default_endpoint(MachineTypesClient) @@ -441,13 +456,17 @@ def test_machine_types_client_get_mtls_endpoint_and_cert_source(client_class): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(MachineTypesClient, transports.MachineTypesRestTransport, "rest"),], + [ + (MachineTypesClient, transports.MachineTypesRestTransport, "rest"), + ], ) def test_machine_types_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -465,7 +484,9 @@ def test_machine_types_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(MachineTypesClient, transports.MachineTypesRestTransport, "rest", None),], + [ + (MachineTypesClient, transports.MachineTypesRestTransport, "rest", None), + ], ) def test_machine_types_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -489,11 +510,16 @@ def test_machine_types_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.AggregatedListMachineTypesRequest, dict,] + "request_type", + [ + compute.AggregatedListMachineTypesRequest, + dict, + ], ) def test_aggregated_list_rest(request_type): client = MachineTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -574,7 +600,8 @@ def test_aggregated_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = MachineTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -673,7 +700,11 @@ def test_aggregated_list_rest_interceptors(null_interceptor): post.return_value = compute.MachineTypeAggregatedList client.aggregated_list( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -684,7 +715,8 @@ def test_aggregated_list_rest_bad_request( transport: str = "rest", request_type=compute.AggregatedListMachineTypesRequest ): client = MachineTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -705,7 +737,8 @@ def test_aggregated_list_rest_bad_request( def test_aggregated_list_rest_flattened(): client = MachineTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -717,7 +750,9 @@ def test_aggregated_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -743,20 +778,23 @@ def test_aggregated_list_rest_flattened(): def test_aggregated_list_rest_flattened_error(transport: str = "rest"): client = MachineTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.aggregated_list( - compute.AggregatedListMachineTypesRequest(), project="project_value", + compute.AggregatedListMachineTypesRequest(), + project="project_value", ) def test_aggregated_list_rest_pager(transport: str = "rest"): client = MachineTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -773,9 +811,15 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): }, next_page_token="abc", ), - compute.MachineTypeAggregatedList(items={}, next_page_token="def",), compute.MachineTypeAggregatedList( - items={"g": compute.MachineTypesScopedList(),}, next_page_token="ghi", + items={}, + next_page_token="def", + ), + compute.MachineTypeAggregatedList( + items={ + "g": compute.MachineTypesScopedList(), + }, + next_page_token="ghi", ), compute.MachineTypeAggregatedList( items={ @@ -820,10 +864,17 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.GetMachineTypeRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetMachineTypeRequest, + dict, + ], +) def test_get_rest(request_type): client = MachineTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -915,7 +966,8 @@ def test_get_rest_required_fields(request_type=compute.GetMachineTypeRequest): assert jsonified_request["zone"] == "zone_value" client = MachineTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -955,7 +1007,16 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("machineType", "project", "zone",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "machineType", + "project", + "zone", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -999,7 +1060,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.MachineType - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1009,7 +1076,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetMachineTypeRequest ): client = MachineTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1030,7 +1098,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = MachineTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1076,7 +1145,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = MachineTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1096,10 +1166,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListMachineTypesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListMachineTypesRequest, + dict, + ], +) def test_list_rest(request_type): client = MachineTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1162,7 +1239,13 @@ def test_list_rest_required_fields(request_type=compute.ListMachineTypesRequest) ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1173,7 +1256,8 @@ def test_list_rest_required_fields(request_type=compute.ListMachineTypesRequest) assert jsonified_request["zone"] == "zone_value" client = MachineTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1214,8 +1298,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "zone",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "zone", + ) + ) ) @@ -1262,7 +1359,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.MachineTypeList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1272,7 +1375,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListMachineTypesRequest ): client = MachineTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1293,7 +1397,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = MachineTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1305,7 +1410,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "zone": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", zone="zone_value",) + mock_args = dict( + project="project_value", + zone="zone_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1331,7 +1439,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = MachineTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1346,7 +1455,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = MachineTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1363,12 +1473,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.MachineTypeList(items=[], next_page_token="def",), compute.MachineTypeList( - items=[compute.MachineType(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.MachineTypeList( - items=[compute.MachineType(), compute.MachineType(),], + items=[ + compute.MachineType(), + ], + next_page_token="ghi", + ), + compute.MachineTypeList( + items=[ + compute.MachineType(), + compute.MachineType(), + ], ), ) # Two responses for two calls @@ -1402,7 +1521,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = MachineTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1422,7 +1542,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = MachineTypesClient(client_options=options, transport=transport,) + client = MachineTypesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1438,7 +1561,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = MachineTypesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1451,7 +1575,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.MachineTypesRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.MachineTypesRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -1504,7 +1633,8 @@ def test_machine_types_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.MachineTypesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1556,7 +1686,12 @@ def test_machine_types_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_machine_types_host_no_port(transport_name): client = MachineTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1572,7 +1707,12 @@ def test_machine_types_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_machine_types_host_with_port(transport_name): client = MachineTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1610,7 +1750,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = MachineTypesClient.common_folder_path(folder) assert expected == actual @@ -1628,7 +1770,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = MachineTypesClient.common_organization_path(organization) assert expected == actual @@ -1646,7 +1790,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = MachineTypesClient.common_project_path(project) assert expected == actual @@ -1666,7 +1812,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = MachineTypesClient.common_location_path(project, location) assert expected == actual @@ -1691,7 +1838,8 @@ def test_client_with_default_client_info(): transports.MachineTypesTransport, "_prep_wrapped_messages" ) as prep: client = MachineTypesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1700,7 +1848,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = MachineTypesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1740,7 +1889,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(MachineTypesClient, transports.MachineTypesRestTransport),], + [ + (MachineTypesClient, transports.MachineTypesRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_network_endpoint_groups.py b/tests/unit/gapic/compute_v1/test_network_endpoint_groups.py index 51e26b5e1..a2ecf9f83 100644 --- a/tests/unit/gapic/compute_v1/test_network_endpoint_groups.py +++ b/tests/unit/gapic/compute_v1/test_network_endpoint_groups.py @@ -92,7 +92,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(NetworkEndpointGroupsClient, "rest"),] + "client_class,transport_name", + [ + (NetworkEndpointGroupsClient, "rest"), + ], ) def test_network_endpoint_groups_client_from_service_account_info( client_class, transport_name @@ -116,7 +119,9 @@ def test_network_endpoint_groups_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.NetworkEndpointGroupsRestTransport, "rest"),], + [ + (transports.NetworkEndpointGroupsRestTransport, "rest"), + ], ) def test_network_endpoint_groups_client_service_account_always_use_jwt( transport_class, transport_name @@ -137,7 +142,10 @@ def test_network_endpoint_groups_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(NetworkEndpointGroupsClient, "rest"),] + "client_class,transport_name", + [ + (NetworkEndpointGroupsClient, "rest"), + ], ) def test_network_endpoint_groups_client_from_service_account_file( client_class, transport_name @@ -490,7 +498,9 @@ def test_network_endpoint_groups_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -539,11 +549,16 @@ def test_network_endpoint_groups_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.AggregatedListNetworkEndpointGroupsRequest, dict,] + "request_type", + [ + compute.AggregatedListNetworkEndpointGroupsRequest, + dict, + ], ) def test_aggregated_list_rest(request_type): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -626,7 +641,8 @@ def test_aggregated_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -727,7 +743,11 @@ def test_aggregated_list_rest_interceptors(null_interceptor): post.return_value = compute.NetworkEndpointGroupAggregatedList client.aggregated_list( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -739,7 +759,8 @@ def test_aggregated_list_rest_bad_request( request_type=compute.AggregatedListNetworkEndpointGroupsRequest, ): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -760,7 +781,8 @@ def test_aggregated_list_rest_bad_request( def test_aggregated_list_rest_flattened(): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -772,7 +794,9 @@ def test_aggregated_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -800,7 +824,8 @@ def test_aggregated_list_rest_flattened(): def test_aggregated_list_rest_flattened_error(transport: str = "rest"): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -814,7 +839,8 @@ def test_aggregated_list_rest_flattened_error(transport: str = "rest"): def test_aggregated_list_rest_pager(transport: str = "rest"): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -832,10 +858,13 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): next_page_token="abc", ), compute.NetworkEndpointGroupAggregatedList( - items={}, next_page_token="def", + items={}, + next_page_token="def", ), compute.NetworkEndpointGroupAggregatedList( - items={"g": compute.NetworkEndpointGroupsScopedList(),}, + items={ + "g": compute.NetworkEndpointGroupsScopedList(), + }, next_page_token="ghi", ), compute.NetworkEndpointGroupAggregatedList( @@ -884,11 +913,16 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.AttachNetworkEndpointsNetworkEndpointGroupRequest, dict,] + "request_type", + [ + compute.AttachNetworkEndpointsNetworkEndpointGroupRequest, + dict, + ], ) def test_attach_network_endpoints_unary_rest(request_type): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1017,7 +1051,8 @@ def test_attach_network_endpoints_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1113,7 +1148,11 @@ def test_attach_network_endpoints_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.attach_network_endpoints_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1125,7 +1164,8 @@ def test_attach_network_endpoints_unary_rest_bad_request( request_type=compute.AttachNetworkEndpointsNetworkEndpointGroupRequest, ): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1161,7 +1201,8 @@ def test_attach_network_endpoints_unary_rest_bad_request( def test_attach_network_endpoints_unary_rest_flattened(): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1212,7 +1253,8 @@ def test_attach_network_endpoints_unary_rest_flattened(): def test_attach_network_endpoints_unary_rest_flattened_error(transport: str = "rest"): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1238,11 +1280,16 @@ def test_attach_network_endpoints_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.DeleteNetworkEndpointGroupRequest, dict,] + "request_type", + [ + compute.DeleteNetworkEndpointGroupRequest, + dict, + ], ) def test_delete_unary_rest(request_type): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1360,7 +1407,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1401,7 +1449,14 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("networkEndpointGroup", "project", "zone",)) + set(("requestId",)) + & set( + ( + "networkEndpointGroup", + "project", + "zone", + ) + ) ) @@ -1447,7 +1502,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1458,7 +1517,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteNetworkEndpointGroupRequest ): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1483,7 +1543,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1529,7 +1590,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1550,11 +1612,16 @@ def test_delete_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.DetachNetworkEndpointsNetworkEndpointGroupRequest, dict,] + "request_type", + [ + compute.DetachNetworkEndpointsNetworkEndpointGroupRequest, + dict, + ], ) def test_detach_network_endpoints_unary_rest(request_type): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1683,7 +1750,8 @@ def test_detach_network_endpoints_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1779,7 +1847,11 @@ def test_detach_network_endpoints_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.detach_network_endpoints_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1791,7 +1863,8 @@ def test_detach_network_endpoints_unary_rest_bad_request( request_type=compute.DetachNetworkEndpointsNetworkEndpointGroupRequest, ): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1827,7 +1900,8 @@ def test_detach_network_endpoints_unary_rest_bad_request( def test_detach_network_endpoints_unary_rest_flattened(): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1878,7 +1952,8 @@ def test_detach_network_endpoints_unary_rest_flattened(): def test_detach_network_endpoints_unary_rest_flattened_error(transport: str = "rest"): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1904,11 +1979,16 @@ def test_detach_network_endpoints_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.GetNetworkEndpointGroupRequest, dict,] + "request_type", + [ + compute.GetNetworkEndpointGroupRequest, + dict, + ], ) def test_get_rest(request_type): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2006,7 +2086,8 @@ def test_get_rest_required_fields(request_type=compute.GetNetworkEndpointGroupRe assert jsonified_request["zone"] == "zone_value" client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2047,7 +2128,14 @@ def test_get_rest_unset_required_fields(): unset_fields = transport.get._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("networkEndpointGroup", "project", "zone",)) + set(()) + & set( + ( + "networkEndpointGroup", + "project", + "zone", + ) + ) ) @@ -2094,7 +2182,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.NetworkEndpointGroup - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2104,7 +2198,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetNetworkEndpointGroupRequest ): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2129,7 +2224,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2175,7 +2271,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2196,11 +2293,16 @@ def test_get_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.InsertNetworkEndpointGroupRequest, dict,] + "request_type", + [ + compute.InsertNetworkEndpointGroupRequest, + dict, + ], ) def test_insert_unary_rest(request_type): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2338,7 +2440,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2380,7 +2483,14 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("networkEndpointGroupResource", "project", "zone",)) + set(("requestId",)) + & set( + ( + "networkEndpointGroupResource", + "project", + "zone", + ) + ) ) @@ -2426,7 +2536,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2437,7 +2551,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertNetworkEndpointGroupRequest ): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2486,7 +2601,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2530,7 +2646,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2553,11 +2670,16 @@ def test_insert_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.ListNetworkEndpointGroupsRequest, dict,] + "request_type", + [ + compute.ListNetworkEndpointGroupsRequest, + dict, + ], ) def test_list_rest(request_type): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2622,7 +2744,13 @@ def test_list_rest_required_fields( ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -2633,7 +2761,8 @@ def test_list_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2674,8 +2803,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "zone",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "zone", + ) + ) ) @@ -2722,7 +2864,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.NetworkEndpointGroupList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2732,7 +2880,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListNetworkEndpointGroupsRequest ): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2753,7 +2902,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2765,7 +2915,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "zone": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", zone="zone_value",) + mock_args = dict( + project="project_value", + zone="zone_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2791,7 +2944,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2806,7 +2960,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2823,12 +2978,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.NetworkEndpointGroupList(items=[], next_page_token="def",), compute.NetworkEndpointGroupList( - items=[compute.NetworkEndpointGroup(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.NetworkEndpointGroupList( - items=[compute.NetworkEndpointGroup(), compute.NetworkEndpointGroup(),], + items=[ + compute.NetworkEndpointGroup(), + ], + next_page_token="ghi", + ), + compute.NetworkEndpointGroupList( + items=[ + compute.NetworkEndpointGroup(), + compute.NetworkEndpointGroup(), + ], ), ) # Two responses for two calls @@ -2856,11 +3020,16 @@ def test_list_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.ListNetworkEndpointsNetworkEndpointGroupsRequest, dict,] + "request_type", + [ + compute.ListNetworkEndpointsNetworkEndpointGroupsRequest, + dict, + ], ) def test_list_network_endpoints_rest(request_type): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2878,7 +3047,9 @@ def test_list_network_endpoints_rest(request_type): with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. return_value = compute.NetworkEndpointGroupsListNetworkEndpoints( - id="id_value", kind="kind_value", next_page_token="next_page_token_value", + id="id_value", + kind="kind_value", + next_page_token="next_page_token_value", ) # Wrap the value into a proper Response obj @@ -2932,7 +3103,13 @@ def test_list_network_endpoints_rest_required_fields( ).list_network_endpoints._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -2945,7 +3122,8 @@ def test_list_network_endpoints_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2969,8 +3147,8 @@ def test_list_network_endpoints_rest_required_fields( response_value = Response() response_value.status_code = 200 - json_return_value = compute.NetworkEndpointGroupsListNetworkEndpoints.to_json( - return_value + json_return_value = ( + compute.NetworkEndpointGroupsListNetworkEndpoints.to_json(return_value) ) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -2989,7 +3167,15 @@ def test_list_network_endpoints_rest_unset_required_fields(): unset_fields = transport.list_network_endpoints._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set( ( "networkEndpointGroup", @@ -3032,8 +3218,10 @@ def test_list_network_endpoints_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = compute.NetworkEndpointGroupsListNetworkEndpoints.to_json( - compute.NetworkEndpointGroupsListNetworkEndpoints() + req.return_value._content = ( + compute.NetworkEndpointGroupsListNetworkEndpoints.to_json( + compute.NetworkEndpointGroupsListNetworkEndpoints() + ) ) request = compute.ListNetworkEndpointsNetworkEndpointGroupsRequest() @@ -3045,7 +3233,11 @@ def test_list_network_endpoints_rest_interceptors(null_interceptor): post.return_value = compute.NetworkEndpointGroupsListNetworkEndpoints client.list_network_endpoints( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3057,7 +3249,8 @@ def test_list_network_endpoints_rest_bad_request( request_type=compute.ListNetworkEndpointsNetworkEndpointGroupsRequest, ): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3085,7 +3278,8 @@ def test_list_network_endpoints_rest_bad_request( def test_list_network_endpoints_rest_flattened(): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3136,7 +3330,8 @@ def test_list_network_endpoints_rest_flattened(): def test_list_network_endpoints_rest_flattened_error(transport: str = "rest"): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3155,7 +3350,8 @@ def test_list_network_endpoints_rest_flattened_error(transport: str = "rest"): def test_list_network_endpoints_rest_pager(transport: str = "rest"): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -3173,10 +3369,13 @@ def test_list_network_endpoints_rest_pager(transport: str = "rest"): next_page_token="abc", ), compute.NetworkEndpointGroupsListNetworkEndpoints( - items=[], next_page_token="def", + items=[], + next_page_token="def", ), compute.NetworkEndpointGroupsListNetworkEndpoints( - items=[compute.NetworkEndpointWithHealthStatus(),], + items=[ + compute.NetworkEndpointWithHealthStatus(), + ], next_page_token="ghi", ), compute.NetworkEndpointGroupsListNetworkEndpoints( @@ -3225,11 +3424,16 @@ def test_list_network_endpoints_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.TestIamPermissionsNetworkEndpointGroupRequest, dict,] + "request_type", + [ + compute.TestIamPermissionsNetworkEndpointGroupRequest, + dict, + ], ) def test_test_iam_permissions_rest(request_type): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3302,7 +3506,8 @@ def test_test_iam_permissions_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3345,7 +3550,14 @@ def test_test_iam_permissions_rest_unset_required_fields(): unset_fields = transport.test_iam_permissions._get_unset_required_fields({}) assert set(unset_fields) == ( set(()) - & set(("project", "resource", "testPermissionsRequestResource", "zone",)) + & set( + ( + "project", + "resource", + "testPermissionsRequestResource", + "zone", + ) + ) ) @@ -3393,7 +3605,11 @@ def test_test_iam_permissions_rest_interceptors(null_interceptor): post.return_value = compute.TestPermissionsResponse client.test_iam_permissions( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3405,7 +3621,8 @@ def test_test_iam_permissions_rest_bad_request( request_type=compute.TestIamPermissionsNetworkEndpointGroupRequest, ): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3429,7 +3646,8 @@ def test_test_iam_permissions_rest_bad_request( def test_test_iam_permissions_rest_flattened(): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3478,7 +3696,8 @@ def test_test_iam_permissions_rest_flattened(): def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3508,7 +3727,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -3529,7 +3749,8 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = NetworkEndpointGroupsClient( - client_options=options, transport=transport, + client_options=options, + transport=transport, ) # It is an error to provide an api_key and a credential. @@ -3546,7 +3767,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = NetworkEndpointGroupsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -3560,7 +3782,10 @@ def test_transport_instance(): @pytest.mark.parametrize( - "transport_class", [transports.NetworkEndpointGroupsRestTransport,] + "transport_class", + [ + transports.NetworkEndpointGroupsRestTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -3620,7 +3845,8 @@ def test_network_endpoint_groups_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.NetworkEndpointGroupsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -3670,7 +3896,12 @@ def test_network_endpoint_groups_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_network_endpoint_groups_host_no_port(transport_name): client = NetworkEndpointGroupsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3686,7 +3917,12 @@ def test_network_endpoint_groups_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_network_endpoint_groups_host_with_port(transport_name): client = NetworkEndpointGroupsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3724,7 +3960,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = NetworkEndpointGroupsClient.common_folder_path(folder) assert expected == actual @@ -3742,7 +3980,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = NetworkEndpointGroupsClient.common_organization_path(organization) assert expected == actual @@ -3760,7 +4000,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = NetworkEndpointGroupsClient.common_project_path(project) assert expected == actual @@ -3780,7 +4022,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = NetworkEndpointGroupsClient.common_location_path(project, location) assert expected == actual @@ -3805,7 +4048,8 @@ def test_client_with_default_client_info(): transports.NetworkEndpointGroupsTransport, "_prep_wrapped_messages" ) as prep: client = NetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3814,7 +4058,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = NetworkEndpointGroupsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3854,7 +4099,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(NetworkEndpointGroupsClient, transports.NetworkEndpointGroupsRestTransport),], + [ + (NetworkEndpointGroupsClient, transports.NetworkEndpointGroupsRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_networks.py b/tests/unit/gapic/compute_v1/test_networks.py index 149692a7b..9b0abd0c3 100644 --- a/tests/unit/gapic/compute_v1/test_networks.py +++ b/tests/unit/gapic/compute_v1/test_networks.py @@ -83,7 +83,12 @@ def test__get_default_mtls_endpoint(): assert NetworksClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class,transport_name", [(NetworksClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (NetworksClient, "rest"), + ], +) def test_networks_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -103,7 +108,10 @@ def test_networks_client_from_service_account_info(client_class, transport_name) @pytest.mark.parametrize( - "transport_class,transport_name", [(transports.NetworksRestTransport, "rest"),] + "transport_class,transport_name", + [ + (transports.NetworksRestTransport, "rest"), + ], ) def test_networks_client_service_account_always_use_jwt( transport_class, transport_name @@ -123,7 +131,12 @@ def test_networks_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class,transport_name", [(NetworksClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (NetworksClient, "rest"), + ], +) def test_networks_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -162,7 +175,9 @@ def test_networks_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(NetworksClient, transports.NetworksRestTransport, "rest"),], + [ + (NetworksClient, transports.NetworksRestTransport, "rest"), + ], ) @mock.patch.object( NetworksClient, "DEFAULT_ENDPOINT", modify_default_endpoint(NetworksClient) @@ -437,13 +452,17 @@ def test_networks_client_get_mtls_endpoint_and_cert_source(client_class): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(NetworksClient, transports.NetworksRestTransport, "rest"),], + [ + (NetworksClient, transports.NetworksRestTransport, "rest"), + ], ) def test_networks_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -461,7 +480,9 @@ def test_networks_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(NetworksClient, transports.NetworksRestTransport, "rest", None),], + [ + (NetworksClient, transports.NetworksRestTransport, "rest", None), + ], ) def test_networks_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -484,10 +505,17 @@ def test_networks_client_client_options_credentials_file( ) -@pytest.mark.parametrize("request_type", [compute.AddPeeringNetworkRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.AddPeeringNetworkRequest, + dict, + ], +) def test_add_peering_unary_rest(request_type): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -615,7 +643,8 @@ def test_add_peering_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -658,7 +687,13 @@ def test_add_peering_unary_rest_unset_required_fields(): unset_fields = transport.add_peering._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("network", "networksAddPeeringRequestResource", "project",)) + & set( + ( + "network", + "networksAddPeeringRequestResource", + "project", + ) + ) ) @@ -702,7 +737,11 @@ def test_add_peering_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.add_peering_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -713,7 +752,8 @@ def test_add_peering_unary_rest_bad_request( transport: str = "rest", request_type=compute.AddPeeringNetworkRequest ): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -752,7 +792,8 @@ def test_add_peering_unary_rest_bad_request( def test_add_peering_unary_rest_flattened(): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -796,7 +837,8 @@ def test_add_peering_unary_rest_flattened(): def test_add_peering_unary_rest_flattened_error(transport: str = "rest"): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -818,10 +860,17 @@ def test_add_peering_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.DeleteNetworkRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteNetworkRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -929,7 +978,8 @@ def test_delete_unary_rest_required_fields(request_type=compute.DeleteNetworkReq assert jsonified_request["project"] == "project_value" client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -969,7 +1019,15 @@ def test_delete_unary_rest_unset_required_fields(): ) unset_fields = transport.delete._get_unset_required_fields({}) - assert set(unset_fields) == (set(("requestId",)) & set(("network", "project",))) + assert set(unset_fields) == ( + set(("requestId",)) + & set( + ( + "network", + "project", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1012,7 +1070,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1023,7 +1085,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteNetworkRequest ): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1044,7 +1107,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1056,7 +1120,10 @@ def test_delete_unary_rest_flattened(): sample_request = {"project": "sample1", "network": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", network="network_value",) + mock_args = dict( + project="project_value", + network="network_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1082,7 +1149,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1101,10 +1169,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetNetworkRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetNetworkRequest, + dict, + ], +) def test_get_rest(request_type): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1188,7 +1263,8 @@ def test_get_rest_required_fields(request_type=compute.GetNetworkRequest): assert jsonified_request["project"] == "project_value" client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1228,7 +1304,15 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("network", "project",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "network", + "project", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1270,7 +1354,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Network - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1280,7 +1370,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetNetworkRequest ): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1301,7 +1392,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1313,7 +1405,10 @@ def test_get_rest_flattened(): sample_request = {"project": "sample1", "network": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", network="network_value",) + mock_args = dict( + project="project_value", + network="network_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1339,7 +1434,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1359,11 +1455,16 @@ def test_get_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.GetEffectiveFirewallsNetworkRequest, dict,] + "request_type", + [ + compute.GetEffectiveFirewallsNetworkRequest, + dict, + ], ) def test_get_effective_firewalls_rest(request_type): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1428,7 +1529,8 @@ def test_get_effective_firewalls_rest_required_fields( assert jsonified_request["project"] == "project_value" client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1470,7 +1572,15 @@ def test_get_effective_firewalls_rest_unset_required_fields(): ) unset_fields = transport.get_effective_firewalls._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("network", "project",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "network", + "project", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1502,8 +1612,10 @@ def test_get_effective_firewalls_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = compute.NetworksGetEffectiveFirewallsResponse.to_json( - compute.NetworksGetEffectiveFirewallsResponse() + req.return_value._content = ( + compute.NetworksGetEffectiveFirewallsResponse.to_json( + compute.NetworksGetEffectiveFirewallsResponse() + ) ) request = compute.GetEffectiveFirewallsNetworkRequest() @@ -1515,7 +1627,11 @@ def test_get_effective_firewalls_rest_interceptors(null_interceptor): post.return_value = compute.NetworksGetEffectiveFirewallsResponse client.get_effective_firewalls( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1526,7 +1642,8 @@ def test_get_effective_firewalls_rest_bad_request( transport: str = "rest", request_type=compute.GetEffectiveFirewallsNetworkRequest ): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1547,7 +1664,8 @@ def test_get_effective_firewalls_rest_bad_request( def test_get_effective_firewalls_rest_flattened(): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1559,7 +1677,10 @@ def test_get_effective_firewalls_rest_flattened(): sample_request = {"project": "sample1", "network": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", network="network_value",) + mock_args = dict( + project="project_value", + network="network_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1587,7 +1708,8 @@ def test_get_effective_firewalls_rest_flattened(): def test_get_effective_firewalls_rest_flattened_error(transport: str = "rest"): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1606,10 +1728,17 @@ def test_get_effective_firewalls_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertNetworkRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertNetworkRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1742,7 +1871,8 @@ def test_insert_unary_rest_required_fields(request_type=compute.InsertNetworkReq assert jsonified_request["project"] == "project_value" client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1784,7 +1914,13 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("networkResource", "project",)) + set(("requestId",)) + & set( + ( + "networkResource", + "project", + ) + ) ) @@ -1828,7 +1964,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1839,7 +1979,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertNetworkRequest ): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1889,7 +2030,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1929,7 +2071,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1948,10 +2091,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListNetworksRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListNetworksRequest, + dict, + ], +) def test_list_rest(request_type): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2012,7 +2162,13 @@ def test_list_rest_required_fields(request_type=compute.ListNetworksRequest): ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -2021,7 +2177,8 @@ def test_list_rest_required_fields(request_type=compute.ListNetworksRequest): assert jsonified_request["project"] == "project_value" client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2062,7 +2219,15 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set(("project",)) ) @@ -2106,7 +2271,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.NetworkList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2116,7 +2287,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListNetworksRequest ): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2137,7 +2309,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2149,7 +2322,9 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2174,20 +2349,23 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list( - compute.ListNetworksRequest(), project="project_value", + compute.ListNetworksRequest(), + project="project_value", ) def test_list_rest_pager(transport: str = "rest"): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2197,12 +2375,29 @@ def test_list_rest_pager(transport: str = "rest"): # Set the response as a series of pages response = ( compute.NetworkList( - items=[compute.Network(), compute.Network(), compute.Network(),], + items=[ + compute.Network(), + compute.Network(), + compute.Network(), + ], next_page_token="abc", ), - compute.NetworkList(items=[], next_page_token="def",), - compute.NetworkList(items=[compute.Network(),], next_page_token="ghi",), - compute.NetworkList(items=[compute.Network(), compute.Network(),],), + compute.NetworkList( + items=[], + next_page_token="def", + ), + compute.NetworkList( + items=[ + compute.Network(), + ], + next_page_token="ghi", + ), + compute.NetworkList( + items=[ + compute.Network(), + compute.Network(), + ], + ), ) # Two responses for two calls response = response + response @@ -2229,11 +2424,16 @@ def test_list_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.ListPeeringRoutesNetworksRequest, dict,] + "request_type", + [ + compute.ListPeeringRoutesNetworksRequest, + dict, + ], ) def test_list_peering_routes_rest(request_type): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2318,7 +2518,8 @@ def test_list_peering_routes_rest_required_fields( assert jsonified_request["project"] == "project_value" client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2371,7 +2572,12 @@ def test_list_peering_routes_rest_unset_required_fields(): "returnPartialSuccess", ) ) - & set(("network", "project",)) + & set( + ( + "network", + "project", + ) + ) ) @@ -2417,7 +2623,11 @@ def test_list_peering_routes_rest_interceptors(null_interceptor): post.return_value = compute.ExchangedPeeringRoutesList client.list_peering_routes( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2428,7 +2638,8 @@ def test_list_peering_routes_rest_bad_request( transport: str = "rest", request_type=compute.ListPeeringRoutesNetworksRequest ): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2449,7 +2660,8 @@ def test_list_peering_routes_rest_bad_request( def test_list_peering_routes_rest_flattened(): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2461,7 +2673,10 @@ def test_list_peering_routes_rest_flattened(): sample_request = {"project": "sample1", "network": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", network="network_value",) + mock_args = dict( + project="project_value", + network="network_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2487,7 +2702,8 @@ def test_list_peering_routes_rest_flattened(): def test_list_peering_routes_rest_flattened_error(transport: str = "rest"): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2502,7 +2718,8 @@ def test_list_peering_routes_rest_flattened_error(transport: str = "rest"): def test_list_peering_routes_rest_pager(transport: str = "rest"): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2519,9 +2736,15 @@ def test_list_peering_routes_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.ExchangedPeeringRoutesList(items=[], next_page_token="def",), compute.ExchangedPeeringRoutesList( - items=[compute.ExchangedPeeringRoute(),], next_page_token="ghi", + items=[], + next_page_token="def", + ), + compute.ExchangedPeeringRoutesList( + items=[ + compute.ExchangedPeeringRoute(), + ], + next_page_token="ghi", ), compute.ExchangedPeeringRoutesList( items=[ @@ -2556,10 +2779,17 @@ def test_list_peering_routes_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.PatchNetworkRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.PatchNetworkRequest, + dict, + ], +) def test_patch_unary_rest(request_type): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2696,7 +2926,8 @@ def test_patch_unary_rest_required_fields(request_type=compute.PatchNetworkReque assert jsonified_request["project"] == "project_value" client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2738,7 +2969,14 @@ def test_patch_unary_rest_unset_required_fields(): unset_fields = transport.patch._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("network", "networkResource", "project",)) + set(("requestId",)) + & set( + ( + "network", + "networkResource", + "project", + ) + ) ) @@ -2781,7 +3019,13 @@ def test_patch_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.patch_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2791,7 +3035,8 @@ def test_patch_unary_rest_bad_request( transport: str = "rest", request_type=compute.PatchNetworkRequest ): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2841,7 +3086,8 @@ def test_patch_unary_rest_bad_request( def test_patch_unary_rest_flattened(): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2883,7 +3129,8 @@ def test_patch_unary_rest_flattened(): def test_patch_unary_rest_flattened_error(transport: str = "rest"): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2903,10 +3150,17 @@ def test_patch_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.RemovePeeringNetworkRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.RemovePeeringNetworkRequest, + dict, + ], +) def test_remove_peering_unary_rest(request_type): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3017,7 +3271,8 @@ def test_remove_peering_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3060,7 +3315,13 @@ def test_remove_peering_unary_rest_unset_required_fields(): unset_fields = transport.remove_peering._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("network", "networksRemovePeeringRequestResource", "project",)) + & set( + ( + "network", + "networksRemovePeeringRequestResource", + "project", + ) + ) ) @@ -3104,7 +3365,11 @@ def test_remove_peering_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.remove_peering_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3115,7 +3380,8 @@ def test_remove_peering_unary_rest_bad_request( transport: str = "rest", request_type=compute.RemovePeeringNetworkRequest ): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3137,7 +3403,8 @@ def test_remove_peering_unary_rest_bad_request( def test_remove_peering_unary_rest_flattened(): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3181,7 +3448,8 @@ def test_remove_peering_unary_rest_flattened(): def test_remove_peering_unary_rest_flattened_error(transport: str = "rest"): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3204,11 +3472,16 @@ def test_remove_peering_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SwitchToCustomModeNetworkRequest, dict,] + "request_type", + [ + compute.SwitchToCustomModeNetworkRequest, + dict, + ], ) def test_switch_to_custom_mode_unary_rest(request_type): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3318,7 +3591,8 @@ def test_switch_to_custom_mode_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3358,7 +3632,15 @@ def test_switch_to_custom_mode_unary_rest_unset_required_fields(): ) unset_fields = transport.switch_to_custom_mode._get_unset_required_fields({}) - assert set(unset_fields) == (set(("requestId",)) & set(("network", "project",))) + assert set(unset_fields) == ( + set(("requestId",)) + & set( + ( + "network", + "project", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -3401,7 +3683,11 @@ def test_switch_to_custom_mode_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.switch_to_custom_mode_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3412,7 +3698,8 @@ def test_switch_to_custom_mode_unary_rest_bad_request( transport: str = "rest", request_type=compute.SwitchToCustomModeNetworkRequest ): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3433,7 +3720,8 @@ def test_switch_to_custom_mode_unary_rest_bad_request( def test_switch_to_custom_mode_unary_rest_flattened(): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3445,7 +3733,10 @@ def test_switch_to_custom_mode_unary_rest_flattened(): sample_request = {"project": "sample1", "network": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", network="network_value",) + mock_args = dict( + project="project_value", + network="network_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -3471,7 +3762,8 @@ def test_switch_to_custom_mode_unary_rest_flattened(): def test_switch_to_custom_mode_unary_rest_flattened_error(transport: str = "rest"): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3490,10 +3782,17 @@ def test_switch_to_custom_mode_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.UpdatePeeringNetworkRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.UpdatePeeringNetworkRequest, + dict, + ], +) def test_update_peering_unary_rest(request_type): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3618,7 +3917,8 @@ def test_update_peering_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3661,7 +3961,13 @@ def test_update_peering_unary_rest_unset_required_fields(): unset_fields = transport.update_peering._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("network", "networksUpdatePeeringRequestResource", "project",)) + & set( + ( + "network", + "networksUpdatePeeringRequestResource", + "project", + ) + ) ) @@ -3705,7 +4011,11 @@ def test_update_peering_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.update_peering_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3716,7 +4026,8 @@ def test_update_peering_unary_rest_bad_request( transport: str = "rest", request_type=compute.UpdatePeeringNetworkRequest ): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3752,7 +4063,8 @@ def test_update_peering_unary_rest_bad_request( def test_update_peering_unary_rest_flattened(): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3796,7 +4108,8 @@ def test_update_peering_unary_rest_flattened(): def test_update_peering_unary_rest_flattened_error(transport: str = "rest"): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3825,7 +4138,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -3845,7 +4159,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = NetworksClient(client_options=options, transport=transport,) + client = NetworksClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -3861,7 +4178,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = NetworksClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -3874,7 +4192,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.NetworksRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.NetworksRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -3935,7 +4258,8 @@ def test_networks_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.NetworksTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -3985,7 +4309,12 @@ def test_networks_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_networks_host_no_port(transport_name): client = NetworksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4001,7 +4330,12 @@ def test_networks_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_networks_host_with_port(transport_name): client = NetworksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4039,7 +4373,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = NetworksClient.common_folder_path(folder) assert expected == actual @@ -4057,7 +4393,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = NetworksClient.common_organization_path(organization) assert expected == actual @@ -4075,7 +4413,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = NetworksClient.common_project_path(project) assert expected == actual @@ -4095,7 +4435,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = NetworksClient.common_location_path(project, location) assert expected == actual @@ -4120,7 +4461,8 @@ def test_client_with_default_client_info(): transports.NetworksTransport, "_prep_wrapped_messages" ) as prep: client = NetworksClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4129,7 +4471,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = NetworksClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4169,7 +4512,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(NetworksClient, transports.NetworksRestTransport),], + [ + (NetworksClient, transports.NetworksRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_node_groups.py b/tests/unit/gapic/compute_v1/test_node_groups.py index cabdee16a..946143c97 100644 --- a/tests/unit/gapic/compute_v1/test_node_groups.py +++ b/tests/unit/gapic/compute_v1/test_node_groups.py @@ -85,7 +85,12 @@ def test__get_default_mtls_endpoint(): assert NodeGroupsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class,transport_name", [(NodeGroupsClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (NodeGroupsClient, "rest"), + ], +) def test_node_groups_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -105,7 +110,10 @@ def test_node_groups_client_from_service_account_info(client_class, transport_na @pytest.mark.parametrize( - "transport_class,transport_name", [(transports.NodeGroupsRestTransport, "rest"),] + "transport_class,transport_name", + [ + (transports.NodeGroupsRestTransport, "rest"), + ], ) def test_node_groups_client_service_account_always_use_jwt( transport_class, transport_name @@ -125,7 +133,12 @@ def test_node_groups_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class,transport_name", [(NodeGroupsClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (NodeGroupsClient, "rest"), + ], +) def test_node_groups_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -164,7 +177,9 @@ def test_node_groups_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(NodeGroupsClient, transports.NodeGroupsRestTransport, "rest"),], + [ + (NodeGroupsClient, transports.NodeGroupsRestTransport, "rest"), + ], ) @mock.patch.object( NodeGroupsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(NodeGroupsClient) @@ -441,13 +456,17 @@ def test_node_groups_client_get_mtls_endpoint_and_cert_source(client_class): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(NodeGroupsClient, transports.NodeGroupsRestTransport, "rest"),], + [ + (NodeGroupsClient, transports.NodeGroupsRestTransport, "rest"), + ], ) def test_node_groups_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -465,7 +484,9 @@ def test_node_groups_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(NodeGroupsClient, transports.NodeGroupsRestTransport, "rest", None),], + [ + (NodeGroupsClient, transports.NodeGroupsRestTransport, "rest", None), + ], ) def test_node_groups_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -488,10 +509,17 @@ def test_node_groups_client_client_options_credentials_file( ) -@pytest.mark.parametrize("request_type", [compute.AddNodesNodeGroupRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.AddNodesNodeGroupRequest, + dict, + ], +) def test_add_nodes_unary_rest(request_type): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -608,7 +636,8 @@ def test_add_nodes_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -651,7 +680,14 @@ def test_add_nodes_unary_rest_unset_required_fields(): unset_fields = transport.add_nodes._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("nodeGroup", "nodeGroupsAddNodesRequestResource", "project", "zone",)) + & set( + ( + "nodeGroup", + "nodeGroupsAddNodesRequestResource", + "project", + "zone", + ) + ) ) @@ -697,7 +733,11 @@ def test_add_nodes_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.add_nodes_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -708,7 +748,8 @@ def test_add_nodes_unary_rest_bad_request( transport: str = "rest", request_type=compute.AddNodesNodeGroupRequest ): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -732,7 +773,8 @@ def test_add_nodes_unary_rest_bad_request( def test_add_nodes_unary_rest_flattened(): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -781,7 +823,8 @@ def test_add_nodes_unary_rest_flattened(): def test_add_nodes_unary_rest_flattened_error(transport: str = "rest"): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -805,11 +848,16 @@ def test_add_nodes_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.AggregatedListNodeGroupsRequest, dict,] + "request_type", + [ + compute.AggregatedListNodeGroupsRequest, + dict, + ], ) def test_aggregated_list_rest(request_type): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -890,7 +938,8 @@ def test_aggregated_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -989,7 +1038,11 @@ def test_aggregated_list_rest_interceptors(null_interceptor): post.return_value = compute.NodeGroupAggregatedList client.aggregated_list( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1000,7 +1053,8 @@ def test_aggregated_list_rest_bad_request( transport: str = "rest", request_type=compute.AggregatedListNodeGroupsRequest ): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1021,7 +1075,8 @@ def test_aggregated_list_rest_bad_request( def test_aggregated_list_rest_flattened(): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1033,7 +1088,9 @@ def test_aggregated_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1059,20 +1116,23 @@ def test_aggregated_list_rest_flattened(): def test_aggregated_list_rest_flattened_error(transport: str = "rest"): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.aggregated_list( - compute.AggregatedListNodeGroupsRequest(), project="project_value", + compute.AggregatedListNodeGroupsRequest(), + project="project_value", ) def test_aggregated_list_rest_pager(transport: str = "rest"): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1089,9 +1149,15 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): }, next_page_token="abc", ), - compute.NodeGroupAggregatedList(items={}, next_page_token="def",), compute.NodeGroupAggregatedList( - items={"g": compute.NodeGroupsScopedList(),}, next_page_token="ghi", + items={}, + next_page_token="def", + ), + compute.NodeGroupAggregatedList( + items={ + "g": compute.NodeGroupsScopedList(), + }, + next_page_token="ghi", ), compute.NodeGroupAggregatedList( items={ @@ -1133,10 +1199,17 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.DeleteNodeGroupRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteNodeGroupRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1248,7 +1321,8 @@ def test_delete_unary_rest_required_fields(request_type=compute.DeleteNodeGroupR assert jsonified_request["zone"] == "zone_value" client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1289,7 +1363,14 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("nodeGroup", "project", "zone",)) + set(("requestId",)) + & set( + ( + "nodeGroup", + "project", + "zone", + ) + ) ) @@ -1335,7 +1416,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1346,7 +1431,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteNodeGroupRequest ): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1367,7 +1453,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1384,7 +1471,9 @@ def test_delete_unary_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", zone="zone_value", node_group="node_group_value", + project="project_value", + zone="zone_value", + node_group="node_group_value", ) mock_args.update(sample_request) @@ -1411,7 +1500,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1431,10 +1521,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.DeleteNodesNodeGroupRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteNodesNodeGroupRequest, + dict, + ], +) def test_delete_nodes_unary_rest(request_type): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1551,7 +1648,8 @@ def test_delete_nodes_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1594,7 +1692,14 @@ def test_delete_nodes_unary_rest_unset_required_fields(): unset_fields = transport.delete_nodes._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("nodeGroup", "nodeGroupsDeleteNodesRequestResource", "project", "zone",)) + & set( + ( + "nodeGroup", + "nodeGroupsDeleteNodesRequestResource", + "project", + "zone", + ) + ) ) @@ -1640,7 +1745,11 @@ def test_delete_nodes_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_nodes_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1651,7 +1760,8 @@ def test_delete_nodes_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteNodesNodeGroupRequest ): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1675,7 +1785,8 @@ def test_delete_nodes_unary_rest_bad_request( def test_delete_nodes_unary_rest_flattened(): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1724,7 +1835,8 @@ def test_delete_nodes_unary_rest_flattened(): def test_delete_nodes_unary_rest_flattened_error(transport: str = "rest"): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1747,10 +1859,17 @@ def test_delete_nodes_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetNodeGroupRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetNodeGroupRequest, + dict, + ], +) def test_get_rest(request_type): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1842,7 +1961,8 @@ def test_get_rest_required_fields(request_type=compute.GetNodeGroupRequest): assert jsonified_request["zone"] == "zone_value" client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1882,7 +2002,16 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("nodeGroup", "project", "zone",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "nodeGroup", + "project", + "zone", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1926,7 +2055,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.NodeGroup - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1936,7 +2071,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetNodeGroupRequest ): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1957,7 +2093,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1974,7 +2111,9 @@ def test_get_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", zone="zone_value", node_group="node_group_value", + project="project_value", + zone="zone_value", + node_group="node_group_value", ) mock_args.update(sample_request) @@ -2001,7 +2140,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2021,10 +2161,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetIamPolicyNodeGroupRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetIamPolicyNodeGroupRequest, + dict, + ], +) def test_get_iam_policy_rest(request_type): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2034,7 +2181,11 @@ def test_get_iam_policy_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = compute.Policy(etag="etag_value", iam_owned=True, version=774,) + return_value = compute.Policy( + etag="etag_value", + iam_owned=True, + version=774, + ) # Wrap the value into a proper Response obj response_value = Response() @@ -2096,7 +2247,8 @@ def test_get_iam_policy_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2137,7 +2289,14 @@ def test_get_iam_policy_rest_unset_required_fields(): unset_fields = transport.get_iam_policy._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("optionsRequestedPolicyVersion",)) & set(("project", "resource", "zone",)) + set(("optionsRequestedPolicyVersion",)) + & set( + ( + "project", + "resource", + "zone", + ) + ) ) @@ -2183,7 +2342,11 @@ def test_get_iam_policy_rest_interceptors(null_interceptor): post.return_value = compute.Policy client.get_iam_policy( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2194,7 +2357,8 @@ def test_get_iam_policy_rest_bad_request( transport: str = "rest", request_type=compute.GetIamPolicyNodeGroupRequest ): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2215,7 +2379,8 @@ def test_get_iam_policy_rest_bad_request( def test_get_iam_policy_rest_flattened(): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2232,7 +2397,9 @@ def test_get_iam_policy_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", zone="zone_value", resource="resource_value", + project="project_value", + zone="zone_value", + resource="resource_value", ) mock_args.update(sample_request) @@ -2259,7 +2426,8 @@ def test_get_iam_policy_rest_flattened(): def test_get_iam_policy_rest_flattened_error(transport: str = "rest"): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2279,10 +2447,17 @@ def test_get_iam_policy_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertNodeGroupRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertNodeGroupRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2409,7 +2584,12 @@ def test_insert_unary_rest_required_fields(request_type=compute.InsertNodeGroupR credentials=ga_credentials.AnonymousCredentials() ).insert._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("initial_node_count", "request_id",)) + assert not set(unset_fields) - set( + ( + "initial_node_count", + "request_id", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -2421,7 +2601,8 @@ def test_insert_unary_rest_required_fields(request_type=compute.InsertNodeGroupR assert jsonified_request["zone"] == "zone_value" client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2452,7 +2633,10 @@ def test_insert_unary_rest_required_fields(request_type=compute.InsertNodeGroupR response = client.insert_unary(request) expected_params = [ - ("initialNodeCount", 0,), + ( + "initialNodeCount", + 0, + ), ] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -2465,8 +2649,20 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("initialNodeCount", "requestId",)) - & set(("initialNodeCount", "nodeGroupResource", "project", "zone",)) + set( + ( + "initialNodeCount", + "requestId", + ) + ) + & set( + ( + "initialNodeCount", + "nodeGroupResource", + "project", + "zone", + ) + ) ) @@ -2512,7 +2708,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2523,7 +2723,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertNodeGroupRequest ): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2568,7 +2769,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2613,7 +2815,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2636,10 +2839,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListNodeGroupsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListNodeGroupsRequest, + dict, + ], +) def test_list_rest(request_type): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2702,7 +2912,13 @@ def test_list_rest_required_fields(request_type=compute.ListNodeGroupsRequest): ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -2713,7 +2929,8 @@ def test_list_rest_required_fields(request_type=compute.ListNodeGroupsRequest): assert jsonified_request["zone"] == "zone_value" client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2754,8 +2971,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "zone",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "zone", + ) + ) ) @@ -2802,7 +3032,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.NodeGroupList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2812,7 +3048,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListNodeGroupsRequest ): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2833,7 +3070,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2845,7 +3083,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "zone": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", zone="zone_value",) + mock_args = dict( + project="project_value", + zone="zone_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2871,20 +3112,24 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list( - compute.ListNodeGroupsRequest(), project="project_value", zone="zone_value", + compute.ListNodeGroupsRequest(), + project="project_value", + zone="zone_value", ) def test_list_rest_pager(transport: str = "rest"): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2894,12 +3139,29 @@ def test_list_rest_pager(transport: str = "rest"): # Set the response as a series of pages response = ( compute.NodeGroupList( - items=[compute.NodeGroup(), compute.NodeGroup(), compute.NodeGroup(),], + items=[ + compute.NodeGroup(), + compute.NodeGroup(), + compute.NodeGroup(), + ], next_page_token="abc", ), - compute.NodeGroupList(items=[], next_page_token="def",), - compute.NodeGroupList(items=[compute.NodeGroup(),], next_page_token="ghi",), - compute.NodeGroupList(items=[compute.NodeGroup(), compute.NodeGroup(),],), + compute.NodeGroupList( + items=[], + next_page_token="def", + ), + compute.NodeGroupList( + items=[ + compute.NodeGroup(), + ], + next_page_token="ghi", + ), + compute.NodeGroupList( + items=[ + compute.NodeGroup(), + compute.NodeGroup(), + ], + ), ) # Two responses for two calls response = response + response @@ -2925,10 +3187,17 @@ def test_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.ListNodesNodeGroupsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListNodesNodeGroupsRequest, + dict, + ], +) def test_list_nodes_rest(request_type): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2995,7 +3264,13 @@ def test_list_nodes_rest_required_fields( ).list_nodes._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -3008,7 +3283,8 @@ def test_list_nodes_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3049,8 +3325,22 @@ def test_list_nodes_rest_unset_required_fields(): unset_fields = transport.list_nodes._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("nodeGroup", "project", "zone",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "nodeGroup", + "project", + "zone", + ) + ) ) @@ -3097,7 +3387,13 @@ def test_list_nodes_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.NodeGroupsListNodes - client.list_nodes(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list_nodes( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -3107,7 +3403,8 @@ def test_list_nodes_rest_bad_request( transport: str = "rest", request_type=compute.ListNodesNodeGroupsRequest ): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3128,7 +3425,8 @@ def test_list_nodes_rest_bad_request( def test_list_nodes_rest_flattened(): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3145,7 +3443,9 @@ def test_list_nodes_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", zone="zone_value", node_group="node_group_value", + project="project_value", + zone="zone_value", + node_group="node_group_value", ) mock_args.update(sample_request) @@ -3172,7 +3472,8 @@ def test_list_nodes_rest_flattened(): def test_list_nodes_rest_flattened_error(transport: str = "rest"): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3188,7 +3489,8 @@ def test_list_nodes_rest_flattened_error(transport: str = "rest"): def test_list_nodes_rest_pager(transport: str = "rest"): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -3205,12 +3507,21 @@ def test_list_nodes_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.NodeGroupsListNodes(items=[], next_page_token="def",), compute.NodeGroupsListNodes( - items=[compute.NodeGroupNode(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.NodeGroupsListNodes( - items=[compute.NodeGroupNode(), compute.NodeGroupNode(),], + items=[ + compute.NodeGroupNode(), + ], + next_page_token="ghi", + ), + compute.NodeGroupsListNodes( + items=[ + compute.NodeGroupNode(), + compute.NodeGroupNode(), + ], ), ) # Two responses for two calls @@ -3241,10 +3552,17 @@ def test_list_nodes_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.PatchNodeGroupRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.PatchNodeGroupRequest, + dict, + ], +) def test_patch_unary_rest(request_type): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3380,7 +3698,8 @@ def test_patch_unary_rest_required_fields(request_type=compute.PatchNodeGroupReq assert jsonified_request["zone"] == "zone_value" client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3423,7 +3742,14 @@ def test_patch_unary_rest_unset_required_fields(): unset_fields = transport.patch._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("nodeGroup", "nodeGroupResource", "project", "zone",)) + & set( + ( + "nodeGroup", + "nodeGroupResource", + "project", + "zone", + ) + ) ) @@ -3468,7 +3794,13 @@ def test_patch_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.patch_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -3478,7 +3810,8 @@ def test_patch_unary_rest_bad_request( transport: str = "rest", request_type=compute.PatchNodeGroupRequest ): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3523,7 +3856,8 @@ def test_patch_unary_rest_bad_request( def test_patch_unary_rest_flattened(): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3572,7 +3906,8 @@ def test_patch_unary_rest_flattened(): def test_patch_unary_rest_flattened_error(transport: str = "rest"): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3595,10 +3930,17 @@ def test_patch_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.SetIamPolicyNodeGroupRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.SetIamPolicyNodeGroupRequest, + dict, + ], +) def test_set_iam_policy_rest(request_type): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3685,7 +4027,11 @@ def test_set_iam_policy_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = compute.Policy(etag="etag_value", iam_owned=True, version=774,) + return_value = compute.Policy( + etag="etag_value", + iam_owned=True, + version=774, + ) # Wrap the value into a proper Response obj response_value = Response() @@ -3745,7 +4091,8 @@ def test_set_iam_policy_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3787,7 +4134,15 @@ def test_set_iam_policy_rest_unset_required_fields(): unset_fields = transport.set_iam_policy._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("project", "resource", "zone", "zoneSetPolicyRequestResource",)) + set(()) + & set( + ( + "project", + "resource", + "zone", + "zoneSetPolicyRequestResource", + ) + ) ) @@ -3833,7 +4188,11 @@ def test_set_iam_policy_rest_interceptors(null_interceptor): post.return_value = compute.Policy client.set_iam_policy( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3844,7 +4203,8 @@ def test_set_iam_policy_rest_bad_request( transport: str = "rest", request_type=compute.SetIamPolicyNodeGroupRequest ): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3942,7 +4302,8 @@ def test_set_iam_policy_rest_bad_request( def test_set_iam_policy_rest_flattened(): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3991,7 +4352,8 @@ def test_set_iam_policy_rest_flattened(): def test_set_iam_policy_rest_flattened_error(transport: str = "rest"): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -4015,11 +4377,16 @@ def test_set_iam_policy_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SetNodeTemplateNodeGroupRequest, dict,] + "request_type", + [ + compute.SetNodeTemplateNodeGroupRequest, + dict, + ], ) def test_set_node_template_unary_rest(request_type): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -4136,7 +4503,8 @@ def test_set_node_template_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -4232,7 +4600,11 @@ def test_set_node_template_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_node_template_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -4243,7 +4615,8 @@ def test_set_node_template_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetNodeTemplateNodeGroupRequest ): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -4267,7 +4640,8 @@ def test_set_node_template_unary_rest_bad_request( def test_set_node_template_unary_rest_flattened(): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -4316,7 +4690,8 @@ def test_set_node_template_unary_rest_flattened(): def test_set_node_template_unary_rest_flattened_error(transport: str = "rest"): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -4340,11 +4715,16 @@ def test_set_node_template_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.TestIamPermissionsNodeGroupRequest, dict,] + "request_type", + [ + compute.TestIamPermissionsNodeGroupRequest, + dict, + ], ) def test_test_iam_permissions_rest(request_type): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -4417,7 +4797,8 @@ def test_test_iam_permissions_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -4460,7 +4841,14 @@ def test_test_iam_permissions_rest_unset_required_fields(): unset_fields = transport.test_iam_permissions._get_unset_required_fields({}) assert set(unset_fields) == ( set(()) - & set(("project", "resource", "testPermissionsRequestResource", "zone",)) + & set( + ( + "project", + "resource", + "testPermissionsRequestResource", + "zone", + ) + ) ) @@ -4508,7 +4896,11 @@ def test_test_iam_permissions_rest_interceptors(null_interceptor): post.return_value = compute.TestPermissionsResponse client.test_iam_permissions( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -4519,7 +4911,8 @@ def test_test_iam_permissions_rest_bad_request( transport: str = "rest", request_type=compute.TestIamPermissionsNodeGroupRequest ): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -4543,7 +4936,8 @@ def test_test_iam_permissions_rest_bad_request( def test_test_iam_permissions_rest_flattened(): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -4592,7 +4986,8 @@ def test_test_iam_permissions_rest_flattened(): def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -4622,7 +5017,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -4642,7 +5038,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = NodeGroupsClient(client_options=options, transport=transport,) + client = NodeGroupsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -4658,7 +5057,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = NodeGroupsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -4671,7 +5071,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.NodeGroupsRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.NodeGroupsRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -4734,7 +5139,8 @@ def test_node_groups_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.NodeGroupsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -4784,7 +5190,12 @@ def test_node_groups_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_node_groups_host_no_port(transport_name): client = NodeGroupsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4800,7 +5211,12 @@ def test_node_groups_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_node_groups_host_with_port(transport_name): client = NodeGroupsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4838,7 +5254,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = NodeGroupsClient.common_folder_path(folder) assert expected == actual @@ -4856,7 +5274,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = NodeGroupsClient.common_organization_path(organization) assert expected == actual @@ -4874,7 +5294,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = NodeGroupsClient.common_project_path(project) assert expected == actual @@ -4894,7 +5316,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = NodeGroupsClient.common_location_path(project, location) assert expected == actual @@ -4919,7 +5342,8 @@ def test_client_with_default_client_info(): transports.NodeGroupsTransport, "_prep_wrapped_messages" ) as prep: client = NodeGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4928,7 +5352,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = NodeGroupsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4968,7 +5393,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(NodeGroupsClient, transports.NodeGroupsRestTransport),], + [ + (NodeGroupsClient, transports.NodeGroupsRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_node_templates.py b/tests/unit/gapic/compute_v1/test_node_templates.py index 307b027c8..024622509 100644 --- a/tests/unit/gapic/compute_v1/test_node_templates.py +++ b/tests/unit/gapic/compute_v1/test_node_templates.py @@ -89,7 +89,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(NodeTemplatesClient, "rest"),] + "client_class,transport_name", + [ + (NodeTemplatesClient, "rest"), + ], ) def test_node_templates_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() @@ -110,7 +113,10 @@ def test_node_templates_client_from_service_account_info(client_class, transport @pytest.mark.parametrize( - "transport_class,transport_name", [(transports.NodeTemplatesRestTransport, "rest"),] + "transport_class,transport_name", + [ + (transports.NodeTemplatesRestTransport, "rest"), + ], ) def test_node_templates_client_service_account_always_use_jwt( transport_class, transport_name @@ -131,7 +137,10 @@ def test_node_templates_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(NodeTemplatesClient, "rest"),] + "client_class,transport_name", + [ + (NodeTemplatesClient, "rest"), + ], ) def test_node_templates_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() @@ -171,7 +180,9 @@ def test_node_templates_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(NodeTemplatesClient, transports.NodeTemplatesRestTransport, "rest"),], + [ + (NodeTemplatesClient, transports.NodeTemplatesRestTransport, "rest"), + ], ) @mock.patch.object( NodeTemplatesClient, @@ -454,13 +465,17 @@ def test_node_templates_client_get_mtls_endpoint_and_cert_source(client_class): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(NodeTemplatesClient, transports.NodeTemplatesRestTransport, "rest"),], + [ + (NodeTemplatesClient, transports.NodeTemplatesRestTransport, "rest"), + ], ) def test_node_templates_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -478,7 +493,9 @@ def test_node_templates_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(NodeTemplatesClient, transports.NodeTemplatesRestTransport, "rest", None),], + [ + (NodeTemplatesClient, transports.NodeTemplatesRestTransport, "rest", None), + ], ) def test_node_templates_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -502,11 +519,16 @@ def test_node_templates_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.AggregatedListNodeTemplatesRequest, dict,] + "request_type", + [ + compute.AggregatedListNodeTemplatesRequest, + dict, + ], ) def test_aggregated_list_rest(request_type): client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -587,7 +609,8 @@ def test_aggregated_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -686,7 +709,11 @@ def test_aggregated_list_rest_interceptors(null_interceptor): post.return_value = compute.NodeTemplateAggregatedList client.aggregated_list( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -697,7 +724,8 @@ def test_aggregated_list_rest_bad_request( transport: str = "rest", request_type=compute.AggregatedListNodeTemplatesRequest ): client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -718,7 +746,8 @@ def test_aggregated_list_rest_bad_request( def test_aggregated_list_rest_flattened(): client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -730,7 +759,9 @@ def test_aggregated_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -756,20 +787,23 @@ def test_aggregated_list_rest_flattened(): def test_aggregated_list_rest_flattened_error(transport: str = "rest"): client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.aggregated_list( - compute.AggregatedListNodeTemplatesRequest(), project="project_value", + compute.AggregatedListNodeTemplatesRequest(), + project="project_value", ) def test_aggregated_list_rest_pager(transport: str = "rest"): client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -786,9 +820,15 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): }, next_page_token="abc", ), - compute.NodeTemplateAggregatedList(items={}, next_page_token="def",), compute.NodeTemplateAggregatedList( - items={"g": compute.NodeTemplatesScopedList(),}, next_page_token="ghi", + items={}, + next_page_token="def", + ), + compute.NodeTemplateAggregatedList( + items={ + "g": compute.NodeTemplatesScopedList(), + }, + next_page_token="ghi", ), compute.NodeTemplateAggregatedList( items={ @@ -835,10 +875,17 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.DeleteNodeTemplateRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteNodeTemplateRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -956,7 +1003,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -997,7 +1045,14 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("nodeTemplate", "project", "region",)) + set(("requestId",)) + & set( + ( + "nodeTemplate", + "project", + "region", + ) + ) ) @@ -1043,7 +1098,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1054,7 +1113,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteNodeTemplateRequest ): client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1079,7 +1139,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1125,7 +1186,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1145,10 +1207,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetNodeTemplateRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetNodeTemplateRequest, + dict, + ], +) def test_get_rest(request_type): client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1240,7 +1309,8 @@ def test_get_rest_required_fields(request_type=compute.GetNodeTemplateRequest): assert jsonified_request["region"] == "region_value" client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1280,7 +1350,16 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("nodeTemplate", "project", "region",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "nodeTemplate", + "project", + "region", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1324,7 +1403,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.NodeTemplate - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1334,7 +1419,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetNodeTemplateRequest ): client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1359,7 +1445,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1405,7 +1492,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1426,11 +1514,16 @@ def test_get_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.GetIamPolicyNodeTemplateRequest, dict,] + "request_type", + [ + compute.GetIamPolicyNodeTemplateRequest, + dict, + ], ) def test_get_iam_policy_rest(request_type): client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1440,7 +1533,11 @@ def test_get_iam_policy_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = compute.Policy(etag="etag_value", iam_owned=True, version=774,) + return_value = compute.Policy( + etag="etag_value", + iam_owned=True, + version=774, + ) # Wrap the value into a proper Response obj response_value = Response() @@ -1502,7 +1599,8 @@ def test_get_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1544,7 +1642,13 @@ def test_get_iam_policy_rest_unset_required_fields(): unset_fields = transport.get_iam_policy._get_unset_required_fields({}) assert set(unset_fields) == ( set(("optionsRequestedPolicyVersion",)) - & set(("project", "region", "resource",)) + & set( + ( + "project", + "region", + "resource", + ) + ) ) @@ -1590,7 +1694,11 @@ def test_get_iam_policy_rest_interceptors(null_interceptor): post.return_value = compute.Policy client.get_iam_policy( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1601,7 +1709,8 @@ def test_get_iam_policy_rest_bad_request( transport: str = "rest", request_type=compute.GetIamPolicyNodeTemplateRequest ): client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1622,7 +1731,8 @@ def test_get_iam_policy_rest_bad_request( def test_get_iam_policy_rest_flattened(): client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1639,7 +1749,9 @@ def test_get_iam_policy_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", region="region_value", resource="resource_value", + project="project_value", + region="region_value", + resource="resource_value", ) mock_args.update(sample_request) @@ -1666,7 +1778,8 @@ def test_get_iam_policy_rest_flattened(): def test_get_iam_policy_rest_flattened_error(transport: str = "rest"): client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1686,10 +1799,17 @@ def test_get_iam_policy_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertNodeTemplateRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertNodeTemplateRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1825,7 +1945,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1867,7 +1988,14 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("nodeTemplateResource", "project", "region",)) + set(("requestId",)) + & set( + ( + "nodeTemplateResource", + "project", + "region", + ) + ) ) @@ -1913,7 +2041,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1924,7 +2056,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertNodeTemplateRequest ): client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1971,7 +2104,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2015,7 +2149,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2037,10 +2172,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListNodeTemplatesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListNodeTemplatesRequest, + dict, + ], +) def test_list_rest(request_type): client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2103,7 +2245,13 @@ def test_list_rest_required_fields(request_type=compute.ListNodeTemplatesRequest ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -2114,7 +2262,8 @@ def test_list_rest_required_fields(request_type=compute.ListNodeTemplatesRequest assert jsonified_request["region"] == "region_value" client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2155,8 +2304,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "region",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "region", + ) + ) ) @@ -2203,7 +2365,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.NodeTemplateList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2213,7 +2381,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListNodeTemplatesRequest ): client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2234,7 +2403,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2246,7 +2416,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "region": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", region="region_value",) + mock_args = dict( + project="project_value", + region="region_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2272,7 +2445,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2287,7 +2461,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2304,12 +2479,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.NodeTemplateList(items=[], next_page_token="def",), compute.NodeTemplateList( - items=[compute.NodeTemplate(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.NodeTemplateList( - items=[compute.NodeTemplate(), compute.NodeTemplate(),], + items=[ + compute.NodeTemplate(), + ], + next_page_token="ghi", + ), + compute.NodeTemplateList( + items=[ + compute.NodeTemplate(), + compute.NodeTemplate(), + ], ), ) # Two responses for two calls @@ -2337,11 +2521,16 @@ def test_list_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.SetIamPolicyNodeTemplateRequest, dict,] + "request_type", + [ + compute.SetIamPolicyNodeTemplateRequest, + dict, + ], ) def test_set_iam_policy_rest(request_type): client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2428,7 +2617,11 @@ def test_set_iam_policy_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = compute.Policy(etag="etag_value", iam_owned=True, version=774,) + return_value = compute.Policy( + etag="etag_value", + iam_owned=True, + version=774, + ) # Wrap the value into a proper Response obj response_value = Response() @@ -2488,7 +2681,8 @@ def test_set_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2531,7 +2725,14 @@ def test_set_iam_policy_rest_unset_required_fields(): unset_fields = transport.set_iam_policy._get_unset_required_fields({}) assert set(unset_fields) == ( set(()) - & set(("project", "region", "regionSetPolicyRequestResource", "resource",)) + & set( + ( + "project", + "region", + "regionSetPolicyRequestResource", + "resource", + ) + ) ) @@ -2577,7 +2778,11 @@ def test_set_iam_policy_rest_interceptors(null_interceptor): post.return_value = compute.Policy client.set_iam_policy( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2588,7 +2793,8 @@ def test_set_iam_policy_rest_bad_request( transport: str = "rest", request_type=compute.SetIamPolicyNodeTemplateRequest ): client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2686,7 +2892,8 @@ def test_set_iam_policy_rest_bad_request( def test_set_iam_policy_rest_flattened(): client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2735,7 +2942,8 @@ def test_set_iam_policy_rest_flattened(): def test_set_iam_policy_rest_flattened_error(transport: str = "rest"): client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2759,11 +2967,16 @@ def test_set_iam_policy_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.TestIamPermissionsNodeTemplateRequest, dict,] + "request_type", + [ + compute.TestIamPermissionsNodeTemplateRequest, + dict, + ], ) def test_test_iam_permissions_rest(request_type): client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2836,7 +3049,8 @@ def test_test_iam_permissions_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2879,7 +3093,14 @@ def test_test_iam_permissions_rest_unset_required_fields(): unset_fields = transport.test_iam_permissions._get_unset_required_fields({}) assert set(unset_fields) == ( set(()) - & set(("project", "region", "resource", "testPermissionsRequestResource",)) + & set( + ( + "project", + "region", + "resource", + "testPermissionsRequestResource", + ) + ) ) @@ -2927,7 +3148,11 @@ def test_test_iam_permissions_rest_interceptors(null_interceptor): post.return_value = compute.TestPermissionsResponse client.test_iam_permissions( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2938,7 +3163,8 @@ def test_test_iam_permissions_rest_bad_request( transport: str = "rest", request_type=compute.TestIamPermissionsNodeTemplateRequest ): client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2962,7 +3188,8 @@ def test_test_iam_permissions_rest_bad_request( def test_test_iam_permissions_rest_flattened(): client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3011,7 +3238,8 @@ def test_test_iam_permissions_rest_flattened(): def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3041,7 +3269,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -3061,7 +3290,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = NodeTemplatesClient(client_options=options, transport=transport,) + client = NodeTemplatesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -3077,7 +3309,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = NodeTemplatesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -3090,7 +3323,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.NodeTemplatesRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.NodeTemplatesRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -3148,7 +3386,8 @@ def test_node_templates_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.NodeTemplatesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -3198,7 +3437,12 @@ def test_node_templates_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_node_templates_host_no_port(transport_name): client = NodeTemplatesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3214,7 +3458,12 @@ def test_node_templates_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_node_templates_host_with_port(transport_name): client = NodeTemplatesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3252,7 +3501,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = NodeTemplatesClient.common_folder_path(folder) assert expected == actual @@ -3270,7 +3521,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = NodeTemplatesClient.common_organization_path(organization) assert expected == actual @@ -3288,7 +3541,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = NodeTemplatesClient.common_project_path(project) assert expected == actual @@ -3308,7 +3563,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = NodeTemplatesClient.common_location_path(project, location) assert expected == actual @@ -3333,7 +3589,8 @@ def test_client_with_default_client_info(): transports.NodeTemplatesTransport, "_prep_wrapped_messages" ) as prep: client = NodeTemplatesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3342,7 +3599,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = NodeTemplatesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3382,7 +3640,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(NodeTemplatesClient, transports.NodeTemplatesRestTransport),], + [ + (NodeTemplatesClient, transports.NodeTemplatesRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_node_types.py b/tests/unit/gapic/compute_v1/test_node_types.py index 492c6546d..6b761a88f 100644 --- a/tests/unit/gapic/compute_v1/test_node_types.py +++ b/tests/unit/gapic/compute_v1/test_node_types.py @@ -83,7 +83,12 @@ def test__get_default_mtls_endpoint(): assert NodeTypesClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class,transport_name", [(NodeTypesClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (NodeTypesClient, "rest"), + ], +) def test_node_types_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -103,7 +108,10 @@ def test_node_types_client_from_service_account_info(client_class, transport_nam @pytest.mark.parametrize( - "transport_class,transport_name", [(transports.NodeTypesRestTransport, "rest"),] + "transport_class,transport_name", + [ + (transports.NodeTypesRestTransport, "rest"), + ], ) def test_node_types_client_service_account_always_use_jwt( transport_class, transport_name @@ -123,7 +131,12 @@ def test_node_types_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class,transport_name", [(NodeTypesClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (NodeTypesClient, "rest"), + ], +) def test_node_types_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -162,7 +175,9 @@ def test_node_types_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(NodeTypesClient, transports.NodeTypesRestTransport, "rest"),], + [ + (NodeTypesClient, transports.NodeTypesRestTransport, "rest"), + ], ) @mock.patch.object( NodeTypesClient, "DEFAULT_ENDPOINT", modify_default_endpoint(NodeTypesClient) @@ -439,13 +454,17 @@ def test_node_types_client_get_mtls_endpoint_and_cert_source(client_class): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(NodeTypesClient, transports.NodeTypesRestTransport, "rest"),], + [ + (NodeTypesClient, transports.NodeTypesRestTransport, "rest"), + ], ) def test_node_types_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -463,7 +482,9 @@ def test_node_types_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(NodeTypesClient, transports.NodeTypesRestTransport, "rest", None),], + [ + (NodeTypesClient, transports.NodeTypesRestTransport, "rest", None), + ], ) def test_node_types_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -487,11 +508,16 @@ def test_node_types_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.AggregatedListNodeTypesRequest, dict,] + "request_type", + [ + compute.AggregatedListNodeTypesRequest, + dict, + ], ) def test_aggregated_list_rest(request_type): client = NodeTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -572,7 +598,8 @@ def test_aggregated_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = NodeTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -669,7 +696,11 @@ def test_aggregated_list_rest_interceptors(null_interceptor): post.return_value = compute.NodeTypeAggregatedList client.aggregated_list( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -680,7 +711,8 @@ def test_aggregated_list_rest_bad_request( transport: str = "rest", request_type=compute.AggregatedListNodeTypesRequest ): client = NodeTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -701,7 +733,8 @@ def test_aggregated_list_rest_bad_request( def test_aggregated_list_rest_flattened(): client = NodeTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -713,7 +746,9 @@ def test_aggregated_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -739,20 +774,23 @@ def test_aggregated_list_rest_flattened(): def test_aggregated_list_rest_flattened_error(transport: str = "rest"): client = NodeTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.aggregated_list( - compute.AggregatedListNodeTypesRequest(), project="project_value", + compute.AggregatedListNodeTypesRequest(), + project="project_value", ) def test_aggregated_list_rest_pager(transport: str = "rest"): client = NodeTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -769,9 +807,15 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): }, next_page_token="abc", ), - compute.NodeTypeAggregatedList(items={}, next_page_token="def",), compute.NodeTypeAggregatedList( - items={"g": compute.NodeTypesScopedList(),}, next_page_token="ghi", + items={}, + next_page_token="def", + ), + compute.NodeTypeAggregatedList( + items={ + "g": compute.NodeTypesScopedList(), + }, + next_page_token="ghi", ), compute.NodeTypeAggregatedList( items={ @@ -813,10 +857,17 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.GetNodeTypeRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetNodeTypeRequest, + dict, + ], +) def test_get_rest(request_type): client = NodeTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -904,7 +955,8 @@ def test_get_rest_required_fields(request_type=compute.GetNodeTypeRequest): assert jsonified_request["zone"] == "zone_value" client = NodeTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -944,7 +996,16 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("nodeType", "project", "zone",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "nodeType", + "project", + "zone", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -986,7 +1047,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.NodeType - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -996,7 +1063,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetNodeTypeRequest ): client = NodeTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1017,7 +1085,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = NodeTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1034,7 +1103,9 @@ def test_get_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", zone="zone_value", node_type="node_type_value", + project="project_value", + zone="zone_value", + node_type="node_type_value", ) mock_args.update(sample_request) @@ -1061,7 +1132,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = NodeTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1081,10 +1153,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListNodeTypesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListNodeTypesRequest, + dict, + ], +) def test_list_rest(request_type): client = NodeTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1147,7 +1226,13 @@ def test_list_rest_required_fields(request_type=compute.ListNodeTypesRequest): ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1158,7 +1243,8 @@ def test_list_rest_required_fields(request_type=compute.ListNodeTypesRequest): assert jsonified_request["zone"] == "zone_value" client = NodeTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1199,8 +1285,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "zone",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "zone", + ) + ) ) @@ -1243,7 +1342,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.NodeTypeList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1253,7 +1358,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListNodeTypesRequest ): client = NodeTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1274,7 +1380,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = NodeTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1286,7 +1393,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "zone": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", zone="zone_value",) + mock_args = dict( + project="project_value", + zone="zone_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1312,20 +1422,24 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = NodeTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list( - compute.ListNodeTypesRequest(), project="project_value", zone="zone_value", + compute.ListNodeTypesRequest(), + project="project_value", + zone="zone_value", ) def test_list_rest_pager(transport: str = "rest"): client = NodeTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1335,12 +1449,29 @@ def test_list_rest_pager(transport: str = "rest"): # Set the response as a series of pages response = ( compute.NodeTypeList( - items=[compute.NodeType(), compute.NodeType(), compute.NodeType(),], + items=[ + compute.NodeType(), + compute.NodeType(), + compute.NodeType(), + ], next_page_token="abc", ), - compute.NodeTypeList(items=[], next_page_token="def",), - compute.NodeTypeList(items=[compute.NodeType(),], next_page_token="ghi",), - compute.NodeTypeList(items=[compute.NodeType(), compute.NodeType(),],), + compute.NodeTypeList( + items=[], + next_page_token="def", + ), + compute.NodeTypeList( + items=[ + compute.NodeType(), + ], + next_page_token="ghi", + ), + compute.NodeTypeList( + items=[ + compute.NodeType(), + compute.NodeType(), + ], + ), ) # Two responses for two calls response = response + response @@ -1373,7 +1504,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = NodeTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1393,7 +1525,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = NodeTypesClient(client_options=options, transport=transport,) + client = NodeTypesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1409,7 +1544,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = NodeTypesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1422,7 +1558,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.NodeTypesRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.NodeTypesRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -1475,7 +1616,8 @@ def test_node_types_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.NodeTypesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1527,7 +1669,12 @@ def test_node_types_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_node_types_host_no_port(transport_name): client = NodeTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1543,7 +1690,12 @@ def test_node_types_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_node_types_host_with_port(transport_name): client = NodeTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1581,7 +1733,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = NodeTypesClient.common_folder_path(folder) assert expected == actual @@ -1599,7 +1753,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = NodeTypesClient.common_organization_path(organization) assert expected == actual @@ -1617,7 +1773,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = NodeTypesClient.common_project_path(project) assert expected == actual @@ -1637,7 +1795,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = NodeTypesClient.common_location_path(project, location) assert expected == actual @@ -1662,7 +1821,8 @@ def test_client_with_default_client_info(): transports.NodeTypesTransport, "_prep_wrapped_messages" ) as prep: client = NodeTypesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1671,7 +1831,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = NodeTypesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1711,7 +1872,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(NodeTypesClient, transports.NodeTypesRestTransport),], + [ + (NodeTypesClient, transports.NodeTypesRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_packet_mirrorings.py b/tests/unit/gapic/compute_v1/test_packet_mirrorings.py index 73007eede..710e25d90 100644 --- a/tests/unit/gapic/compute_v1/test_packet_mirrorings.py +++ b/tests/unit/gapic/compute_v1/test_packet_mirrorings.py @@ -90,7 +90,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(PacketMirroringsClient, "rest"),] + "client_class,transport_name", + [ + (PacketMirroringsClient, "rest"), + ], ) def test_packet_mirrorings_client_from_service_account_info( client_class, transport_name @@ -114,7 +117,9 @@ def test_packet_mirrorings_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.PacketMirroringsRestTransport, "rest"),], + [ + (transports.PacketMirroringsRestTransport, "rest"), + ], ) def test_packet_mirrorings_client_service_account_always_use_jwt( transport_class, transport_name @@ -135,7 +140,10 @@ def test_packet_mirrorings_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(PacketMirroringsClient, "rest"),] + "client_class,transport_name", + [ + (PacketMirroringsClient, "rest"), + ], ) def test_packet_mirrorings_client_from_service_account_file( client_class, transport_name @@ -177,7 +185,9 @@ def test_packet_mirrorings_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(PacketMirroringsClient, transports.PacketMirroringsRestTransport, "rest"),], + [ + (PacketMirroringsClient, transports.PacketMirroringsRestTransport, "rest"), + ], ) @mock.patch.object( PacketMirroringsClient, @@ -470,13 +480,17 @@ def test_packet_mirrorings_client_get_mtls_endpoint_and_cert_source(client_class @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(PacketMirroringsClient, transports.PacketMirroringsRestTransport, "rest"),], + [ + (PacketMirroringsClient, transports.PacketMirroringsRestTransport, "rest"), + ], ) def test_packet_mirrorings_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -494,7 +508,14 @@ def test_packet_mirrorings_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(PacketMirroringsClient, transports.PacketMirroringsRestTransport, "rest", None),], + [ + ( + PacketMirroringsClient, + transports.PacketMirroringsRestTransport, + "rest", + None, + ), + ], ) def test_packet_mirrorings_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -518,11 +539,16 @@ def test_packet_mirrorings_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.AggregatedListPacketMirroringsRequest, dict,] + "request_type", + [ + compute.AggregatedListPacketMirroringsRequest, + dict, + ], ) def test_aggregated_list_rest(request_type): client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -603,7 +629,8 @@ def test_aggregated_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -704,7 +731,11 @@ def test_aggregated_list_rest_interceptors(null_interceptor): post.return_value = compute.PacketMirroringAggregatedList client.aggregated_list( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -715,7 +746,8 @@ def test_aggregated_list_rest_bad_request( transport: str = "rest", request_type=compute.AggregatedListPacketMirroringsRequest ): client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -736,7 +768,8 @@ def test_aggregated_list_rest_bad_request( def test_aggregated_list_rest_flattened(): client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -748,7 +781,9 @@ def test_aggregated_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -774,20 +809,23 @@ def test_aggregated_list_rest_flattened(): def test_aggregated_list_rest_flattened_error(transport: str = "rest"): client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.aggregated_list( - compute.AggregatedListPacketMirroringsRequest(), project="project_value", + compute.AggregatedListPacketMirroringsRequest(), + project="project_value", ) def test_aggregated_list_rest_pager(transport: str = "rest"): client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -804,9 +842,14 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): }, next_page_token="abc", ), - compute.PacketMirroringAggregatedList(items={}, next_page_token="def",), compute.PacketMirroringAggregatedList( - items={"g": compute.PacketMirroringsScopedList(),}, + items={}, + next_page_token="def", + ), + compute.PacketMirroringAggregatedList( + items={ + "g": compute.PacketMirroringsScopedList(), + }, next_page_token="ghi", ), compute.PacketMirroringAggregatedList( @@ -854,10 +897,17 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.DeletePacketMirroringRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeletePacketMirroringRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -975,7 +1025,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1016,7 +1067,14 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("packetMirroring", "project", "region",)) + set(("requestId",)) + & set( + ( + "packetMirroring", + "project", + "region", + ) + ) ) @@ -1062,7 +1120,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1073,7 +1135,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeletePacketMirroringRequest ): client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1098,7 +1161,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1144,7 +1208,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1164,10 +1229,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetPacketMirroringRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetPacketMirroringRequest, + dict, + ], +) def test_get_rest(request_type): client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1255,7 +1327,8 @@ def test_get_rest_required_fields(request_type=compute.GetPacketMirroringRequest assert jsonified_request["region"] == "region_value" client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1296,7 +1369,14 @@ def test_get_rest_unset_required_fields(): unset_fields = transport.get._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("packetMirroring", "project", "region",)) + set(()) + & set( + ( + "packetMirroring", + "project", + "region", + ) + ) ) @@ -1343,7 +1423,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.PacketMirroring - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1353,7 +1439,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetPacketMirroringRequest ): client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1378,7 +1465,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1424,7 +1512,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1444,10 +1533,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertPacketMirroringRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertPacketMirroringRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1582,7 +1678,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1624,7 +1721,14 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("packetMirroringResource", "project", "region",)) + set(("requestId",)) + & set( + ( + "packetMirroringResource", + "project", + "region", + ) + ) ) @@ -1670,7 +1774,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1681,7 +1789,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertPacketMirroringRequest ): client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1727,7 +1836,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1773,7 +1883,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1797,10 +1908,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListPacketMirroringsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListPacketMirroringsRequest, + dict, + ], +) def test_list_rest(request_type): client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1863,7 +1981,13 @@ def test_list_rest_required_fields(request_type=compute.ListPacketMirroringsRequ ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1874,7 +1998,8 @@ def test_list_rest_required_fields(request_type=compute.ListPacketMirroringsRequ assert jsonified_request["region"] == "region_value" client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1915,8 +2040,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "region",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "region", + ) + ) ) @@ -1963,7 +2101,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.PacketMirroringList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1973,7 +2117,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListPacketMirroringsRequest ): client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1994,7 +2139,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2006,7 +2152,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "region": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", region="region_value",) + mock_args = dict( + project="project_value", + region="region_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2032,7 +2181,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2047,7 +2197,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2064,12 +2215,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.PacketMirroringList(items=[], next_page_token="def",), compute.PacketMirroringList( - items=[compute.PacketMirroring(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.PacketMirroringList( - items=[compute.PacketMirroring(), compute.PacketMirroring(),], + items=[ + compute.PacketMirroring(), + ], + next_page_token="ghi", + ), + compute.PacketMirroringList( + items=[ + compute.PacketMirroring(), + compute.PacketMirroring(), + ], ), ) # Two responses for two calls @@ -2096,10 +2256,17 @@ def test_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.PatchPacketMirroringRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.PatchPacketMirroringRequest, + dict, + ], +) def test_patch_unary_rest(request_type): client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2242,7 +2409,8 @@ def test_patch_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2285,7 +2453,14 @@ def test_patch_unary_rest_unset_required_fields(): unset_fields = transport.patch._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("packetMirroring", "packetMirroringResource", "project", "region",)) + & set( + ( + "packetMirroring", + "packetMirroringResource", + "project", + "region", + ) + ) ) @@ -2330,7 +2505,13 @@ def test_patch_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.patch_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2340,7 +2521,8 @@ def test_patch_unary_rest_bad_request( transport: str = "rest", request_type=compute.PatchPacketMirroringRequest ): client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2390,7 +2572,8 @@ def test_patch_unary_rest_bad_request( def test_patch_unary_rest_flattened(): client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2441,7 +2624,8 @@ def test_patch_unary_rest_flattened(): def test_patch_unary_rest_flattened_error(transport: str = "rest"): client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2467,11 +2651,16 @@ def test_patch_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.TestIamPermissionsPacketMirroringRequest, dict,] + "request_type", + [ + compute.TestIamPermissionsPacketMirroringRequest, + dict, + ], ) def test_test_iam_permissions_rest(request_type): client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2544,7 +2733,8 @@ def test_test_iam_permissions_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2587,7 +2777,14 @@ def test_test_iam_permissions_rest_unset_required_fields(): unset_fields = transport.test_iam_permissions._get_unset_required_fields({}) assert set(unset_fields) == ( set(()) - & set(("project", "region", "resource", "testPermissionsRequestResource",)) + & set( + ( + "project", + "region", + "resource", + "testPermissionsRequestResource", + ) + ) ) @@ -2635,7 +2832,11 @@ def test_test_iam_permissions_rest_interceptors(null_interceptor): post.return_value = compute.TestPermissionsResponse client.test_iam_permissions( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2647,7 +2848,8 @@ def test_test_iam_permissions_rest_bad_request( request_type=compute.TestIamPermissionsPacketMirroringRequest, ): client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2671,7 +2873,8 @@ def test_test_iam_permissions_rest_bad_request( def test_test_iam_permissions_rest_flattened(): client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2720,7 +2923,8 @@ def test_test_iam_permissions_rest_flattened(): def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2750,7 +2954,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2770,7 +2975,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = PacketMirroringsClient(client_options=options, transport=transport,) + client = PacketMirroringsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2786,7 +2994,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = PacketMirroringsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2799,7 +3008,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.PacketMirroringsRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.PacketMirroringsRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -2856,7 +3070,8 @@ def test_packet_mirrorings_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.PacketMirroringsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2906,7 +3121,12 @@ def test_packet_mirrorings_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_packet_mirrorings_host_no_port(transport_name): client = PacketMirroringsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2922,7 +3142,12 @@ def test_packet_mirrorings_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_packet_mirrorings_host_with_port(transport_name): client = PacketMirroringsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2960,7 +3185,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = PacketMirroringsClient.common_folder_path(folder) assert expected == actual @@ -2978,7 +3205,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = PacketMirroringsClient.common_organization_path(organization) assert expected == actual @@ -2996,7 +3225,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = PacketMirroringsClient.common_project_path(project) assert expected == actual @@ -3016,7 +3247,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = PacketMirroringsClient.common_location_path(project, location) assert expected == actual @@ -3041,7 +3273,8 @@ def test_client_with_default_client_info(): transports.PacketMirroringsTransport, "_prep_wrapped_messages" ) as prep: client = PacketMirroringsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3050,7 +3283,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = PacketMirroringsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3090,7 +3324,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(PacketMirroringsClient, transports.PacketMirroringsRestTransport),], + [ + (PacketMirroringsClient, transports.PacketMirroringsRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_projects.py b/tests/unit/gapic/compute_v1/test_projects.py index c94a3c9e4..cb82dc404 100644 --- a/tests/unit/gapic/compute_v1/test_projects.py +++ b/tests/unit/gapic/compute_v1/test_projects.py @@ -83,7 +83,12 @@ def test__get_default_mtls_endpoint(): assert ProjectsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class,transport_name", [(ProjectsClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (ProjectsClient, "rest"), + ], +) def test_projects_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -103,7 +108,10 @@ def test_projects_client_from_service_account_info(client_class, transport_name) @pytest.mark.parametrize( - "transport_class,transport_name", [(transports.ProjectsRestTransport, "rest"),] + "transport_class,transport_name", + [ + (transports.ProjectsRestTransport, "rest"), + ], ) def test_projects_client_service_account_always_use_jwt( transport_class, transport_name @@ -123,7 +131,12 @@ def test_projects_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class,transport_name", [(ProjectsClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (ProjectsClient, "rest"), + ], +) def test_projects_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -162,7 +175,9 @@ def test_projects_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(ProjectsClient, transports.ProjectsRestTransport, "rest"),], + [ + (ProjectsClient, transports.ProjectsRestTransport, "rest"), + ], ) @mock.patch.object( ProjectsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(ProjectsClient) @@ -437,13 +452,17 @@ def test_projects_client_get_mtls_endpoint_and_cert_source(client_class): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(ProjectsClient, transports.ProjectsRestTransport, "rest"),], + [ + (ProjectsClient, transports.ProjectsRestTransport, "rest"), + ], ) def test_projects_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -461,7 +480,9 @@ def test_projects_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(ProjectsClient, transports.ProjectsRestTransport, "rest", None),], + [ + (ProjectsClient, transports.ProjectsRestTransport, "rest", None), + ], ) def test_projects_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -484,10 +505,17 @@ def test_projects_client_client_options_credentials_file( ) -@pytest.mark.parametrize("request_type", [compute.DisableXpnHostProjectRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DisableXpnHostProjectRequest, + dict, + ], +) def test_disable_xpn_host_unary_rest(request_type): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -593,7 +621,8 @@ def test_disable_xpn_host_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -676,7 +705,11 @@ def test_disable_xpn_host_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.disable_xpn_host_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -687,7 +720,8 @@ def test_disable_xpn_host_unary_rest_bad_request( transport: str = "rest", request_type=compute.DisableXpnHostProjectRequest ): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -708,7 +742,8 @@ def test_disable_xpn_host_unary_rest_bad_request( def test_disable_xpn_host_unary_rest_flattened(): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -720,7 +755,9 @@ def test_disable_xpn_host_unary_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -745,14 +782,16 @@ def test_disable_xpn_host_unary_rest_flattened(): def test_disable_xpn_host_unary_rest_flattened_error(transport: str = "rest"): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.disable_xpn_host_unary( - compute.DisableXpnHostProjectRequest(), project="project_value", + compute.DisableXpnHostProjectRequest(), + project="project_value", ) @@ -763,11 +802,16 @@ def test_disable_xpn_host_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.DisableXpnResourceProjectRequest, dict,] + "request_type", + [ + compute.DisableXpnResourceProjectRequest, + dict, + ], ) def test_disable_xpn_resource_unary_rest(request_type): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -876,7 +920,8 @@ def test_disable_xpn_resource_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -919,7 +964,12 @@ def test_disable_xpn_resource_unary_rest_unset_required_fields(): unset_fields = transport.disable_xpn_resource._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("project", "projectsDisableXpnResourceRequestResource",)) + & set( + ( + "project", + "projectsDisableXpnResourceRequestResource", + ) + ) ) @@ -963,7 +1013,11 @@ def test_disable_xpn_resource_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.disable_xpn_resource_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -974,7 +1028,8 @@ def test_disable_xpn_resource_unary_rest_bad_request( transport: str = "rest", request_type=compute.DisableXpnResourceProjectRequest ): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -998,7 +1053,8 @@ def test_disable_xpn_resource_unary_rest_bad_request( def test_disable_xpn_resource_unary_rest_flattened(): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1041,7 +1097,8 @@ def test_disable_xpn_resource_unary_rest_flattened(): def test_disable_xpn_resource_unary_rest_flattened_error(transport: str = "rest"): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1062,10 +1119,17 @@ def test_disable_xpn_resource_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.EnableXpnHostProjectRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.EnableXpnHostProjectRequest, + dict, + ], +) def test_enable_xpn_host_unary_rest(request_type): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1171,7 +1235,8 @@ def test_enable_xpn_host_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1254,7 +1319,11 @@ def test_enable_xpn_host_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.enable_xpn_host_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1265,7 +1334,8 @@ def test_enable_xpn_host_unary_rest_bad_request( transport: str = "rest", request_type=compute.EnableXpnHostProjectRequest ): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1286,7 +1356,8 @@ def test_enable_xpn_host_unary_rest_bad_request( def test_enable_xpn_host_unary_rest_flattened(): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1298,7 +1369,9 @@ def test_enable_xpn_host_unary_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1323,14 +1396,16 @@ def test_enable_xpn_host_unary_rest_flattened(): def test_enable_xpn_host_unary_rest_flattened_error(transport: str = "rest"): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.enable_xpn_host_unary( - compute.EnableXpnHostProjectRequest(), project="project_value", + compute.EnableXpnHostProjectRequest(), + project="project_value", ) @@ -1341,11 +1416,16 @@ def test_enable_xpn_host_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.EnableXpnResourceProjectRequest, dict,] + "request_type", + [ + compute.EnableXpnResourceProjectRequest, + dict, + ], ) def test_enable_xpn_resource_unary_rest(request_type): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1454,7 +1534,8 @@ def test_enable_xpn_resource_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1497,7 +1578,12 @@ def test_enable_xpn_resource_unary_rest_unset_required_fields(): unset_fields = transport.enable_xpn_resource._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("project", "projectsEnableXpnResourceRequestResource",)) + & set( + ( + "project", + "projectsEnableXpnResourceRequestResource", + ) + ) ) @@ -1541,7 +1627,11 @@ def test_enable_xpn_resource_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.enable_xpn_resource_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1552,7 +1642,8 @@ def test_enable_xpn_resource_unary_rest_bad_request( transport: str = "rest", request_type=compute.EnableXpnResourceProjectRequest ): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1576,7 +1667,8 @@ def test_enable_xpn_resource_unary_rest_bad_request( def test_enable_xpn_resource_unary_rest_flattened(): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1619,7 +1711,8 @@ def test_enable_xpn_resource_unary_rest_flattened(): def test_enable_xpn_resource_unary_rest_flattened_error(transport: str = "rest"): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1640,10 +1733,17 @@ def test_enable_xpn_resource_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetProjectRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetProjectRequest, + dict, + ], +) def test_get_rest(request_type): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1721,7 +1821,8 @@ def test_get_rest_required_fields(request_type=compute.GetProjectRequest): assert jsonified_request["project"] == "project_value" client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1803,7 +1904,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Project - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1813,7 +1920,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetProjectRequest ): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1834,7 +1942,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1846,7 +1955,9 @@ def test_get_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1870,14 +1981,16 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get( - compute.GetProjectRequest(), project="project_value", + compute.GetProjectRequest(), + project="project_value", ) @@ -1887,10 +2000,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetXpnHostProjectRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetXpnHostProjectRequest, + dict, + ], +) def test_get_xpn_host_rest(request_type): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1970,7 +2090,8 @@ def test_get_xpn_host_rest_required_fields( assert jsonified_request["project"] == "project_value" client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2053,7 +2174,11 @@ def test_get_xpn_host_rest_interceptors(null_interceptor): post.return_value = compute.Project client.get_xpn_host( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2064,7 +2189,8 @@ def test_get_xpn_host_rest_bad_request( transport: str = "rest", request_type=compute.GetXpnHostProjectRequest ): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2085,7 +2211,8 @@ def test_get_xpn_host_rest_bad_request( def test_get_xpn_host_rest_flattened(): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2097,7 +2224,9 @@ def test_get_xpn_host_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2122,14 +2251,16 @@ def test_get_xpn_host_rest_flattened(): def test_get_xpn_host_rest_flattened_error(transport: str = "rest"): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_xpn_host( - compute.GetXpnHostProjectRequest(), project="project_value", + compute.GetXpnHostProjectRequest(), + project="project_value", ) @@ -2140,11 +2271,16 @@ def test_get_xpn_host_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.GetXpnResourcesProjectsRequest, dict,] + "request_type", + [ + compute.GetXpnResourcesProjectsRequest, + dict, + ], ) def test_get_xpn_resources_rest(request_type): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2155,7 +2291,8 @@ def test_get_xpn_resources_rest(request_type): with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. return_value = compute.ProjectsGetXpnResources( - kind="kind_value", next_page_token="next_page_token_value", + kind="kind_value", + next_page_token="next_page_token_value", ) # Wrap the value into a proper Response obj @@ -2202,7 +2339,13 @@ def test_get_xpn_resources_rest_required_fields( ).get_xpn_resources._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -2211,7 +2354,8 @@ def test_get_xpn_resources_rest_required_fields( assert jsonified_request["project"] == "project_value" client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2252,7 +2396,15 @@ def test_get_xpn_resources_rest_unset_required_fields(): unset_fields = transport.get_xpn_resources._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set(("project",)) ) @@ -2299,7 +2451,11 @@ def test_get_xpn_resources_rest_interceptors(null_interceptor): post.return_value = compute.ProjectsGetXpnResources client.get_xpn_resources( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2310,7 +2466,8 @@ def test_get_xpn_resources_rest_bad_request( transport: str = "rest", request_type=compute.GetXpnResourcesProjectsRequest ): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2331,7 +2488,8 @@ def test_get_xpn_resources_rest_bad_request( def test_get_xpn_resources_rest_flattened(): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2343,7 +2501,9 @@ def test_get_xpn_resources_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2368,20 +2528,23 @@ def test_get_xpn_resources_rest_flattened(): def test_get_xpn_resources_rest_flattened_error(transport: str = "rest"): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_xpn_resources( - compute.GetXpnResourcesProjectsRequest(), project="project_value", + compute.GetXpnResourcesProjectsRequest(), + project="project_value", ) def test_get_xpn_resources_rest_pager(transport: str = "rest"): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2398,12 +2561,21 @@ def test_get_xpn_resources_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.ProjectsGetXpnResources(resources=[], next_page_token="def",), compute.ProjectsGetXpnResources( - resources=[compute.XpnResourceId(),], next_page_token="ghi", + resources=[], + next_page_token="def", + ), + compute.ProjectsGetXpnResources( + resources=[ + compute.XpnResourceId(), + ], + next_page_token="ghi", ), compute.ProjectsGetXpnResources( - resources=[compute.XpnResourceId(), compute.XpnResourceId(),], + resources=[ + compute.XpnResourceId(), + compute.XpnResourceId(), + ], ), ) # Two responses for two calls @@ -2430,10 +2602,17 @@ def test_get_xpn_resources_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.ListXpnHostsProjectsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListXpnHostsProjectsRequest, + dict, + ], +) def test_list_xpn_hosts_rest(request_type): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2499,7 +2678,13 @@ def test_list_xpn_hosts_rest_required_fields( ).list_xpn_hosts._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -2508,7 +2693,8 @@ def test_list_xpn_hosts_rest_required_fields( assert jsonified_request["project"] == "project_value" client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2550,8 +2736,21 @@ def test_list_xpn_hosts_rest_unset_required_fields(): unset_fields = transport.list_xpn_hosts._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "projectsListXpnHostsRequestResource",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "projectsListXpnHostsRequestResource", + ) + ) ) @@ -2595,7 +2794,11 @@ def test_list_xpn_hosts_rest_interceptors(null_interceptor): post.return_value = compute.XpnHostList client.list_xpn_hosts( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2606,7 +2809,8 @@ def test_list_xpn_hosts_rest_bad_request( transport: str = "rest", request_type=compute.ListXpnHostsProjectsRequest ): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2630,7 +2834,8 @@ def test_list_xpn_hosts_rest_bad_request( def test_list_xpn_hosts_rest_flattened(): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2672,7 +2877,8 @@ def test_list_xpn_hosts_rest_flattened(): def test_list_xpn_hosts_rest_flattened_error(transport: str = "rest"): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2689,7 +2895,8 @@ def test_list_xpn_hosts_rest_flattened_error(transport: str = "rest"): def test_list_xpn_hosts_rest_pager(transport: str = "rest"): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2699,12 +2906,29 @@ def test_list_xpn_hosts_rest_pager(transport: str = "rest"): # Set the response as a series of pages response = ( compute.XpnHostList( - items=[compute.Project(), compute.Project(), compute.Project(),], + items=[ + compute.Project(), + compute.Project(), + compute.Project(), + ], next_page_token="abc", ), - compute.XpnHostList(items=[], next_page_token="def",), - compute.XpnHostList(items=[compute.Project(),], next_page_token="ghi",), - compute.XpnHostList(items=[compute.Project(), compute.Project(),],), + compute.XpnHostList( + items=[], + next_page_token="def", + ), + compute.XpnHostList( + items=[ + compute.Project(), + ], + next_page_token="ghi", + ), + compute.XpnHostList( + items=[ + compute.Project(), + compute.Project(), + ], + ), ) # Two responses for two calls response = response + response @@ -2733,10 +2957,17 @@ def test_list_xpn_hosts_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.MoveDiskProjectRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.MoveDiskProjectRequest, + dict, + ], +) def test_move_disk_unary_rest(request_type): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2846,7 +3077,8 @@ def test_move_disk_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2888,7 +3120,13 @@ def test_move_disk_unary_rest_unset_required_fields(): unset_fields = transport.move_disk._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("diskMoveRequestResource", "project",)) + set(("requestId",)) + & set( + ( + "diskMoveRequestResource", + "project", + ) + ) ) @@ -2932,7 +3170,11 @@ def test_move_disk_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.move_disk_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2943,7 +3185,8 @@ def test_move_disk_unary_rest_bad_request( transport: str = "rest", request_type=compute.MoveDiskProjectRequest ): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2968,7 +3211,8 @@ def test_move_disk_unary_rest_bad_request( def test_move_disk_unary_rest_flattened(): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3010,7 +3254,8 @@ def test_move_disk_unary_rest_flattened(): def test_move_disk_unary_rest_flattened_error(transport: str = "rest"): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3031,10 +3276,17 @@ def test_move_disk_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.MoveInstanceProjectRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.MoveInstanceProjectRequest, + dict, + ], +) def test_move_instance_unary_rest(request_type): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3144,7 +3396,8 @@ def test_move_instance_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3186,7 +3439,13 @@ def test_move_instance_unary_rest_unset_required_fields(): unset_fields = transport.move_instance._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("instanceMoveRequestResource", "project",)) + set(("requestId",)) + & set( + ( + "instanceMoveRequestResource", + "project", + ) + ) ) @@ -3230,7 +3489,11 @@ def test_move_instance_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.move_instance_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3241,7 +3504,8 @@ def test_move_instance_unary_rest_bad_request( transport: str = "rest", request_type=compute.MoveInstanceProjectRequest ): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3266,7 +3530,8 @@ def test_move_instance_unary_rest_bad_request( def test_move_instance_unary_rest_flattened(): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3308,7 +3573,8 @@ def test_move_instance_unary_rest_flattened(): def test_move_instance_unary_rest_flattened_error(transport: str = "rest"): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3330,11 +3596,16 @@ def test_move_instance_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SetCommonInstanceMetadataProjectRequest, dict,] + "request_type", + [ + compute.SetCommonInstanceMetadataProjectRequest, + dict, + ], ) def test_set_common_instance_metadata_unary_rest(request_type): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3445,7 +3716,8 @@ def test_set_common_instance_metadata_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3487,7 +3759,13 @@ def test_set_common_instance_metadata_unary_rest_unset_required_fields(): unset_fields = transport.set_common_instance_metadata._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("metadataResource", "project",)) + set(("requestId",)) + & set( + ( + "metadataResource", + "project", + ) + ) ) @@ -3531,7 +3809,11 @@ def test_set_common_instance_metadata_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_common_instance_metadata_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3543,7 +3825,8 @@ def test_set_common_instance_metadata_unary_rest_bad_request( request_type=compute.SetCommonInstanceMetadataProjectRequest, ): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3569,7 +3852,8 @@ def test_set_common_instance_metadata_unary_rest_bad_request( def test_set_common_instance_metadata_unary_rest_flattened(): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3612,7 +3896,8 @@ def test_set_common_instance_metadata_unary_rest_flattened_error( transport: str = "rest", ): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3632,11 +3917,16 @@ def test_set_common_instance_metadata_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SetDefaultNetworkTierProjectRequest, dict,] + "request_type", + [ + compute.SetDefaultNetworkTierProjectRequest, + dict, + ], ) def test_set_default_network_tier_unary_rest(request_type): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3745,7 +4035,8 @@ def test_set_default_network_tier_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3788,7 +4079,12 @@ def test_set_default_network_tier_unary_rest_unset_required_fields(): unset_fields = transport.set_default_network_tier._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("project", "projectsSetDefaultNetworkTierRequestResource",)) + & set( + ( + "project", + "projectsSetDefaultNetworkTierRequestResource", + ) + ) ) @@ -3832,7 +4128,11 @@ def test_set_default_network_tier_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_default_network_tier_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3843,7 +4143,8 @@ def test_set_default_network_tier_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetDefaultNetworkTierProjectRequest ): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3867,7 +4168,8 @@ def test_set_default_network_tier_unary_rest_bad_request( def test_set_default_network_tier_unary_rest_flattened(): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3910,7 +4212,8 @@ def test_set_default_network_tier_unary_rest_flattened(): def test_set_default_network_tier_unary_rest_flattened_error(transport: str = "rest"): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3932,11 +4235,16 @@ def test_set_default_network_tier_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SetUsageExportBucketProjectRequest, dict,] + "request_type", + [ + compute.SetUsageExportBucketProjectRequest, + dict, + ], ) def test_set_usage_export_bucket_unary_rest(request_type): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -4046,7 +4354,8 @@ def test_set_usage_export_bucket_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -4088,7 +4397,13 @@ def test_set_usage_export_bucket_unary_rest_unset_required_fields(): unset_fields = transport.set_usage_export_bucket._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "usageExportLocationResource",)) + set(("requestId",)) + & set( + ( + "project", + "usageExportLocationResource", + ) + ) ) @@ -4132,7 +4447,11 @@ def test_set_usage_export_bucket_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_usage_export_bucket_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -4143,7 +4462,8 @@ def test_set_usage_export_bucket_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetUsageExportBucketProjectRequest ): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -4168,7 +4488,8 @@ def test_set_usage_export_bucket_unary_rest_bad_request( def test_set_usage_export_bucket_unary_rest_flattened(): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -4211,7 +4532,8 @@ def test_set_usage_export_bucket_unary_rest_flattened(): def test_set_usage_export_bucket_unary_rest_flattened_error(transport: str = "rest"): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -4239,7 +4561,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -4259,7 +4582,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = ProjectsClient(client_options=options, transport=transport,) + client = ProjectsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -4275,7 +4601,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ProjectsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -4288,7 +4615,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.ProjectsRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.ProjectsRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -4351,7 +4683,8 @@ def test_projects_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ProjectsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -4401,7 +4734,12 @@ def test_projects_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_projects_host_no_port(transport_name): client = ProjectsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4417,7 +4755,12 @@ def test_projects_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_projects_host_with_port(transport_name): client = ProjectsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4455,7 +4798,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = ProjectsClient.common_folder_path(folder) assert expected == actual @@ -4473,7 +4818,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = ProjectsClient.common_organization_path(organization) assert expected == actual @@ -4491,7 +4838,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = ProjectsClient.common_project_path(project) assert expected == actual @@ -4511,7 +4860,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = ProjectsClient.common_location_path(project, location) assert expected == actual @@ -4536,7 +4886,8 @@ def test_client_with_default_client_info(): transports.ProjectsTransport, "_prep_wrapped_messages" ) as prep: client = ProjectsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4545,7 +4896,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ProjectsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4585,7 +4937,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(ProjectsClient, transports.ProjectsRestTransport),], + [ + (ProjectsClient, transports.ProjectsRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_public_advertised_prefixes.py b/tests/unit/gapic/compute_v1/test_public_advertised_prefixes.py index 7ab1cee71..7aa17a1e7 100644 --- a/tests/unit/gapic/compute_v1/test_public_advertised_prefixes.py +++ b/tests/unit/gapic/compute_v1/test_public_advertised_prefixes.py @@ -92,7 +92,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(PublicAdvertisedPrefixesClient, "rest"),] + "client_class,transport_name", + [ + (PublicAdvertisedPrefixesClient, "rest"), + ], ) def test_public_advertised_prefixes_client_from_service_account_info( client_class, transport_name @@ -116,7 +119,9 @@ def test_public_advertised_prefixes_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.PublicAdvertisedPrefixesRestTransport, "rest"),], + [ + (transports.PublicAdvertisedPrefixesRestTransport, "rest"), + ], ) def test_public_advertised_prefixes_client_service_account_always_use_jwt( transport_class, transport_name @@ -137,7 +142,10 @@ def test_public_advertised_prefixes_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(PublicAdvertisedPrefixesClient, "rest"),] + "client_class,transport_name", + [ + (PublicAdvertisedPrefixesClient, "rest"), + ], ) def test_public_advertised_prefixes_client_from_service_account_file( client_class, transport_name @@ -496,7 +504,9 @@ def test_public_advertised_prefixes_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -545,11 +555,16 @@ def test_public_advertised_prefixes_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.DeletePublicAdvertisedPrefixeRequest, dict,] + "request_type", + [ + compute.DeletePublicAdvertisedPrefixeRequest, + dict, + ], ) def test_delete_unary_rest(request_type): client = PublicAdvertisedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -661,7 +676,8 @@ def test_delete_unary_rest_required_fields( ) client = PublicAdvertisedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -702,7 +718,13 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "publicAdvertisedPrefix",)) + set(("requestId",)) + & set( + ( + "project", + "publicAdvertisedPrefix", + ) + ) ) @@ -748,7 +770,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -759,7 +785,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeletePublicAdvertisedPrefixeRequest ): client = PublicAdvertisedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -780,7 +807,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = PublicAdvertisedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -821,7 +849,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = PublicAdvertisedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -841,11 +870,16 @@ def test_delete_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.GetPublicAdvertisedPrefixeRequest, dict,] + "request_type", + [ + compute.GetPublicAdvertisedPrefixeRequest, + dict, + ], ) def test_get_rest(request_type): client = PublicAdvertisedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -933,7 +967,8 @@ def test_get_rest_required_fields( ) client = PublicAdvertisedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -973,7 +1008,15 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("project", "publicAdvertisedPrefix",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "project", + "publicAdvertisedPrefix", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1019,7 +1062,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.PublicAdvertisedPrefix - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1029,7 +1078,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetPublicAdvertisedPrefixeRequest ): client = PublicAdvertisedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1050,7 +1100,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = PublicAdvertisedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1091,7 +1142,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = PublicAdvertisedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1111,11 +1163,16 @@ def test_get_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.InsertPublicAdvertisedPrefixeRequest, dict,] + "request_type", + [ + compute.InsertPublicAdvertisedPrefixeRequest, + dict, + ], ) def test_insert_unary_rest(request_type): client = PublicAdvertisedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1243,7 +1300,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = PublicAdvertisedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1285,7 +1343,13 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "publicAdvertisedPrefixResource",)) + set(("requestId",)) + & set( + ( + "project", + "publicAdvertisedPrefixResource", + ) + ) ) @@ -1331,7 +1395,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1342,7 +1410,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertPublicAdvertisedPrefixeRequest ): client = PublicAdvertisedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1385,7 +1454,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = PublicAdvertisedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1428,7 +1498,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = PublicAdvertisedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1450,11 +1521,16 @@ def test_insert_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.ListPublicAdvertisedPrefixesRequest, dict,] + "request_type", + [ + compute.ListPublicAdvertisedPrefixesRequest, + dict, + ], ) def test_list_rest(request_type): client = PublicAdvertisedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1517,7 +1593,13 @@ def test_list_rest_required_fields( ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1526,7 +1608,8 @@ def test_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = PublicAdvertisedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1567,7 +1650,15 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set(("project",)) ) @@ -1615,7 +1706,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.PublicAdvertisedPrefixList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1625,7 +1722,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListPublicAdvertisedPrefixesRequest ): client = PublicAdvertisedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1646,7 +1744,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = PublicAdvertisedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1658,7 +1757,9 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1684,20 +1785,23 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = PublicAdvertisedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list( - compute.ListPublicAdvertisedPrefixesRequest(), project="project_value", + compute.ListPublicAdvertisedPrefixesRequest(), + project="project_value", ) def test_list_rest_pager(transport: str = "rest"): client = PublicAdvertisedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1714,9 +1818,15 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.PublicAdvertisedPrefixList(items=[], next_page_token="def",), compute.PublicAdvertisedPrefixList( - items=[compute.PublicAdvertisedPrefix(),], next_page_token="ghi", + items=[], + next_page_token="def", + ), + compute.PublicAdvertisedPrefixList( + items=[ + compute.PublicAdvertisedPrefix(), + ], + next_page_token="ghi", ), compute.PublicAdvertisedPrefixList( items=[ @@ -1752,11 +1862,16 @@ def test_list_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.PatchPublicAdvertisedPrefixeRequest, dict,] + "request_type", + [ + compute.PatchPublicAdvertisedPrefixeRequest, + dict, + ], ) def test_patch_unary_rest(request_type): client = PublicAdvertisedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1890,7 +2005,8 @@ def test_patch_unary_rest_required_fields( ) client = PublicAdvertisedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1933,7 +2049,13 @@ def test_patch_unary_rest_unset_required_fields(): unset_fields = transport.patch._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("project", "publicAdvertisedPrefix", "publicAdvertisedPrefixResource",)) + & set( + ( + "project", + "publicAdvertisedPrefix", + "publicAdvertisedPrefixResource", + ) + ) ) @@ -1978,7 +2100,13 @@ def test_patch_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.patch_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1988,7 +2116,8 @@ def test_patch_unary_rest_bad_request( transport: str = "rest", request_type=compute.PatchPublicAdvertisedPrefixeRequest ): client = PublicAdvertisedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2031,7 +2160,8 @@ def test_patch_unary_rest_bad_request( def test_patch_unary_rest_flattened(): client = PublicAdvertisedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2075,7 +2205,8 @@ def test_patch_unary_rest_flattened(): def test_patch_unary_rest_flattened_error(transport: str = "rest"): client = PublicAdvertisedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2104,7 +2235,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = PublicAdvertisedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2125,7 +2257,8 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = PublicAdvertisedPrefixesClient( - client_options=options, transport=transport, + client_options=options, + transport=transport, ) # It is an error to provide an api_key and a credential. @@ -2142,7 +2275,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = PublicAdvertisedPrefixesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2156,7 +2290,10 @@ def test_transport_instance(): @pytest.mark.parametrize( - "transport_class", [transports.PublicAdvertisedPrefixesRestTransport,] + "transport_class", + [ + transports.PublicAdvertisedPrefixesRestTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -2212,7 +2349,8 @@ def test_public_advertised_prefixes_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.PublicAdvertisedPrefixesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2262,7 +2400,12 @@ def test_public_advertised_prefixes_http_transport_client_cert_source_for_mtls() mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_public_advertised_prefixes_host_no_port(transport_name): client = PublicAdvertisedPrefixesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2278,7 +2421,12 @@ def test_public_advertised_prefixes_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_public_advertised_prefixes_host_with_port(transport_name): client = PublicAdvertisedPrefixesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2316,7 +2464,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = PublicAdvertisedPrefixesClient.common_folder_path(folder) assert expected == actual @@ -2334,7 +2484,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = PublicAdvertisedPrefixesClient.common_organization_path(organization) assert expected == actual @@ -2352,7 +2504,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = PublicAdvertisedPrefixesClient.common_project_path(project) assert expected == actual @@ -2372,7 +2526,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = PublicAdvertisedPrefixesClient.common_location_path(project, location) assert expected == actual @@ -2397,7 +2552,8 @@ def test_client_with_default_client_info(): transports.PublicAdvertisedPrefixesTransport, "_prep_wrapped_messages" ) as prep: client = PublicAdvertisedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2406,7 +2562,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = PublicAdvertisedPrefixesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) diff --git a/tests/unit/gapic/compute_v1/test_public_delegated_prefixes.py b/tests/unit/gapic/compute_v1/test_public_delegated_prefixes.py index 6d3cb2550..b4b608c72 100644 --- a/tests/unit/gapic/compute_v1/test_public_delegated_prefixes.py +++ b/tests/unit/gapic/compute_v1/test_public_delegated_prefixes.py @@ -92,7 +92,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(PublicDelegatedPrefixesClient, "rest"),] + "client_class,transport_name", + [ + (PublicDelegatedPrefixesClient, "rest"), + ], ) def test_public_delegated_prefixes_client_from_service_account_info( client_class, transport_name @@ -116,7 +119,9 @@ def test_public_delegated_prefixes_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.PublicDelegatedPrefixesRestTransport, "rest"),], + [ + (transports.PublicDelegatedPrefixesRestTransport, "rest"), + ], ) def test_public_delegated_prefixes_client_service_account_always_use_jwt( transport_class, transport_name @@ -137,7 +142,10 @@ def test_public_delegated_prefixes_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(PublicDelegatedPrefixesClient, "rest"),] + "client_class,transport_name", + [ + (PublicDelegatedPrefixesClient, "rest"), + ], ) def test_public_delegated_prefixes_client_from_service_account_file( client_class, transport_name @@ -492,7 +500,9 @@ def test_public_delegated_prefixes_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -541,11 +551,16 @@ def test_public_delegated_prefixes_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.AggregatedListPublicDelegatedPrefixesRequest, dict,] + "request_type", + [ + compute.AggregatedListPublicDelegatedPrefixesRequest, + dict, + ], ) def test_aggregated_list_rest(request_type): client = PublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -628,7 +643,8 @@ def test_aggregated_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = PublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -729,7 +745,11 @@ def test_aggregated_list_rest_interceptors(null_interceptor): post.return_value = compute.PublicDelegatedPrefixAggregatedList client.aggregated_list( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -741,7 +761,8 @@ def test_aggregated_list_rest_bad_request( request_type=compute.AggregatedListPublicDelegatedPrefixesRequest, ): client = PublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -762,7 +783,8 @@ def test_aggregated_list_rest_bad_request( def test_aggregated_list_rest_flattened(): client = PublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -774,7 +796,9 @@ def test_aggregated_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -802,7 +826,8 @@ def test_aggregated_list_rest_flattened(): def test_aggregated_list_rest_flattened_error(transport: str = "rest"): client = PublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -816,7 +841,8 @@ def test_aggregated_list_rest_flattened_error(transport: str = "rest"): def test_aggregated_list_rest_pager(transport: str = "rest"): client = PublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -834,10 +860,13 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): next_page_token="abc", ), compute.PublicDelegatedPrefixAggregatedList( - items={}, next_page_token="def", + items={}, + next_page_token="def", ), compute.PublicDelegatedPrefixAggregatedList( - items={"g": compute.PublicDelegatedPrefixesScopedList(),}, + items={ + "g": compute.PublicDelegatedPrefixesScopedList(), + }, next_page_token="ghi", ), compute.PublicDelegatedPrefixAggregatedList( @@ -886,11 +915,16 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.DeletePublicDelegatedPrefixeRequest, dict,] + "request_type", + [ + compute.DeletePublicDelegatedPrefixeRequest, + dict, + ], ) def test_delete_unary_rest(request_type): client = PublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1008,7 +1042,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = PublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1049,7 +1084,14 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "publicDelegatedPrefix", "region",)) + set(("requestId",)) + & set( + ( + "project", + "publicDelegatedPrefix", + "region", + ) + ) ) @@ -1095,7 +1137,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1106,7 +1152,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeletePublicDelegatedPrefixeRequest ): client = PublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1131,7 +1178,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = PublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1177,7 +1225,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = PublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1198,11 +1247,16 @@ def test_delete_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.GetPublicDelegatedPrefixeRequest, dict,] + "request_type", + [ + compute.GetPublicDelegatedPrefixeRequest, + dict, + ], ) def test_get_rest(request_type): client = PublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1298,7 +1352,8 @@ def test_get_rest_required_fields( assert jsonified_request["region"] == "region_value" client = PublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1339,7 +1394,14 @@ def test_get_rest_unset_required_fields(): unset_fields = transport.get._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("project", "publicDelegatedPrefix", "region",)) + set(()) + & set( + ( + "project", + "publicDelegatedPrefix", + "region", + ) + ) ) @@ -1386,7 +1448,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.PublicDelegatedPrefix - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1396,7 +1464,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetPublicDelegatedPrefixeRequest ): client = PublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1421,7 +1490,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = PublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1467,7 +1537,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = PublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1488,11 +1559,16 @@ def test_get_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.InsertPublicDelegatedPrefixeRequest, dict,] + "request_type", + [ + compute.InsertPublicDelegatedPrefixeRequest, + dict, + ], ) def test_insert_unary_rest(request_type): client = PublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1627,7 +1703,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = PublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1670,7 +1747,13 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("project", "publicDelegatedPrefixResource", "region",)) + & set( + ( + "project", + "publicDelegatedPrefixResource", + "region", + ) + ) ) @@ -1716,7 +1799,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1727,7 +1814,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertPublicDelegatedPrefixeRequest ): client = PublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1773,7 +1861,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = PublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1817,7 +1906,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = PublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1840,11 +1930,16 @@ def test_insert_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.ListPublicDelegatedPrefixesRequest, dict,] + "request_type", + [ + compute.ListPublicDelegatedPrefixesRequest, + dict, + ], ) def test_list_rest(request_type): client = PublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1909,7 +2004,13 @@ def test_list_rest_required_fields( ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1920,7 +2021,8 @@ def test_list_rest_required_fields( assert jsonified_request["region"] == "region_value" client = PublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1961,8 +2063,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "region",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "region", + ) + ) ) @@ -2009,7 +2124,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.PublicDelegatedPrefixList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2019,7 +2140,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListPublicDelegatedPrefixesRequest ): client = PublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2040,7 +2162,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = PublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2052,7 +2175,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "region": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", region="region_value",) + mock_args = dict( + project="project_value", + region="region_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2078,7 +2204,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = PublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2093,7 +2220,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = PublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2110,9 +2238,15 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.PublicDelegatedPrefixList(items=[], next_page_token="def",), compute.PublicDelegatedPrefixList( - items=[compute.PublicDelegatedPrefix(),], next_page_token="ghi", + items=[], + next_page_token="def", + ), + compute.PublicDelegatedPrefixList( + items=[ + compute.PublicDelegatedPrefix(), + ], + next_page_token="ghi", ), compute.PublicDelegatedPrefixList( items=[ @@ -2146,11 +2280,16 @@ def test_list_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.PatchPublicDelegatedPrefixeRequest, dict,] + "request_type", + [ + compute.PatchPublicDelegatedPrefixeRequest, + dict, + ], ) def test_patch_unary_rest(request_type): client = PublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2293,7 +2432,8 @@ def test_patch_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = PublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2388,7 +2528,13 @@ def test_patch_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.patch_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2398,7 +2544,8 @@ def test_patch_unary_rest_bad_request( transport: str = "rest", request_type=compute.PatchPublicDelegatedPrefixeRequest ): client = PublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2448,7 +2595,8 @@ def test_patch_unary_rest_bad_request( def test_patch_unary_rest_flattened(): client = PublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2497,7 +2645,8 @@ def test_patch_unary_rest_flattened(): def test_patch_unary_rest_flattened_error(transport: str = "rest"): client = PublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2527,7 +2676,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = PublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2548,7 +2698,8 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = PublicDelegatedPrefixesClient( - client_options=options, transport=transport, + client_options=options, + transport=transport, ) # It is an error to provide an api_key and a credential. @@ -2565,7 +2716,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = PublicDelegatedPrefixesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2579,7 +2731,10 @@ def test_transport_instance(): @pytest.mark.parametrize( - "transport_class", [transports.PublicDelegatedPrefixesRestTransport,] + "transport_class", + [ + transports.PublicDelegatedPrefixesRestTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -2636,7 +2791,8 @@ def test_public_delegated_prefixes_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.PublicDelegatedPrefixesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2686,7 +2842,12 @@ def test_public_delegated_prefixes_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_public_delegated_prefixes_host_no_port(transport_name): client = PublicDelegatedPrefixesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2702,7 +2863,12 @@ def test_public_delegated_prefixes_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_public_delegated_prefixes_host_with_port(transport_name): client = PublicDelegatedPrefixesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2740,7 +2906,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = PublicDelegatedPrefixesClient.common_folder_path(folder) assert expected == actual @@ -2758,7 +2926,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = PublicDelegatedPrefixesClient.common_organization_path(organization) assert expected == actual @@ -2776,7 +2946,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = PublicDelegatedPrefixesClient.common_project_path(project) assert expected == actual @@ -2796,7 +2968,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = PublicDelegatedPrefixesClient.common_location_path(project, location) assert expected == actual @@ -2821,7 +2994,8 @@ def test_client_with_default_client_info(): transports.PublicDelegatedPrefixesTransport, "_prep_wrapped_messages" ) as prep: client = PublicDelegatedPrefixesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2830,7 +3004,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = PublicDelegatedPrefixesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2870,7 +3045,12 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(PublicDelegatedPrefixesClient, transports.PublicDelegatedPrefixesRestTransport),], + [ + ( + PublicDelegatedPrefixesClient, + transports.PublicDelegatedPrefixesRestTransport, + ), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_region_autoscalers.py b/tests/unit/gapic/compute_v1/test_region_autoscalers.py index 5bf440290..4c5718cfd 100644 --- a/tests/unit/gapic/compute_v1/test_region_autoscalers.py +++ b/tests/unit/gapic/compute_v1/test_region_autoscalers.py @@ -90,7 +90,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(RegionAutoscalersClient, "rest"),] + "client_class,transport_name", + [ + (RegionAutoscalersClient, "rest"), + ], ) def test_region_autoscalers_client_from_service_account_info( client_class, transport_name @@ -114,7 +117,9 @@ def test_region_autoscalers_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.RegionAutoscalersRestTransport, "rest"),], + [ + (transports.RegionAutoscalersRestTransport, "rest"), + ], ) def test_region_autoscalers_client_service_account_always_use_jwt( transport_class, transport_name @@ -135,7 +140,10 @@ def test_region_autoscalers_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(RegionAutoscalersClient, "rest"),] + "client_class,transport_name", + [ + (RegionAutoscalersClient, "rest"), + ], ) def test_region_autoscalers_client_from_service_account_file( client_class, transport_name @@ -177,7 +185,9 @@ def test_region_autoscalers_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(RegionAutoscalersClient, transports.RegionAutoscalersRestTransport, "rest"),], + [ + (RegionAutoscalersClient, transports.RegionAutoscalersRestTransport, "rest"), + ], ) @mock.patch.object( RegionAutoscalersClient, @@ -470,13 +480,17 @@ def test_region_autoscalers_client_get_mtls_endpoint_and_cert_source(client_clas @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(RegionAutoscalersClient, transports.RegionAutoscalersRestTransport, "rest"),], + [ + (RegionAutoscalersClient, transports.RegionAutoscalersRestTransport, "rest"), + ], ) def test_region_autoscalers_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -524,10 +538,17 @@ def test_region_autoscalers_client_client_options_credentials_file( ) -@pytest.mark.parametrize("request_type", [compute.DeleteRegionAutoscalerRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteRegionAutoscalerRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = RegionAutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -641,7 +662,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionAutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -682,7 +704,14 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("autoscaler", "project", "region",)) + set(("requestId",)) + & set( + ( + "autoscaler", + "project", + "region", + ) + ) ) @@ -728,7 +757,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -739,7 +772,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteRegionAutoscalerRequest ): client = RegionAutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -760,7 +794,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = RegionAutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -806,7 +841,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = RegionAutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -826,10 +862,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetRegionAutoscalerRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetRegionAutoscalerRequest, + dict, + ], +) def test_get_rest(request_type): client = RegionAutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -917,7 +960,8 @@ def test_get_rest_required_fields(request_type=compute.GetRegionAutoscalerReques assert jsonified_request["region"] == "region_value" client = RegionAutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -957,7 +1001,16 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("autoscaler", "project", "region",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "autoscaler", + "project", + "region", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1001,7 +1054,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Autoscaler - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1011,7 +1070,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetRegionAutoscalerRequest ): client = RegionAutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1032,7 +1092,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = RegionAutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1078,7 +1139,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = RegionAutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1098,10 +1160,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertRegionAutoscalerRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertRegionAutoscalerRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = RegionAutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1255,7 +1324,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionAutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1297,7 +1367,14 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("autoscalerResource", "project", "region",)) + set(("requestId",)) + & set( + ( + "autoscalerResource", + "project", + "region", + ) + ) ) @@ -1343,7 +1420,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1354,7 +1435,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertRegionAutoscalerRequest ): client = RegionAutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1419,7 +1501,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = RegionAutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1463,7 +1546,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = RegionAutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1485,10 +1569,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListRegionAutoscalersRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListRegionAutoscalersRequest, + dict, + ], +) def test_list_rest(request_type): client = RegionAutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1551,7 +1642,13 @@ def test_list_rest_required_fields(request_type=compute.ListRegionAutoscalersReq ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1562,7 +1659,8 @@ def test_list_rest_required_fields(request_type=compute.ListRegionAutoscalersReq assert jsonified_request["region"] == "region_value" client = RegionAutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1603,8 +1701,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "region",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "region", + ) + ) ) @@ -1651,7 +1762,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.RegionAutoscalerList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1661,7 +1778,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListRegionAutoscalersRequest ): client = RegionAutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1682,7 +1800,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = RegionAutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1694,7 +1813,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "region": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", region="region_value",) + mock_args = dict( + project="project_value", + region="region_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1720,7 +1842,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = RegionAutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1735,7 +1858,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = RegionAutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1752,12 +1876,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.RegionAutoscalerList(items=[], next_page_token="def",), compute.RegionAutoscalerList( - items=[compute.Autoscaler(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.RegionAutoscalerList( - items=[compute.Autoscaler(), compute.Autoscaler(),], + items=[ + compute.Autoscaler(), + ], + next_page_token="ghi", + ), + compute.RegionAutoscalerList( + items=[ + compute.Autoscaler(), + compute.Autoscaler(), + ], ), ) # Two responses for two calls @@ -1784,10 +1917,17 @@ def test_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.PatchRegionAutoscalerRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.PatchRegionAutoscalerRequest, + dict, + ], +) def test_patch_unary_rest(request_type): client = RegionAutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1931,7 +2071,12 @@ def test_patch_unary_rest_required_fields( credentials=ga_credentials.AnonymousCredentials() ).patch._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("autoscaler", "request_id",)) + assert not set(unset_fields) - set( + ( + "autoscaler", + "request_id", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -1941,7 +2086,8 @@ def test_patch_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionAutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1983,8 +2129,19 @@ def test_patch_unary_rest_unset_required_fields(): unset_fields = transport.patch._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("autoscaler", "requestId",)) - & set(("autoscalerResource", "project", "region",)) + set( + ( + "autoscaler", + "requestId", + ) + ) + & set( + ( + "autoscalerResource", + "project", + "region", + ) + ) ) @@ -2029,7 +2186,13 @@ def test_patch_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.patch_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2039,7 +2202,8 @@ def test_patch_unary_rest_bad_request( transport: str = "rest", request_type=compute.PatchRegionAutoscalerRequest ): client = RegionAutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2104,7 +2268,8 @@ def test_patch_unary_rest_bad_request( def test_patch_unary_rest_flattened(): client = RegionAutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2148,7 +2313,8 @@ def test_patch_unary_rest_flattened(): def test_patch_unary_rest_flattened_error(transport: str = "rest"): client = RegionAutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2170,10 +2336,17 @@ def test_patch_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.UpdateRegionAutoscalerRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.UpdateRegionAutoscalerRequest, + dict, + ], +) def test_update_unary_rest(request_type): client = RegionAutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2317,7 +2490,12 @@ def test_update_unary_rest_required_fields( credentials=ga_credentials.AnonymousCredentials() ).update._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("autoscaler", "request_id",)) + assert not set(unset_fields) - set( + ( + "autoscaler", + "request_id", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -2327,7 +2505,8 @@ def test_update_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionAutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2369,8 +2548,19 @@ def test_update_unary_rest_unset_required_fields(): unset_fields = transport.update._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("autoscaler", "requestId",)) - & set(("autoscalerResource", "project", "region",)) + set( + ( + "autoscaler", + "requestId", + ) + ) + & set( + ( + "autoscalerResource", + "project", + "region", + ) + ) ) @@ -2416,7 +2606,11 @@ def test_update_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.update_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2427,7 +2621,8 @@ def test_update_unary_rest_bad_request( transport: str = "rest", request_type=compute.UpdateRegionAutoscalerRequest ): client = RegionAutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2492,7 +2687,8 @@ def test_update_unary_rest_bad_request( def test_update_unary_rest_flattened(): client = RegionAutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2536,7 +2732,8 @@ def test_update_unary_rest_flattened(): def test_update_unary_rest_flattened_error(transport: str = "rest"): client = RegionAutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2565,7 +2762,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RegionAutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2585,7 +2783,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = RegionAutoscalersClient(client_options=options, transport=transport,) + client = RegionAutoscalersClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2601,7 +2802,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RegionAutoscalersClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2615,7 +2817,10 @@ def test_transport_instance(): @pytest.mark.parametrize( - "transport_class", [transports.RegionAutoscalersRestTransport,] + "transport_class", + [ + transports.RegionAutoscalersRestTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -2672,7 +2877,8 @@ def test_region_autoscalers_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.RegionAutoscalersTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2722,7 +2928,12 @@ def test_region_autoscalers_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_region_autoscalers_host_no_port(transport_name): client = RegionAutoscalersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2738,7 +2949,12 @@ def test_region_autoscalers_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_region_autoscalers_host_with_port(transport_name): client = RegionAutoscalersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2776,7 +2992,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = RegionAutoscalersClient.common_folder_path(folder) assert expected == actual @@ -2794,7 +3012,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = RegionAutoscalersClient.common_organization_path(organization) assert expected == actual @@ -2812,7 +3032,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = RegionAutoscalersClient.common_project_path(project) assert expected == actual @@ -2832,7 +3054,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = RegionAutoscalersClient.common_location_path(project, location) assert expected == actual @@ -2857,7 +3080,8 @@ def test_client_with_default_client_info(): transports.RegionAutoscalersTransport, "_prep_wrapped_messages" ) as prep: client = RegionAutoscalersClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2866,7 +3090,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = RegionAutoscalersClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2906,7 +3131,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(RegionAutoscalersClient, transports.RegionAutoscalersRestTransport),], + [ + (RegionAutoscalersClient, transports.RegionAutoscalersRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_region_backend_services.py b/tests/unit/gapic/compute_v1/test_region_backend_services.py index 3d0c51623..ea21ceb37 100644 --- a/tests/unit/gapic/compute_v1/test_region_backend_services.py +++ b/tests/unit/gapic/compute_v1/test_region_backend_services.py @@ -92,7 +92,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(RegionBackendServicesClient, "rest"),] + "client_class,transport_name", + [ + (RegionBackendServicesClient, "rest"), + ], ) def test_region_backend_services_client_from_service_account_info( client_class, transport_name @@ -116,7 +119,9 @@ def test_region_backend_services_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.RegionBackendServicesRestTransport, "rest"),], + [ + (transports.RegionBackendServicesRestTransport, "rest"), + ], ) def test_region_backend_services_client_service_account_always_use_jwt( transport_class, transport_name @@ -137,7 +142,10 @@ def test_region_backend_services_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(RegionBackendServicesClient, "rest"),] + "client_class,transport_name", + [ + (RegionBackendServicesClient, "rest"), + ], ) def test_region_backend_services_client_from_service_account_file( client_class, transport_name @@ -490,7 +498,9 @@ def test_region_backend_services_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -539,11 +549,16 @@ def test_region_backend_services_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.DeleteRegionBackendServiceRequest, dict,] + "request_type", + [ + compute.DeleteRegionBackendServiceRequest, + dict, + ], ) def test_delete_unary_rest(request_type): client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -661,7 +676,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -702,7 +718,14 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("backendService", "project", "region",)) + set(("requestId",)) + & set( + ( + "backendService", + "project", + "region", + ) + ) ) @@ -748,7 +771,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -759,7 +786,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteRegionBackendServiceRequest ): client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -784,7 +812,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -830,7 +859,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -851,11 +881,16 @@ def test_delete_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.GetRegionBackendServiceRequest, dict,] + "request_type", + [ + compute.GetRegionBackendServiceRequest, + dict, + ], ) def test_get_rest(request_type): client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -971,7 +1006,8 @@ def test_get_rest_required_fields(request_type=compute.GetRegionBackendServiceRe assert jsonified_request["region"] == "region_value" client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1012,7 +1048,14 @@ def test_get_rest_unset_required_fields(): unset_fields = transport.get._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("backendService", "project", "region",)) + set(()) + & set( + ( + "backendService", + "project", + "region", + ) + ) ) @@ -1059,7 +1102,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.BackendService - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1069,7 +1118,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetRegionBackendServiceRequest ): client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1094,7 +1144,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1140,7 +1191,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1161,11 +1213,16 @@ def test_get_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.GetHealthRegionBackendServiceRequest, dict,] + "request_type", + [ + compute.GetHealthRegionBackendServiceRequest, + dict, + ], ) def test_get_health_rest(request_type): client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1180,7 +1237,9 @@ def test_get_health_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = compute.BackendServiceGroupHealth(kind="kind_value",) + return_value = compute.BackendServiceGroupHealth( + kind="kind_value", + ) # Wrap the value into a proper Response obj response_value = Response() @@ -1238,7 +1297,8 @@ def test_get_health_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1282,7 +1342,12 @@ def test_get_health_rest_unset_required_fields(): assert set(unset_fields) == ( set(()) & set( - ("backendService", "project", "region", "resourceGroupReferenceResource",) + ( + "backendService", + "project", + "region", + "resourceGroupReferenceResource", + ) ) ) @@ -1330,7 +1395,13 @@ def test_get_health_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.BackendServiceGroupHealth - client.get_health(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get_health( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1340,7 +1411,8 @@ def test_get_health_rest_bad_request( transport: str = "rest", request_type=compute.GetHealthRegionBackendServiceRequest ): client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1366,7 +1438,8 @@ def test_get_health_rest_bad_request( def test_get_health_rest_flattened(): client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1415,7 +1488,8 @@ def test_get_health_rest_flattened(): def test_get_health_rest_flattened_error(transport: str = "rest"): client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1439,11 +1513,16 @@ def test_get_health_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.InsertRegionBackendServiceRequest, dict,] + "request_type", + [ + compute.InsertRegionBackendServiceRequest, + dict, + ], ) def test_insert_unary_rest(request_type): client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1693,7 +1772,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1735,7 +1815,14 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("backendServiceResource", "project", "region",)) + set(("requestId",)) + & set( + ( + "backendServiceResource", + "project", + "region", + ) + ) ) @@ -1781,7 +1868,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1792,7 +1883,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertRegionBackendServiceRequest ): client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1953,7 +2045,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1997,7 +2090,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2020,11 +2114,16 @@ def test_insert_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.ListRegionBackendServicesRequest, dict,] + "request_type", + [ + compute.ListRegionBackendServicesRequest, + dict, + ], ) def test_list_rest(request_type): client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2089,7 +2188,13 @@ def test_list_rest_required_fields( ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -2100,7 +2205,8 @@ def test_list_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2141,8 +2247,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "region",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "region", + ) + ) ) @@ -2189,7 +2308,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.BackendServiceList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2199,7 +2324,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListRegionBackendServicesRequest ): client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2220,7 +2346,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2232,7 +2359,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "region": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", region="region_value",) + mock_args = dict( + project="project_value", + region="region_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2258,7 +2388,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2273,7 +2404,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2290,12 +2422,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.BackendServiceList(items=[], next_page_token="def",), compute.BackendServiceList( - items=[compute.BackendService(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.BackendServiceList( - items=[compute.BackendService(), compute.BackendService(),], + items=[ + compute.BackendService(), + ], + next_page_token="ghi", + ), + compute.BackendServiceList( + items=[ + compute.BackendService(), + compute.BackendService(), + ], ), ) # Two responses for two calls @@ -2323,11 +2464,16 @@ def test_list_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.PatchRegionBackendServiceRequest, dict,] + "request_type", + [ + compute.PatchRegionBackendServiceRequest, + dict, + ], ) def test_patch_unary_rest(request_type): client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2585,7 +2731,8 @@ def test_patch_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2628,7 +2775,14 @@ def test_patch_unary_rest_unset_required_fields(): unset_fields = transport.patch._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("backendService", "backendServiceResource", "project", "region",)) + & set( + ( + "backendService", + "backendServiceResource", + "project", + "region", + ) + ) ) @@ -2673,7 +2827,13 @@ def test_patch_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.patch_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2683,7 +2843,8 @@ def test_patch_unary_rest_bad_request( transport: str = "rest", request_type=compute.PatchRegionBackendServiceRequest ): client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2848,7 +3009,8 @@ def test_patch_unary_rest_bad_request( def test_patch_unary_rest_flattened(): client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2897,7 +3059,8 @@ def test_patch_unary_rest_flattened(): def test_patch_unary_rest_flattened_error(transport: str = "rest"): client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2921,11 +3084,16 @@ def test_patch_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.UpdateRegionBackendServiceRequest, dict,] + "request_type", + [ + compute.UpdateRegionBackendServiceRequest, + dict, + ], ) def test_update_unary_rest(request_type): client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3183,7 +3351,8 @@ def test_update_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3226,7 +3395,14 @@ def test_update_unary_rest_unset_required_fields(): unset_fields = transport.update._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("backendService", "backendServiceResource", "project", "region",)) + & set( + ( + "backendService", + "backendServiceResource", + "project", + "region", + ) + ) ) @@ -3272,7 +3448,11 @@ def test_update_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.update_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3283,7 +3463,8 @@ def test_update_unary_rest_bad_request( transport: str = "rest", request_type=compute.UpdateRegionBackendServiceRequest ): client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3448,7 +3629,8 @@ def test_update_unary_rest_bad_request( def test_update_unary_rest_flattened(): client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3497,7 +3679,8 @@ def test_update_unary_rest_flattened(): def test_update_unary_rest_flattened_error(transport: str = "rest"): client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3527,7 +3710,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -3548,7 +3732,8 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = RegionBackendServicesClient( - client_options=options, transport=transport, + client_options=options, + transport=transport, ) # It is an error to provide an api_key and a credential. @@ -3565,7 +3750,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RegionBackendServicesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -3579,7 +3765,10 @@ def test_transport_instance(): @pytest.mark.parametrize( - "transport_class", [transports.RegionBackendServicesRestTransport,] + "transport_class", + [ + transports.RegionBackendServicesRestTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -3637,7 +3826,8 @@ def test_region_backend_services_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.RegionBackendServicesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -3687,7 +3877,12 @@ def test_region_backend_services_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_region_backend_services_host_no_port(transport_name): client = RegionBackendServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3703,7 +3898,12 @@ def test_region_backend_services_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_region_backend_services_host_with_port(transport_name): client = RegionBackendServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3741,7 +3941,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = RegionBackendServicesClient.common_folder_path(folder) assert expected == actual @@ -3759,7 +3961,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = RegionBackendServicesClient.common_organization_path(organization) assert expected == actual @@ -3777,7 +3981,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = RegionBackendServicesClient.common_project_path(project) assert expected == actual @@ -3797,7 +4003,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = RegionBackendServicesClient.common_location_path(project, location) assert expected == actual @@ -3822,7 +4029,8 @@ def test_client_with_default_client_info(): transports.RegionBackendServicesTransport, "_prep_wrapped_messages" ) as prep: client = RegionBackendServicesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3831,7 +4039,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = RegionBackendServicesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3871,7 +4080,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(RegionBackendServicesClient, transports.RegionBackendServicesRestTransport),], + [ + (RegionBackendServicesClient, transports.RegionBackendServicesRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_region_commitments.py b/tests/unit/gapic/compute_v1/test_region_commitments.py index 61de40a27..119d9ce89 100644 --- a/tests/unit/gapic/compute_v1/test_region_commitments.py +++ b/tests/unit/gapic/compute_v1/test_region_commitments.py @@ -90,7 +90,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(RegionCommitmentsClient, "rest"),] + "client_class,transport_name", + [ + (RegionCommitmentsClient, "rest"), + ], ) def test_region_commitments_client_from_service_account_info( client_class, transport_name @@ -114,7 +117,9 @@ def test_region_commitments_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.RegionCommitmentsRestTransport, "rest"),], + [ + (transports.RegionCommitmentsRestTransport, "rest"), + ], ) def test_region_commitments_client_service_account_always_use_jwt( transport_class, transport_name @@ -135,7 +140,10 @@ def test_region_commitments_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(RegionCommitmentsClient, "rest"),] + "client_class,transport_name", + [ + (RegionCommitmentsClient, "rest"), + ], ) def test_region_commitments_client_from_service_account_file( client_class, transport_name @@ -177,7 +185,9 @@ def test_region_commitments_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(RegionCommitmentsClient, transports.RegionCommitmentsRestTransport, "rest"),], + [ + (RegionCommitmentsClient, transports.RegionCommitmentsRestTransport, "rest"), + ], ) @mock.patch.object( RegionCommitmentsClient, @@ -470,13 +480,17 @@ def test_region_commitments_client_get_mtls_endpoint_and_cert_source(client_clas @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(RegionCommitmentsClient, transports.RegionCommitmentsRestTransport, "rest"),], + [ + (RegionCommitmentsClient, transports.RegionCommitmentsRestTransport, "rest"), + ], ) def test_region_commitments_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -525,11 +539,16 @@ def test_region_commitments_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.AggregatedListRegionCommitmentsRequest, dict,] + "request_type", + [ + compute.AggregatedListRegionCommitmentsRequest, + dict, + ], ) def test_aggregated_list_rest(request_type): client = RegionCommitmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -610,7 +629,8 @@ def test_aggregated_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = RegionCommitmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -709,7 +729,11 @@ def test_aggregated_list_rest_interceptors(null_interceptor): post.return_value = compute.CommitmentAggregatedList client.aggregated_list( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -720,7 +744,8 @@ def test_aggregated_list_rest_bad_request( transport: str = "rest", request_type=compute.AggregatedListRegionCommitmentsRequest ): client = RegionCommitmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -741,7 +766,8 @@ def test_aggregated_list_rest_bad_request( def test_aggregated_list_rest_flattened(): client = RegionCommitmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -753,7 +779,9 @@ def test_aggregated_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -779,20 +807,23 @@ def test_aggregated_list_rest_flattened(): def test_aggregated_list_rest_flattened_error(transport: str = "rest"): client = RegionCommitmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.aggregated_list( - compute.AggregatedListRegionCommitmentsRequest(), project="project_value", + compute.AggregatedListRegionCommitmentsRequest(), + project="project_value", ) def test_aggregated_list_rest_pager(transport: str = "rest"): client = RegionCommitmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -809,9 +840,15 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): }, next_page_token="abc", ), - compute.CommitmentAggregatedList(items={}, next_page_token="def",), compute.CommitmentAggregatedList( - items={"g": compute.CommitmentsScopedList(),}, next_page_token="ghi", + items={}, + next_page_token="def", + ), + compute.CommitmentAggregatedList( + items={ + "g": compute.CommitmentsScopedList(), + }, + next_page_token="ghi", ), compute.CommitmentAggregatedList( items={ @@ -856,10 +893,17 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.GetRegionCommitmentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetRegionCommitmentRequest, + dict, + ], +) def test_get_rest(request_type): client = RegionCommitmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -955,7 +999,8 @@ def test_get_rest_required_fields(request_type=compute.GetRegionCommitmentReques assert jsonified_request["region"] == "region_value" client = RegionCommitmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -995,7 +1040,16 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("commitment", "project", "region",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "commitment", + "project", + "region", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1039,7 +1093,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Commitment - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1049,7 +1109,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetRegionCommitmentRequest ): client = RegionCommitmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1070,7 +1131,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = RegionCommitmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1116,7 +1178,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = RegionCommitmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1136,10 +1199,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertRegionCommitmentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertRegionCommitmentRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = RegionCommitmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1312,7 +1382,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionCommitmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1354,7 +1425,14 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("commitmentResource", "project", "region",)) + set(("requestId",)) + & set( + ( + "commitmentResource", + "project", + "region", + ) + ) ) @@ -1400,7 +1478,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1411,7 +1493,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertRegionCommitmentRequest ): client = RegionCommitmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1495,7 +1578,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = RegionCommitmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1537,7 +1621,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = RegionCommitmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1557,10 +1642,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListRegionCommitmentsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListRegionCommitmentsRequest, + dict, + ], +) def test_list_rest(request_type): client = RegionCommitmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1623,7 +1715,13 @@ def test_list_rest_required_fields(request_type=compute.ListRegionCommitmentsReq ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1634,7 +1732,8 @@ def test_list_rest_required_fields(request_type=compute.ListRegionCommitmentsReq assert jsonified_request["region"] == "region_value" client = RegionCommitmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1675,8 +1774,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "region",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "region", + ) + ) ) @@ -1723,7 +1835,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.CommitmentList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1733,7 +1851,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListRegionCommitmentsRequest ): client = RegionCommitmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1754,7 +1873,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = RegionCommitmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1766,7 +1886,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "region": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", region="region_value",) + mock_args = dict( + project="project_value", + region="region_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1792,7 +1915,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = RegionCommitmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1807,7 +1931,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = RegionCommitmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1824,12 +1949,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.CommitmentList(items=[], next_page_token="def",), compute.CommitmentList( - items=[compute.Commitment(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.CommitmentList( - items=[compute.Commitment(), compute.Commitment(),], + items=[ + compute.Commitment(), + ], + next_page_token="ghi", + ), + compute.CommitmentList( + items=[ + compute.Commitment(), + compute.Commitment(), + ], ), ) # Two responses for two calls @@ -1856,10 +1990,17 @@ def test_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.UpdateRegionCommitmentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.UpdateRegionCommitmentRequest, + dict, + ], +) def test_update_unary_rest(request_type): client = RegionCommitmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2024,7 +2165,13 @@ def test_update_unary_rest_required_fields( credentials=ga_credentials.AnonymousCredentials() ).update._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("paths", "request_id", "update_mask",)) + assert not set(unset_fields) - set( + ( + "paths", + "request_id", + "update_mask", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -2036,7 +2183,8 @@ def test_update_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionCommitmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2078,8 +2226,21 @@ def test_update_unary_rest_unset_required_fields(): unset_fields = transport.update._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("paths", "requestId", "updateMask",)) - & set(("commitment", "commitmentResource", "project", "region",)) + set( + ( + "paths", + "requestId", + "updateMask", + ) + ) + & set( + ( + "commitment", + "commitmentResource", + "project", + "region", + ) + ) ) @@ -2125,7 +2286,11 @@ def test_update_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.update_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2136,7 +2301,8 @@ def test_update_unary_rest_bad_request( transport: str = "rest", request_type=compute.UpdateRegionCommitmentRequest ): client = RegionCommitmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2220,7 +2386,8 @@ def test_update_unary_rest_bad_request( def test_update_unary_rest_flattened(): client = RegionCommitmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2267,7 +2434,8 @@ def test_update_unary_rest_flattened(): def test_update_unary_rest_flattened_error(transport: str = "rest"): client = RegionCommitmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2295,7 +2463,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RegionCommitmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2315,7 +2484,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = RegionCommitmentsClient(client_options=options, transport=transport,) + client = RegionCommitmentsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2331,7 +2503,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RegionCommitmentsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2345,7 +2518,10 @@ def test_transport_instance(): @pytest.mark.parametrize( - "transport_class", [transports.RegionCommitmentsRestTransport,] + "transport_class", + [ + transports.RegionCommitmentsRestTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -2401,7 +2577,8 @@ def test_region_commitments_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.RegionCommitmentsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2451,7 +2628,12 @@ def test_region_commitments_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_region_commitments_host_no_port(transport_name): client = RegionCommitmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2467,7 +2649,12 @@ def test_region_commitments_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_region_commitments_host_with_port(transport_name): client = RegionCommitmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2505,7 +2692,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = RegionCommitmentsClient.common_folder_path(folder) assert expected == actual @@ -2523,7 +2712,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = RegionCommitmentsClient.common_organization_path(organization) assert expected == actual @@ -2541,7 +2732,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = RegionCommitmentsClient.common_project_path(project) assert expected == actual @@ -2561,7 +2754,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = RegionCommitmentsClient.common_location_path(project, location) assert expected == actual @@ -2586,7 +2780,8 @@ def test_client_with_default_client_info(): transports.RegionCommitmentsTransport, "_prep_wrapped_messages" ) as prep: client = RegionCommitmentsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2595,7 +2790,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = RegionCommitmentsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2635,7 +2831,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(RegionCommitmentsClient, transports.RegionCommitmentsRestTransport),], + [ + (RegionCommitmentsClient, transports.RegionCommitmentsRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_region_disk_types.py b/tests/unit/gapic/compute_v1/test_region_disk_types.py index cb758b27e..4e5535b2d 100644 --- a/tests/unit/gapic/compute_v1/test_region_disk_types.py +++ b/tests/unit/gapic/compute_v1/test_region_disk_types.py @@ -89,7 +89,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(RegionDiskTypesClient, "rest"),] + "client_class,transport_name", + [ + (RegionDiskTypesClient, "rest"), + ], ) def test_region_disk_types_client_from_service_account_info( client_class, transport_name @@ -113,7 +116,9 @@ def test_region_disk_types_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.RegionDiskTypesRestTransport, "rest"),], + [ + (transports.RegionDiskTypesRestTransport, "rest"), + ], ) def test_region_disk_types_client_service_account_always_use_jwt( transport_class, transport_name @@ -134,7 +139,10 @@ def test_region_disk_types_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(RegionDiskTypesClient, "rest"),] + "client_class,transport_name", + [ + (RegionDiskTypesClient, "rest"), + ], ) def test_region_disk_types_client_from_service_account_file( client_class, transport_name @@ -176,7 +184,9 @@ def test_region_disk_types_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(RegionDiskTypesClient, transports.RegionDiskTypesRestTransport, "rest"),], + [ + (RegionDiskTypesClient, transports.RegionDiskTypesRestTransport, "rest"), + ], ) @mock.patch.object( RegionDiskTypesClient, @@ -469,13 +479,17 @@ def test_region_disk_types_client_get_mtls_endpoint_and_cert_source(client_class @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(RegionDiskTypesClient, transports.RegionDiskTypesRestTransport, "rest"),], + [ + (RegionDiskTypesClient, transports.RegionDiskTypesRestTransport, "rest"), + ], ) def test_region_disk_types_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -493,7 +507,9 @@ def test_region_disk_types_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(RegionDiskTypesClient, transports.RegionDiskTypesRestTransport, "rest", None),], + [ + (RegionDiskTypesClient, transports.RegionDiskTypesRestTransport, "rest", None), + ], ) def test_region_disk_types_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -516,10 +532,17 @@ def test_region_disk_types_client_client_options_credentials_file( ) -@pytest.mark.parametrize("request_type", [compute.GetRegionDiskTypeRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetRegionDiskTypeRequest, + dict, + ], +) def test_get_rest(request_type): client = RegionDiskTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -605,7 +628,8 @@ def test_get_rest_required_fields(request_type=compute.GetRegionDiskTypeRequest) assert jsonified_request["region"] == "region_value" client = RegionDiskTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -645,7 +669,16 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("diskType", "project", "region",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "diskType", + "project", + "region", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -689,7 +722,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.DiskType - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -699,7 +738,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetRegionDiskTypeRequest ): client = RegionDiskTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -720,7 +760,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = RegionDiskTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -737,7 +778,9 @@ def test_get_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", region="region_value", disk_type="disk_type_value", + project="project_value", + region="region_value", + disk_type="disk_type_value", ) mock_args.update(sample_request) @@ -764,7 +807,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = RegionDiskTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -784,10 +828,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListRegionDiskTypesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListRegionDiskTypesRequest, + dict, + ], +) def test_list_rest(request_type): client = RegionDiskTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -850,7 +901,13 @@ def test_list_rest_required_fields(request_type=compute.ListRegionDiskTypesReque ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -861,7 +918,8 @@ def test_list_rest_required_fields(request_type=compute.ListRegionDiskTypesReque assert jsonified_request["region"] == "region_value" client = RegionDiskTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -902,8 +960,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "region",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "region", + ) + ) ) @@ -950,7 +1021,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.RegionDiskTypeList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -960,7 +1037,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListRegionDiskTypesRequest ): client = RegionDiskTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -981,7 +1059,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = RegionDiskTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -993,7 +1072,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "region": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", region="region_value",) + mock_args = dict( + project="project_value", + region="region_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1019,7 +1101,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = RegionDiskTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1034,7 +1117,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = RegionDiskTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1044,15 +1128,28 @@ def test_list_rest_pager(transport: str = "rest"): # Set the response as a series of pages response = ( compute.RegionDiskTypeList( - items=[compute.DiskType(), compute.DiskType(), compute.DiskType(),], + items=[ + compute.DiskType(), + compute.DiskType(), + compute.DiskType(), + ], next_page_token="abc", ), - compute.RegionDiskTypeList(items=[], next_page_token="def",), compute.RegionDiskTypeList( - items=[compute.DiskType(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.RegionDiskTypeList( - items=[compute.DiskType(), compute.DiskType(),], + items=[ + compute.DiskType(), + ], + next_page_token="ghi", + ), + compute.RegionDiskTypeList( + items=[ + compute.DiskType(), + compute.DiskType(), + ], ), ) # Two responses for two calls @@ -1086,7 +1183,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RegionDiskTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1106,7 +1204,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = RegionDiskTypesClient(client_options=options, transport=transport,) + client = RegionDiskTypesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1122,7 +1223,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RegionDiskTypesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1135,7 +1237,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.RegionDiskTypesRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.RegionDiskTypesRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -1187,7 +1294,8 @@ def test_region_disk_types_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.RegionDiskTypesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1239,7 +1347,12 @@ def test_region_disk_types_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_region_disk_types_host_no_port(transport_name): client = RegionDiskTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1255,7 +1368,12 @@ def test_region_disk_types_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_region_disk_types_host_with_port(transport_name): client = RegionDiskTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1293,7 +1411,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = RegionDiskTypesClient.common_folder_path(folder) assert expected == actual @@ -1311,7 +1431,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = RegionDiskTypesClient.common_organization_path(organization) assert expected == actual @@ -1329,7 +1451,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = RegionDiskTypesClient.common_project_path(project) assert expected == actual @@ -1349,7 +1473,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = RegionDiskTypesClient.common_location_path(project, location) assert expected == actual @@ -1374,7 +1499,8 @@ def test_client_with_default_client_info(): transports.RegionDiskTypesTransport, "_prep_wrapped_messages" ) as prep: client = RegionDiskTypesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1383,7 +1509,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = RegionDiskTypesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1423,7 +1550,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(RegionDiskTypesClient, transports.RegionDiskTypesRestTransport),], + [ + (RegionDiskTypesClient, transports.RegionDiskTypesRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_region_disks.py b/tests/unit/gapic/compute_v1/test_region_disks.py index 167a5a131..4889dead0 100644 --- a/tests/unit/gapic/compute_v1/test_region_disks.py +++ b/tests/unit/gapic/compute_v1/test_region_disks.py @@ -85,7 +85,12 @@ def test__get_default_mtls_endpoint(): assert RegionDisksClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class,transport_name", [(RegionDisksClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (RegionDisksClient, "rest"), + ], +) def test_region_disks_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -105,7 +110,10 @@ def test_region_disks_client_from_service_account_info(client_class, transport_n @pytest.mark.parametrize( - "transport_class,transport_name", [(transports.RegionDisksRestTransport, "rest"),] + "transport_class,transport_name", + [ + (transports.RegionDisksRestTransport, "rest"), + ], ) def test_region_disks_client_service_account_always_use_jwt( transport_class, transport_name @@ -125,7 +133,12 @@ def test_region_disks_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class,transport_name", [(RegionDisksClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (RegionDisksClient, "rest"), + ], +) def test_region_disks_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -164,7 +177,9 @@ def test_region_disks_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(RegionDisksClient, transports.RegionDisksRestTransport, "rest"),], + [ + (RegionDisksClient, transports.RegionDisksRestTransport, "rest"), + ], ) @mock.patch.object( RegionDisksClient, "DEFAULT_ENDPOINT", modify_default_endpoint(RegionDisksClient) @@ -441,13 +456,17 @@ def test_region_disks_client_get_mtls_endpoint_and_cert_source(client_class): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(RegionDisksClient, transports.RegionDisksRestTransport, "rest"),], + [ + (RegionDisksClient, transports.RegionDisksRestTransport, "rest"), + ], ) def test_region_disks_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -465,7 +484,9 @@ def test_region_disks_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(RegionDisksClient, transports.RegionDisksRestTransport, "rest", None),], + [ + (RegionDisksClient, transports.RegionDisksRestTransport, "rest", None), + ], ) def test_region_disks_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -489,11 +510,16 @@ def test_region_disks_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.AddResourcePoliciesRegionDiskRequest, dict,] + "request_type", + [ + compute.AddResourcePoliciesRegionDiskRequest, + dict, + ], ) def test_add_resource_policies_unary_rest(request_type): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -610,7 +636,8 @@ def test_add_resource_policies_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -706,7 +733,11 @@ def test_add_resource_policies_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.add_resource_policies_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -717,7 +748,8 @@ def test_add_resource_policies_unary_rest_bad_request( transport: str = "rest", request_type=compute.AddResourcePoliciesRegionDiskRequest ): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -741,7 +773,8 @@ def test_add_resource_policies_unary_rest_bad_request( def test_add_resource_policies_unary_rest_flattened(): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -786,7 +819,8 @@ def test_add_resource_policies_unary_rest_flattened(): def test_add_resource_policies_unary_rest_flattened_error(transport: str = "rest"): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -810,11 +844,16 @@ def test_add_resource_policies_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.CreateSnapshotRegionDiskRequest, dict,] + "request_type", + [ + compute.CreateSnapshotRegionDiskRequest, + dict, + ], ) def test_create_snapshot_unary_rest(request_type): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -960,7 +999,8 @@ def test_create_snapshot_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1002,7 +1042,15 @@ def test_create_snapshot_unary_rest_unset_required_fields(): unset_fields = transport.create_snapshot._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("disk", "project", "region", "snapshotResource",)) + set(("requestId",)) + & set( + ( + "disk", + "project", + "region", + "snapshotResource", + ) + ) ) @@ -1048,7 +1096,11 @@ def test_create_snapshot_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.create_snapshot_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1059,7 +1111,8 @@ def test_create_snapshot_unary_rest_bad_request( transport: str = "rest", request_type=compute.CreateSnapshotRegionDiskRequest ): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1112,7 +1165,8 @@ def test_create_snapshot_unary_rest_bad_request( def test_create_snapshot_unary_rest_flattened(): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1155,7 +1209,8 @@ def test_create_snapshot_unary_rest_flattened(): def test_create_snapshot_unary_rest_flattened_error(transport: str = "rest"): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1176,10 +1231,17 @@ def test_create_snapshot_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.DeleteRegionDiskRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteRegionDiskRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1293,7 +1355,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1334,7 +1397,14 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("disk", "project", "region",)) + set(("requestId",)) + & set( + ( + "disk", + "project", + "region", + ) + ) ) @@ -1380,7 +1450,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1391,7 +1465,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteRegionDiskRequest ): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1412,7 +1487,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1425,7 +1501,9 @@ def test_delete_unary_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", region="region_value", disk="disk_value", + project="project_value", + region="region_value", + disk="disk_value", ) mock_args.update(sample_request) @@ -1452,7 +1530,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1472,10 +1551,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetRegionDiskRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetRegionDiskRequest, + dict, + ], +) def test_get_rest(request_type): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1603,7 +1689,8 @@ def test_get_rest_required_fields(request_type=compute.GetRegionDiskRequest): assert jsonified_request["region"] == "region_value" client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1643,7 +1730,16 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("disk", "project", "region",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "disk", + "project", + "region", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1687,7 +1783,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Disk - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1697,7 +1799,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetRegionDiskRequest ): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1718,7 +1821,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1731,7 +1835,9 @@ def test_get_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", region="region_value", disk="disk_value", + project="project_value", + region="region_value", + disk="disk_value", ) mock_args.update(sample_request) @@ -1758,7 +1864,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1778,10 +1885,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetIamPolicyRegionDiskRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetIamPolicyRegionDiskRequest, + dict, + ], +) def test_get_iam_policy_rest(request_type): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1791,7 +1905,11 @@ def test_get_iam_policy_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = compute.Policy(etag="etag_value", iam_owned=True, version=774,) + return_value = compute.Policy( + etag="etag_value", + iam_owned=True, + version=774, + ) # Wrap the value into a proper Response obj response_value = Response() @@ -1853,7 +1971,8 @@ def test_get_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1895,7 +2014,13 @@ def test_get_iam_policy_rest_unset_required_fields(): unset_fields = transport.get_iam_policy._get_unset_required_fields({}) assert set(unset_fields) == ( set(("optionsRequestedPolicyVersion",)) - & set(("project", "region", "resource",)) + & set( + ( + "project", + "region", + "resource", + ) + ) ) @@ -1941,7 +2066,11 @@ def test_get_iam_policy_rest_interceptors(null_interceptor): post.return_value = compute.Policy client.get_iam_policy( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1952,7 +2081,8 @@ def test_get_iam_policy_rest_bad_request( transport: str = "rest", request_type=compute.GetIamPolicyRegionDiskRequest ): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1973,7 +2103,8 @@ def test_get_iam_policy_rest_bad_request( def test_get_iam_policy_rest_flattened(): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1990,7 +2121,9 @@ def test_get_iam_policy_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", region="region_value", resource="resource_value", + project="project_value", + region="region_value", + resource="resource_value", ) mock_args.update(sample_request) @@ -2017,7 +2150,8 @@ def test_get_iam_policy_rest_flattened(): def test_get_iam_policy_rest_flattened_error(transport: str = "rest"): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2037,10 +2171,17 @@ def test_get_iam_policy_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertRegionDiskRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertRegionDiskRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2184,7 +2325,12 @@ def test_insert_unary_rest_required_fields( credentials=ga_credentials.AnonymousCredentials() ).insert._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("request_id", "source_image",)) + assert not set(unset_fields) - set( + ( + "request_id", + "source_image", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -2194,7 +2340,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2236,7 +2383,19 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId", "sourceImage",)) & set(("diskResource", "project", "region",)) + set( + ( + "requestId", + "sourceImage", + ) + ) + & set( + ( + "diskResource", + "project", + "region", + ) + ) ) @@ -2282,7 +2441,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2293,7 +2456,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertRegionDiskRequest ): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2358,7 +2522,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2400,7 +2565,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2420,10 +2586,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListRegionDisksRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListRegionDisksRequest, + dict, + ], +) def test_list_rest(request_type): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2486,7 +2659,13 @@ def test_list_rest_required_fields(request_type=compute.ListRegionDisksRequest): ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -2497,7 +2676,8 @@ def test_list_rest_required_fields(request_type=compute.ListRegionDisksRequest): assert jsonified_request["region"] == "region_value" client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2538,8 +2718,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "region",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "region", + ) + ) ) @@ -2584,7 +2777,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.DiskList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2594,7 +2793,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListRegionDisksRequest ): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2615,7 +2815,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2627,7 +2828,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "region": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", region="region_value",) + mock_args = dict( + project="project_value", + region="region_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2653,7 +2857,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2668,7 +2873,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2678,12 +2884,29 @@ def test_list_rest_pager(transport: str = "rest"): # Set the response as a series of pages response = ( compute.DiskList( - items=[compute.Disk(), compute.Disk(), compute.Disk(),], + items=[ + compute.Disk(), + compute.Disk(), + compute.Disk(), + ], next_page_token="abc", ), - compute.DiskList(items=[], next_page_token="def",), - compute.DiskList(items=[compute.Disk(),], next_page_token="ghi",), - compute.DiskList(items=[compute.Disk(), compute.Disk(),],), + compute.DiskList( + items=[], + next_page_token="def", + ), + compute.DiskList( + items=[ + compute.Disk(), + ], + next_page_token="ghi", + ), + compute.DiskList( + items=[ + compute.Disk(), + compute.Disk(), + ], + ), ) # Two responses for two calls response = response + response @@ -2710,11 +2933,16 @@ def test_list_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.RemoveResourcePoliciesRegionDiskRequest, dict,] + "request_type", + [ + compute.RemoveResourcePoliciesRegionDiskRequest, + dict, + ], ) def test_remove_resource_policies_unary_rest(request_type): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2831,7 +3059,8 @@ def test_remove_resource_policies_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2927,7 +3156,11 @@ def test_remove_resource_policies_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.remove_resource_policies_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2939,7 +3172,8 @@ def test_remove_resource_policies_unary_rest_bad_request( request_type=compute.RemoveResourcePoliciesRegionDiskRequest, ): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2963,7 +3197,8 @@ def test_remove_resource_policies_unary_rest_bad_request( def test_remove_resource_policies_unary_rest_flattened(): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3008,7 +3243,8 @@ def test_remove_resource_policies_unary_rest_flattened(): def test_remove_resource_policies_unary_rest_flattened_error(transport: str = "rest"): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3031,10 +3267,17 @@ def test_remove_resource_policies_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ResizeRegionDiskRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ResizeRegionDiskRequest, + dict, + ], +) def test_resize_unary_rest(request_type): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3149,7 +3392,8 @@ def test_resize_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3192,7 +3436,14 @@ def test_resize_unary_rest_unset_required_fields(): unset_fields = transport.resize._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("disk", "project", "region", "regionDisksResizeRequestResource",)) + & set( + ( + "disk", + "project", + "region", + "regionDisksResizeRequestResource", + ) + ) ) @@ -3238,7 +3489,11 @@ def test_resize_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.resize_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3249,7 +3504,8 @@ def test_resize_unary_rest_bad_request( transport: str = "rest", request_type=compute.ResizeRegionDiskRequest ): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3271,7 +3527,8 @@ def test_resize_unary_rest_bad_request( def test_resize_unary_rest_flattened(): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3316,7 +3573,8 @@ def test_resize_unary_rest_flattened(): def test_resize_unary_rest_flattened_error(transport: str = "rest"): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3339,10 +3597,17 @@ def test_resize_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.SetIamPolicyRegionDiskRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.SetIamPolicyRegionDiskRequest, + dict, + ], +) def test_set_iam_policy_rest(request_type): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3429,7 +3694,11 @@ def test_set_iam_policy_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = compute.Policy(etag="etag_value", iam_owned=True, version=774,) + return_value = compute.Policy( + etag="etag_value", + iam_owned=True, + version=774, + ) # Wrap the value into a proper Response obj response_value = Response() @@ -3489,7 +3758,8 @@ def test_set_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3532,7 +3802,14 @@ def test_set_iam_policy_rest_unset_required_fields(): unset_fields = transport.set_iam_policy._get_unset_required_fields({}) assert set(unset_fields) == ( set(()) - & set(("project", "region", "regionSetPolicyRequestResource", "resource",)) + & set( + ( + "project", + "region", + "regionSetPolicyRequestResource", + "resource", + ) + ) ) @@ -3578,7 +3855,11 @@ def test_set_iam_policy_rest_interceptors(null_interceptor): post.return_value = compute.Policy client.set_iam_policy( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3589,7 +3870,8 @@ def test_set_iam_policy_rest_bad_request( transport: str = "rest", request_type=compute.SetIamPolicyRegionDiskRequest ): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3687,7 +3969,8 @@ def test_set_iam_policy_rest_bad_request( def test_set_iam_policy_rest_flattened(): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3736,7 +4019,8 @@ def test_set_iam_policy_rest_flattened(): def test_set_iam_policy_rest_flattened_error(transport: str = "rest"): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3759,10 +4043,17 @@ def test_set_iam_policy_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.SetLabelsRegionDiskRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.SetLabelsRegionDiskRequest, + dict, + ], +) def test_set_labels_unary_rest(request_type): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3880,7 +4171,8 @@ def test_set_labels_unary_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3923,7 +4215,14 @@ def test_set_labels_unary_rest_unset_required_fields(): unset_fields = transport.set_labels._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("project", "region", "regionSetLabelsRequestResource", "resource",)) + & set( + ( + "project", + "region", + "regionSetLabelsRequestResource", + "resource", + ) + ) ) @@ -3969,7 +4268,11 @@ def test_set_labels_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_labels_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3980,7 +4283,8 @@ def test_set_labels_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetLabelsRegionDiskRequest ): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -4005,7 +4309,8 @@ def test_set_labels_unary_rest_bad_request( def test_set_labels_unary_rest_flattened(): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -4054,7 +4359,8 @@ def test_set_labels_unary_rest_flattened(): def test_set_labels_unary_rest_flattened_error(transport: str = "rest"): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -4078,11 +4384,16 @@ def test_set_labels_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.TestIamPermissionsRegionDiskRequest, dict,] + "request_type", + [ + compute.TestIamPermissionsRegionDiskRequest, + dict, + ], ) def test_test_iam_permissions_rest(request_type): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -4155,7 +4466,8 @@ def test_test_iam_permissions_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -4198,7 +4510,14 @@ def test_test_iam_permissions_rest_unset_required_fields(): unset_fields = transport.test_iam_permissions._get_unset_required_fields({}) assert set(unset_fields) == ( set(()) - & set(("project", "region", "resource", "testPermissionsRequestResource",)) + & set( + ( + "project", + "region", + "resource", + "testPermissionsRequestResource", + ) + ) ) @@ -4246,7 +4565,11 @@ def test_test_iam_permissions_rest_interceptors(null_interceptor): post.return_value = compute.TestPermissionsResponse client.test_iam_permissions( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -4257,7 +4580,8 @@ def test_test_iam_permissions_rest_bad_request( transport: str = "rest", request_type=compute.TestIamPermissionsRegionDiskRequest ): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -4281,7 +4605,8 @@ def test_test_iam_permissions_rest_bad_request( def test_test_iam_permissions_rest_flattened(): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -4330,7 +4655,8 @@ def test_test_iam_permissions_rest_flattened(): def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -4360,7 +4686,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -4380,7 +4707,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = RegionDisksClient(client_options=options, transport=transport,) + client = RegionDisksClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -4396,7 +4726,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RegionDisksClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -4409,7 +4740,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.RegionDisksRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.RegionDisksRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -4471,7 +4807,8 @@ def test_region_disks_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.RegionDisksTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -4521,7 +4858,12 @@ def test_region_disks_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_region_disks_host_no_port(transport_name): client = RegionDisksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4537,7 +4879,12 @@ def test_region_disks_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_region_disks_host_with_port(transport_name): client = RegionDisksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4575,7 +4922,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = RegionDisksClient.common_folder_path(folder) assert expected == actual @@ -4593,7 +4942,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = RegionDisksClient.common_organization_path(organization) assert expected == actual @@ -4611,7 +4962,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = RegionDisksClient.common_project_path(project) assert expected == actual @@ -4631,7 +4984,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = RegionDisksClient.common_location_path(project, location) assert expected == actual @@ -4656,7 +5010,8 @@ def test_client_with_default_client_info(): transports.RegionDisksTransport, "_prep_wrapped_messages" ) as prep: client = RegionDisksClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4665,7 +5020,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = RegionDisksClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4705,7 +5061,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(RegionDisksClient, transports.RegionDisksRestTransport),], + [ + (RegionDisksClient, transports.RegionDisksRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_region_health_check_services.py b/tests/unit/gapic/compute_v1/test_region_health_check_services.py index 2c7275926..42728e1dc 100644 --- a/tests/unit/gapic/compute_v1/test_region_health_check_services.py +++ b/tests/unit/gapic/compute_v1/test_region_health_check_services.py @@ -94,7 +94,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(RegionHealthCheckServicesClient, "rest"),] + "client_class,transport_name", + [ + (RegionHealthCheckServicesClient, "rest"), + ], ) def test_region_health_check_services_client_from_service_account_info( client_class, transport_name @@ -118,7 +121,9 @@ def test_region_health_check_services_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.RegionHealthCheckServicesRestTransport, "rest"),], + [ + (transports.RegionHealthCheckServicesRestTransport, "rest"), + ], ) def test_region_health_check_services_client_service_account_always_use_jwt( transport_class, transport_name @@ -139,7 +144,10 @@ def test_region_health_check_services_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(RegionHealthCheckServicesClient, "rest"),] + "client_class,transport_name", + [ + (RegionHealthCheckServicesClient, "rest"), + ], ) def test_region_health_check_services_client_from_service_account_file( client_class, transport_name @@ -498,7 +506,9 @@ def test_region_health_check_services_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -547,11 +557,16 @@ def test_region_health_check_services_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.DeleteRegionHealthCheckServiceRequest, dict,] + "request_type", + [ + compute.DeleteRegionHealthCheckServiceRequest, + dict, + ], ) def test_delete_unary_rest(request_type): client = RegionHealthCheckServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -669,7 +684,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionHealthCheckServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -710,7 +726,14 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("healthCheckService", "project", "region",)) + set(("requestId",)) + & set( + ( + "healthCheckService", + "project", + "region", + ) + ) ) @@ -756,7 +779,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -767,7 +794,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteRegionHealthCheckServiceRequest ): client = RegionHealthCheckServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -792,7 +820,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = RegionHealthCheckServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -838,7 +867,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = RegionHealthCheckServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -859,11 +889,16 @@ def test_delete_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.GetRegionHealthCheckServiceRequest, dict,] + "request_type", + [ + compute.GetRegionHealthCheckServiceRequest, + dict, + ], ) def test_get_rest(request_type): client = RegionHealthCheckServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -962,7 +997,8 @@ def test_get_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionHealthCheckServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1003,7 +1039,14 @@ def test_get_rest_unset_required_fields(): unset_fields = transport.get._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("healthCheckService", "project", "region",)) + set(()) + & set( + ( + "healthCheckService", + "project", + "region", + ) + ) ) @@ -1050,7 +1093,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.HealthCheckService - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1060,7 +1109,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetRegionHealthCheckServiceRequest ): client = RegionHealthCheckServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1085,7 +1135,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = RegionHealthCheckServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1131,7 +1182,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = RegionHealthCheckServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1152,11 +1204,16 @@ def test_get_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.InsertRegionHealthCheckServiceRequest, dict,] + "request_type", + [ + compute.InsertRegionHealthCheckServiceRequest, + dict, + ], ) def test_insert_unary_rest(request_type): client = RegionHealthCheckServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1286,7 +1343,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionHealthCheckServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1328,7 +1386,14 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("healthCheckServiceResource", "project", "region",)) + set(("requestId",)) + & set( + ( + "healthCheckServiceResource", + "project", + "region", + ) + ) ) @@ -1374,7 +1439,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1385,7 +1454,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertRegionHealthCheckServiceRequest ): client = RegionHealthCheckServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1426,7 +1496,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = RegionHealthCheckServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1470,7 +1541,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = RegionHealthCheckServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1493,11 +1565,16 @@ def test_insert_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.ListRegionHealthCheckServicesRequest, dict,] + "request_type", + [ + compute.ListRegionHealthCheckServicesRequest, + dict, + ], ) def test_list_rest(request_type): client = RegionHealthCheckServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1562,7 +1639,13 @@ def test_list_rest_required_fields( ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1573,7 +1656,8 @@ def test_list_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionHealthCheckServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1614,8 +1698,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "region",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "region", + ) + ) ) @@ -1662,7 +1759,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.HealthCheckServicesList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1672,7 +1775,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListRegionHealthCheckServicesRequest ): client = RegionHealthCheckServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1693,7 +1797,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = RegionHealthCheckServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1705,7 +1810,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "region": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", region="region_value",) + mock_args = dict( + project="project_value", + region="region_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1731,7 +1839,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = RegionHealthCheckServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1746,7 +1855,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = RegionHealthCheckServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1763,12 +1873,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.HealthCheckServicesList(items=[], next_page_token="def",), compute.HealthCheckServicesList( - items=[compute.HealthCheckService(),], next_page_token="ghi", + items=[], + next_page_token="def", + ), + compute.HealthCheckServicesList( + items=[ + compute.HealthCheckService(), + ], + next_page_token="ghi", ), compute.HealthCheckServicesList( - items=[compute.HealthCheckService(), compute.HealthCheckService(),], + items=[ + compute.HealthCheckService(), + compute.HealthCheckService(), + ], ), ) # Two responses for two calls @@ -1796,11 +1915,16 @@ def test_list_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.PatchRegionHealthCheckServiceRequest, dict,] + "request_type", + [ + compute.PatchRegionHealthCheckServiceRequest, + dict, + ], ) def test_patch_unary_rest(request_type): client = RegionHealthCheckServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1938,7 +2062,8 @@ def test_patch_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionHealthCheckServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1982,7 +2107,12 @@ def test_patch_unary_rest_unset_required_fields(): assert set(unset_fields) == ( set(("requestId",)) & set( - ("healthCheckService", "healthCheckServiceResource", "project", "region",) + ( + "healthCheckService", + "healthCheckServiceResource", + "project", + "region", + ) ) ) @@ -2028,7 +2158,13 @@ def test_patch_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.patch_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2038,7 +2174,8 @@ def test_patch_unary_rest_bad_request( transport: str = "rest", request_type=compute.PatchRegionHealthCheckServiceRequest ): client = RegionHealthCheckServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2083,7 +2220,8 @@ def test_patch_unary_rest_bad_request( def test_patch_unary_rest_flattened(): client = RegionHealthCheckServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2132,7 +2270,8 @@ def test_patch_unary_rest_flattened(): def test_patch_unary_rest_flattened_error(transport: str = "rest"): client = RegionHealthCheckServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2162,7 +2301,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RegionHealthCheckServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2183,7 +2323,8 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = RegionHealthCheckServicesClient( - client_options=options, transport=transport, + client_options=options, + transport=transport, ) # It is an error to provide an api_key and a credential. @@ -2200,7 +2341,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RegionHealthCheckServicesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2214,7 +2356,10 @@ def test_transport_instance(): @pytest.mark.parametrize( - "transport_class", [transports.RegionHealthCheckServicesRestTransport,] + "transport_class", + [ + transports.RegionHealthCheckServicesRestTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -2270,7 +2415,8 @@ def test_region_health_check_services_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.RegionHealthCheckServicesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2320,7 +2466,12 @@ def test_region_health_check_services_http_transport_client_cert_source_for_mtls mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_region_health_check_services_host_no_port(transport_name): client = RegionHealthCheckServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2336,7 +2487,12 @@ def test_region_health_check_services_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_region_health_check_services_host_with_port(transport_name): client = RegionHealthCheckServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2376,7 +2532,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = RegionHealthCheckServicesClient.common_folder_path(folder) assert expected == actual @@ -2394,7 +2552,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = RegionHealthCheckServicesClient.common_organization_path(organization) assert expected == actual @@ -2412,7 +2572,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = RegionHealthCheckServicesClient.common_project_path(project) assert expected == actual @@ -2432,7 +2594,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = RegionHealthCheckServicesClient.common_location_path(project, location) assert expected == actual @@ -2457,7 +2620,8 @@ def test_client_with_default_client_info(): transports.RegionHealthCheckServicesTransport, "_prep_wrapped_messages" ) as prep: client = RegionHealthCheckServicesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2466,7 +2630,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = RegionHealthCheckServicesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) diff --git a/tests/unit/gapic/compute_v1/test_region_health_checks.py b/tests/unit/gapic/compute_v1/test_region_health_checks.py index 595c9b1fb..cd6af12c4 100644 --- a/tests/unit/gapic/compute_v1/test_region_health_checks.py +++ b/tests/unit/gapic/compute_v1/test_region_health_checks.py @@ -92,7 +92,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(RegionHealthChecksClient, "rest"),] + "client_class,transport_name", + [ + (RegionHealthChecksClient, "rest"), + ], ) def test_region_health_checks_client_from_service_account_info( client_class, transport_name @@ -116,7 +119,9 @@ def test_region_health_checks_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.RegionHealthChecksRestTransport, "rest"),], + [ + (transports.RegionHealthChecksRestTransport, "rest"), + ], ) def test_region_health_checks_client_service_account_always_use_jwt( transport_class, transport_name @@ -137,7 +142,10 @@ def test_region_health_checks_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(RegionHealthChecksClient, "rest"),] + "client_class,transport_name", + [ + (RegionHealthChecksClient, "rest"), + ], ) def test_region_health_checks_client_from_service_account_file( client_class, transport_name @@ -179,7 +187,9 @@ def test_region_health_checks_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(RegionHealthChecksClient, transports.RegionHealthChecksRestTransport, "rest"),], + [ + (RegionHealthChecksClient, transports.RegionHealthChecksRestTransport, "rest"), + ], ) @mock.patch.object( RegionHealthChecksClient, @@ -472,13 +482,17 @@ def test_region_health_checks_client_get_mtls_endpoint_and_cert_source(client_cl @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(RegionHealthChecksClient, transports.RegionHealthChecksRestTransport, "rest"),], + [ + (RegionHealthChecksClient, transports.RegionHealthChecksRestTransport, "rest"), + ], ) def test_region_health_checks_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -527,11 +541,16 @@ def test_region_health_checks_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.DeleteRegionHealthCheckRequest, dict,] + "request_type", + [ + compute.DeleteRegionHealthCheckRequest, + dict, + ], ) def test_delete_unary_rest(request_type): client = RegionHealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -649,7 +668,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionHealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -690,7 +710,14 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("healthCheck", "project", "region",)) + set(("requestId",)) + & set( + ( + "healthCheck", + "project", + "region", + ) + ) ) @@ -736,7 +763,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -747,7 +778,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteRegionHealthCheckRequest ): client = RegionHealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -772,7 +804,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = RegionHealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -818,7 +851,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = RegionHealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -838,10 +872,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetRegionHealthCheckRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetRegionHealthCheckRequest, + dict, + ], +) def test_get_rest(request_type): client = RegionHealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -935,7 +976,8 @@ def test_get_rest_required_fields(request_type=compute.GetRegionHealthCheckReque assert jsonified_request["region"] == "region_value" client = RegionHealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -975,7 +1017,16 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("healthCheck", "project", "region",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "healthCheck", + "project", + "region", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1019,7 +1070,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.HealthCheck - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1029,7 +1086,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetRegionHealthCheckRequest ): client = RegionHealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1054,7 +1112,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = RegionHealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1100,7 +1159,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = RegionHealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1121,11 +1181,16 @@ def test_get_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.InsertRegionHealthCheckRequest, dict,] + "request_type", + [ + compute.InsertRegionHealthCheckRequest, + dict, + ], ) def test_insert_unary_rest(request_type): client = RegionHealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1299,7 +1364,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionHealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1341,7 +1407,14 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("healthCheckResource", "project", "region",)) + set(("requestId",)) + & set( + ( + "healthCheckResource", + "project", + "region", + ) + ) ) @@ -1387,7 +1460,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1398,7 +1475,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertRegionHealthCheckRequest ): client = RegionHealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1483,7 +1561,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = RegionHealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1525,7 +1604,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = RegionHealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1545,10 +1625,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListRegionHealthChecksRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListRegionHealthChecksRequest, + dict, + ], +) def test_list_rest(request_type): client = RegionHealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1611,7 +1698,13 @@ def test_list_rest_required_fields(request_type=compute.ListRegionHealthChecksRe ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1622,7 +1715,8 @@ def test_list_rest_required_fields(request_type=compute.ListRegionHealthChecksRe assert jsonified_request["region"] == "region_value" client = RegionHealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1663,8 +1757,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "region",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "region", + ) + ) ) @@ -1711,7 +1818,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.HealthCheckList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1721,7 +1834,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListRegionHealthChecksRequest ): client = RegionHealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1742,7 +1856,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = RegionHealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1754,7 +1869,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "region": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", region="region_value",) + mock_args = dict( + project="project_value", + region="region_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1780,7 +1898,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = RegionHealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1795,7 +1914,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = RegionHealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1812,12 +1932,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.HealthCheckList(items=[], next_page_token="def",), compute.HealthCheckList( - items=[compute.HealthCheck(),], next_page_token="ghi", + items=[], + next_page_token="def", + ), + compute.HealthCheckList( + items=[ + compute.HealthCheck(), + ], + next_page_token="ghi", ), compute.HealthCheckList( - items=[compute.HealthCheck(), compute.HealthCheck(),], + items=[ + compute.HealthCheck(), + compute.HealthCheck(), + ], ), ) # Two responses for two calls @@ -1844,10 +1973,17 @@ def test_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.PatchRegionHealthCheckRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.PatchRegionHealthCheckRequest, + dict, + ], +) def test_patch_unary_rest(request_type): client = RegionHealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2029,7 +2165,8 @@ def test_patch_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionHealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2072,7 +2209,14 @@ def test_patch_unary_rest_unset_required_fields(): unset_fields = transport.patch._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("healthCheck", "healthCheckResource", "project", "region",)) + & set( + ( + "healthCheck", + "healthCheckResource", + "project", + "region", + ) + ) ) @@ -2117,7 +2261,13 @@ def test_patch_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.patch_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2127,7 +2277,8 @@ def test_patch_unary_rest_bad_request( transport: str = "rest", request_type=compute.PatchRegionHealthCheckRequest ): client = RegionHealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2216,7 +2367,8 @@ def test_patch_unary_rest_bad_request( def test_patch_unary_rest_flattened(): client = RegionHealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2263,7 +2415,8 @@ def test_patch_unary_rest_flattened(): def test_patch_unary_rest_flattened_error(transport: str = "rest"): client = RegionHealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2285,11 +2438,16 @@ def test_patch_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.UpdateRegionHealthCheckRequest, dict,] + "request_type", + [ + compute.UpdateRegionHealthCheckRequest, + dict, + ], ) def test_update_unary_rest(request_type): client = RegionHealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2471,7 +2629,8 @@ def test_update_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionHealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2514,7 +2673,14 @@ def test_update_unary_rest_unset_required_fields(): unset_fields = transport.update._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("healthCheck", "healthCheckResource", "project", "region",)) + & set( + ( + "healthCheck", + "healthCheckResource", + "project", + "region", + ) + ) ) @@ -2560,7 +2726,11 @@ def test_update_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.update_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2571,7 +2741,8 @@ def test_update_unary_rest_bad_request( transport: str = "rest", request_type=compute.UpdateRegionHealthCheckRequest ): client = RegionHealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2660,7 +2831,8 @@ def test_update_unary_rest_bad_request( def test_update_unary_rest_flattened(): client = RegionHealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2707,7 +2879,8 @@ def test_update_unary_rest_flattened(): def test_update_unary_rest_flattened_error(transport: str = "rest"): client = RegionHealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2735,7 +2908,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RegionHealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2755,7 +2929,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = RegionHealthChecksClient(client_options=options, transport=transport,) + client = RegionHealthChecksClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2771,7 +2948,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RegionHealthChecksClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2785,7 +2963,10 @@ def test_transport_instance(): @pytest.mark.parametrize( - "transport_class", [transports.RegionHealthChecksRestTransport,] + "transport_class", + [ + transports.RegionHealthChecksRestTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -2842,7 +3023,8 @@ def test_region_health_checks_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.RegionHealthChecksTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2892,7 +3074,12 @@ def test_region_health_checks_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_region_health_checks_host_no_port(transport_name): client = RegionHealthChecksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2908,7 +3095,12 @@ def test_region_health_checks_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_region_health_checks_host_with_port(transport_name): client = RegionHealthChecksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2946,7 +3138,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = RegionHealthChecksClient.common_folder_path(folder) assert expected == actual @@ -2964,7 +3158,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = RegionHealthChecksClient.common_organization_path(organization) assert expected == actual @@ -2982,7 +3178,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = RegionHealthChecksClient.common_project_path(project) assert expected == actual @@ -3002,7 +3200,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = RegionHealthChecksClient.common_location_path(project, location) assert expected == actual @@ -3027,7 +3226,8 @@ def test_client_with_default_client_info(): transports.RegionHealthChecksTransport, "_prep_wrapped_messages" ) as prep: client = RegionHealthChecksClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3036,7 +3236,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = RegionHealthChecksClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3076,7 +3277,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(RegionHealthChecksClient, transports.RegionHealthChecksRestTransport),], + [ + (RegionHealthChecksClient, transports.RegionHealthChecksRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_region_instance_group_managers.py b/tests/unit/gapic/compute_v1/test_region_instance_group_managers.py index 5f960e9a5..d8d80c824 100644 --- a/tests/unit/gapic/compute_v1/test_region_instance_group_managers.py +++ b/tests/unit/gapic/compute_v1/test_region_instance_group_managers.py @@ -94,7 +94,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(RegionInstanceGroupManagersClient, "rest"),] + "client_class,transport_name", + [ + (RegionInstanceGroupManagersClient, "rest"), + ], ) def test_region_instance_group_managers_client_from_service_account_info( client_class, transport_name @@ -118,7 +121,9 @@ def test_region_instance_group_managers_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.RegionInstanceGroupManagersRestTransport, "rest"),], + [ + (transports.RegionInstanceGroupManagersRestTransport, "rest"), + ], ) def test_region_instance_group_managers_client_service_account_always_use_jwt( transport_class, transport_name @@ -139,7 +144,10 @@ def test_region_instance_group_managers_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(RegionInstanceGroupManagersClient, "rest"),] + "client_class,transport_name", + [ + (RegionInstanceGroupManagersClient, "rest"), + ], ) def test_region_instance_group_managers_client_from_service_account_file( client_class, transport_name @@ -498,7 +506,9 @@ def test_region_instance_group_managers_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -547,11 +557,16 @@ def test_region_instance_group_managers_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.AbandonInstancesRegionInstanceGroupManagerRequest, dict,] + "request_type", + [ + compute.AbandonInstancesRegionInstanceGroupManagerRequest, + dict, + ], ) def test_abandon_instances_unary_rest(request_type): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -672,7 +687,8 @@ def test_abandon_instances_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -768,7 +784,11 @@ def test_abandon_instances_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.abandon_instances_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -780,7 +800,8 @@ def test_abandon_instances_unary_rest_bad_request( request_type=compute.AbandonInstancesRegionInstanceGroupManagerRequest, ): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -808,7 +829,8 @@ def test_abandon_instances_unary_rest_bad_request( def test_abandon_instances_unary_rest_flattened(): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -857,7 +879,8 @@ def test_abandon_instances_unary_rest_flattened(): def test_abandon_instances_unary_rest_flattened_error(transport: str = "rest"): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -882,11 +905,15 @@ def test_abandon_instances_unary_rest_error(): @pytest.mark.parametrize( "request_type", - [compute.ApplyUpdatesToInstancesRegionInstanceGroupManagerRequest, dict,], + [ + compute.ApplyUpdatesToInstancesRegionInstanceGroupManagerRequest, + dict, + ], ) def test_apply_updates_to_instances_unary_rest(request_type): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1008,7 +1035,8 @@ def test_apply_updates_to_instances_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1106,7 +1134,11 @@ def test_apply_updates_to_instances_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.apply_updates_to_instances_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1118,7 +1150,8 @@ def test_apply_updates_to_instances_unary_rest_bad_request( request_type=compute.ApplyUpdatesToInstancesRegionInstanceGroupManagerRequest, ): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1149,7 +1182,8 @@ def test_apply_updates_to_instances_unary_rest_bad_request( def test_apply_updates_to_instances_unary_rest_flattened(): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1198,7 +1232,8 @@ def test_apply_updates_to_instances_unary_rest_flattened(): def test_apply_updates_to_instances_unary_rest_flattened_error(transport: str = "rest"): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1222,11 +1257,16 @@ def test_apply_updates_to_instances_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.CreateInstancesRegionInstanceGroupManagerRequest, dict,] + "request_type", + [ + compute.CreateInstancesRegionInstanceGroupManagerRequest, + dict, + ], ) def test_create_instances_unary_rest(request_type): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1354,7 +1394,8 @@ def test_create_instances_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1450,7 +1491,11 @@ def test_create_instances_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.create_instances_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1462,7 +1507,8 @@ def test_create_instances_unary_rest_bad_request( request_type=compute.CreateInstancesRegionInstanceGroupManagerRequest, ): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1497,7 +1543,8 @@ def test_create_instances_unary_rest_bad_request( def test_create_instances_unary_rest_flattened(): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1546,7 +1593,8 @@ def test_create_instances_unary_rest_flattened(): def test_create_instances_unary_rest_flattened_error(transport: str = "rest"): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1570,11 +1618,16 @@ def test_create_instances_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.DeleteRegionInstanceGroupManagerRequest, dict,] + "request_type", + [ + compute.DeleteRegionInstanceGroupManagerRequest, + dict, + ], ) def test_delete_unary_rest(request_type): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1692,7 +1745,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1733,7 +1787,14 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("instanceGroupManager", "project", "region",)) + set(("requestId",)) + & set( + ( + "instanceGroupManager", + "project", + "region", + ) + ) ) @@ -1779,7 +1840,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1791,7 +1856,8 @@ def test_delete_unary_rest_bad_request( request_type=compute.DeleteRegionInstanceGroupManagerRequest, ): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1816,7 +1882,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1862,7 +1929,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1883,11 +1951,16 @@ def test_delete_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.DeleteInstancesRegionInstanceGroupManagerRequest, dict,] + "request_type", + [ + compute.DeleteInstancesRegionInstanceGroupManagerRequest, + dict, + ], ) def test_delete_instances_unary_rest(request_type): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2009,7 +2082,8 @@ def test_delete_instances_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2105,7 +2179,11 @@ def test_delete_instances_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_instances_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2117,7 +2195,8 @@ def test_delete_instances_unary_rest_bad_request( request_type=compute.DeleteInstancesRegionInstanceGroupManagerRequest, ): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2146,7 +2225,8 @@ def test_delete_instances_unary_rest_bad_request( def test_delete_instances_unary_rest_flattened(): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2195,7 +2275,8 @@ def test_delete_instances_unary_rest_flattened(): def test_delete_instances_unary_rest_flattened_error(transport: str = "rest"): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2220,11 +2301,15 @@ def test_delete_instances_unary_rest_error(): @pytest.mark.parametrize( "request_type", - [compute.DeletePerInstanceConfigsRegionInstanceGroupManagerRequest, dict,], + [ + compute.DeletePerInstanceConfigsRegionInstanceGroupManagerRequest, + dict, + ], ) def test_delete_per_instance_configs_unary_rest(request_type): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2343,7 +2428,8 @@ def test_delete_per_instance_configs_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2441,7 +2527,11 @@ def test_delete_per_instance_configs_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_per_instance_configs_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2453,7 +2543,8 @@ def test_delete_per_instance_configs_unary_rest_bad_request( request_type=compute.DeletePerInstanceConfigsRegionInstanceGroupManagerRequest, ): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2481,7 +2572,8 @@ def test_delete_per_instance_configs_unary_rest_bad_request( def test_delete_per_instance_configs_unary_rest_flattened(): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2532,7 +2624,8 @@ def test_delete_per_instance_configs_unary_rest_flattened_error( transport: str = "rest", ): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2556,11 +2649,16 @@ def test_delete_per_instance_configs_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.GetRegionInstanceGroupManagerRequest, dict,] + "request_type", + [ + compute.GetRegionInstanceGroupManagerRequest, + dict, + ], ) def test_get_rest(request_type): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2660,7 +2758,8 @@ def test_get_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2701,7 +2800,14 @@ def test_get_rest_unset_required_fields(): unset_fields = transport.get._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("instanceGroupManager", "project", "region",)) + set(()) + & set( + ( + "instanceGroupManager", + "project", + "region", + ) + ) ) @@ -2748,7 +2854,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.InstanceGroupManager - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2758,7 +2870,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetRegionInstanceGroupManagerRequest ): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2783,7 +2896,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2829,7 +2943,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2850,11 +2965,16 @@ def test_get_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.InsertRegionInstanceGroupManagerRequest, dict,] + "request_type", + [ + compute.InsertRegionInstanceGroupManagerRequest, + dict, + ], ) def test_insert_unary_rest(request_type): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3029,7 +3149,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3072,7 +3193,13 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("instanceGroupManagerResource", "project", "region",)) + & set( + ( + "instanceGroupManagerResource", + "project", + "region", + ) + ) ) @@ -3118,7 +3245,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3130,7 +3261,8 @@ def test_insert_unary_rest_bad_request( request_type=compute.InsertRegionInstanceGroupManagerRequest, ): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3216,7 +3348,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3264,7 +3397,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3291,11 +3425,16 @@ def test_insert_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.ListRegionInstanceGroupManagersRequest, dict,] + "request_type", + [ + compute.ListRegionInstanceGroupManagersRequest, + dict, + ], ) def test_list_rest(request_type): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3360,7 +3499,13 @@ def test_list_rest_required_fields( ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -3371,7 +3516,8 @@ def test_list_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3414,8 +3560,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "region",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "region", + ) + ) ) @@ -3462,7 +3621,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.RegionInstanceGroupManagerList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -3472,7 +3637,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListRegionInstanceGroupManagersRequest ): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3493,7 +3659,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3505,7 +3672,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "region": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", region="region_value",) + mock_args = dict( + project="project_value", + region="region_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -3531,7 +3701,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3546,7 +3717,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -3563,12 +3735,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.RegionInstanceGroupManagerList(items=[], next_page_token="def",), compute.RegionInstanceGroupManagerList( - items=[compute.InstanceGroupManager(),], next_page_token="ghi", + items=[], + next_page_token="def", + ), + compute.RegionInstanceGroupManagerList( + items=[ + compute.InstanceGroupManager(), + ], + next_page_token="ghi", ), compute.RegionInstanceGroupManagerList( - items=[compute.InstanceGroupManager(), compute.InstanceGroupManager(),], + items=[ + compute.InstanceGroupManager(), + compute.InstanceGroupManager(), + ], ), ) # Two responses for two calls @@ -3598,11 +3779,16 @@ def test_list_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.ListErrorsRegionInstanceGroupManagersRequest, dict,] + "request_type", + [ + compute.ListErrorsRegionInstanceGroupManagersRequest, + dict, + ], ) def test_list_errors_rest(request_type): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3623,8 +3809,8 @@ def test_list_errors_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = compute.RegionInstanceGroupManagersListErrorsResponse.to_json( - return_value + json_return_value = ( + compute.RegionInstanceGroupManagersListErrorsResponse.to_json(return_value) ) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -3669,7 +3855,13 @@ def test_list_errors_rest_required_fields( ).list_errors._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -3682,7 +3874,8 @@ def test_list_errors_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3705,8 +3898,10 @@ def test_list_errors_rest_required_fields( response_value = Response() response_value.status_code = 200 - json_return_value = compute.RegionInstanceGroupManagersListErrorsResponse.to_json( - return_value + json_return_value = ( + compute.RegionInstanceGroupManagersListErrorsResponse.to_json( + return_value + ) ) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -3725,8 +3920,22 @@ def test_list_errors_rest_unset_required_fields(): unset_fields = transport.list_errors._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("instanceGroupManager", "project", "region",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "instanceGroupManager", + "project", + "region", + ) + ) ) @@ -3761,8 +3970,10 @@ def test_list_errors_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = compute.RegionInstanceGroupManagersListErrorsResponse.to_json( - compute.RegionInstanceGroupManagersListErrorsResponse() + req.return_value._content = ( + compute.RegionInstanceGroupManagersListErrorsResponse.to_json( + compute.RegionInstanceGroupManagersListErrorsResponse() + ) ) request = compute.ListErrorsRegionInstanceGroupManagersRequest() @@ -3773,7 +3984,13 @@ def test_list_errors_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.RegionInstanceGroupManagersListErrorsResponse - client.list_errors(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list_errors( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -3784,7 +4001,8 @@ def test_list_errors_rest_bad_request( request_type=compute.ListErrorsRegionInstanceGroupManagersRequest, ): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3809,7 +4027,8 @@ def test_list_errors_rest_bad_request( def test_list_errors_rest_flattened(): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3835,8 +4054,8 @@ def test_list_errors_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = compute.RegionInstanceGroupManagersListErrorsResponse.to_json( - return_value + json_return_value = ( + compute.RegionInstanceGroupManagersListErrorsResponse.to_json(return_value) ) response_value._content = json_return_value.encode("UTF-8") @@ -3857,7 +4076,8 @@ def test_list_errors_rest_flattened(): def test_list_errors_rest_flattened_error(transport: str = "rest"): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3873,7 +4093,8 @@ def test_list_errors_rest_flattened_error(transport: str = "rest"): def test_list_errors_rest_pager(transport: str = "rest"): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -3891,10 +4112,14 @@ def test_list_errors_rest_pager(transport: str = "rest"): next_page_token="abc", ), compute.RegionInstanceGroupManagersListErrorsResponse( - items=[], next_page_token="def", + items=[], + next_page_token="def", ), compute.RegionInstanceGroupManagersListErrorsResponse( - items=[compute.InstanceManagedByIgmError(),], next_page_token="ghi", + items=[ + compute.InstanceManagedByIgmError(), + ], + next_page_token="ghi", ), compute.RegionInstanceGroupManagersListErrorsResponse( items=[ @@ -3936,11 +4161,15 @@ def test_list_errors_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( "request_type", - [compute.ListManagedInstancesRegionInstanceGroupManagersRequest, dict,], + [ + compute.ListManagedInstancesRegionInstanceGroupManagersRequest, + dict, + ], ) def test_list_managed_instances_rest(request_type): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3961,8 +4190,10 @@ def test_list_managed_instances_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = compute.RegionInstanceGroupManagersListInstancesResponse.to_json( - return_value + json_return_value = ( + compute.RegionInstanceGroupManagersListInstancesResponse.to_json( + return_value + ) ) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -4007,7 +4238,13 @@ def test_list_managed_instances_rest_required_fields( ).list_managed_instances._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -4020,7 +4257,8 @@ def test_list_managed_instances_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -4043,8 +4281,10 @@ def test_list_managed_instances_rest_required_fields( response_value = Response() response_value.status_code = 200 - json_return_value = compute.RegionInstanceGroupManagersListInstancesResponse.to_json( - return_value + json_return_value = ( + compute.RegionInstanceGroupManagersListInstancesResponse.to_json( + return_value + ) ) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -4063,8 +4303,22 @@ def test_list_managed_instances_rest_unset_required_fields(): unset_fields = transport.list_managed_instances._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("instanceGroupManager", "project", "region",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "instanceGroupManager", + "project", + "region", + ) + ) ) @@ -4101,8 +4355,10 @@ def test_list_managed_instances_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = compute.RegionInstanceGroupManagersListInstancesResponse.to_json( - compute.RegionInstanceGroupManagersListInstancesResponse() + req.return_value._content = ( + compute.RegionInstanceGroupManagersListInstancesResponse.to_json( + compute.RegionInstanceGroupManagersListInstancesResponse() + ) ) request = compute.ListManagedInstancesRegionInstanceGroupManagersRequest() @@ -4114,7 +4370,11 @@ def test_list_managed_instances_rest_interceptors(null_interceptor): post.return_value = compute.RegionInstanceGroupManagersListInstancesResponse client.list_managed_instances( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -4126,7 +4386,8 @@ def test_list_managed_instances_rest_bad_request( request_type=compute.ListManagedInstancesRegionInstanceGroupManagersRequest, ): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -4151,7 +4412,8 @@ def test_list_managed_instances_rest_bad_request( def test_list_managed_instances_rest_flattened(): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -4177,8 +4439,10 @@ def test_list_managed_instances_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = compute.RegionInstanceGroupManagersListInstancesResponse.to_json( - return_value + json_return_value = ( + compute.RegionInstanceGroupManagersListInstancesResponse.to_json( + return_value + ) ) response_value._content = json_return_value.encode("UTF-8") @@ -4199,7 +4463,8 @@ def test_list_managed_instances_rest_flattened(): def test_list_managed_instances_rest_flattened_error(transport: str = "rest"): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -4215,7 +4480,8 @@ def test_list_managed_instances_rest_flattened_error(transport: str = "rest"): def test_list_managed_instances_rest_pager(transport: str = "rest"): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -4233,10 +4499,14 @@ def test_list_managed_instances_rest_pager(transport: str = "rest"): next_page_token="abc", ), compute.RegionInstanceGroupManagersListInstancesResponse( - managed_instances=[], next_page_token="def", + managed_instances=[], + next_page_token="def", ), compute.RegionInstanceGroupManagersListInstancesResponse( - managed_instances=[compute.ManagedInstance(),], next_page_token="ghi", + managed_instances=[ + compute.ManagedInstance(), + ], + next_page_token="ghi", ), compute.RegionInstanceGroupManagersListInstancesResponse( managed_instances=[ @@ -4278,11 +4548,15 @@ def test_list_managed_instances_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( "request_type", - [compute.ListPerInstanceConfigsRegionInstanceGroupManagersRequest, dict,], + [ + compute.ListPerInstanceConfigsRegionInstanceGroupManagersRequest, + dict, + ], ) def test_list_per_instance_configs_rest(request_type): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -4303,8 +4577,10 @@ def test_list_per_instance_configs_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = compute.RegionInstanceGroupManagersListInstanceConfigsResp.to_json( - return_value + json_return_value = ( + compute.RegionInstanceGroupManagersListInstanceConfigsResp.to_json( + return_value + ) ) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -4349,7 +4625,13 @@ def test_list_per_instance_configs_rest_required_fields( ).list_per_instance_configs._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -4362,7 +4644,8 @@ def test_list_per_instance_configs_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -4385,8 +4668,10 @@ def test_list_per_instance_configs_rest_required_fields( response_value = Response() response_value.status_code = 200 - json_return_value = compute.RegionInstanceGroupManagersListInstanceConfigsResp.to_json( - return_value + json_return_value = ( + compute.RegionInstanceGroupManagersListInstanceConfigsResp.to_json( + return_value + ) ) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -4405,8 +4690,22 @@ def test_list_per_instance_configs_rest_unset_required_fields(): unset_fields = transport.list_per_instance_configs._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("instanceGroupManager", "project", "region",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "instanceGroupManager", + "project", + "region", + ) + ) ) @@ -4443,8 +4742,10 @@ def test_list_per_instance_configs_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = compute.RegionInstanceGroupManagersListInstanceConfigsResp.to_json( - compute.RegionInstanceGroupManagersListInstanceConfigsResp() + req.return_value._content = ( + compute.RegionInstanceGroupManagersListInstanceConfigsResp.to_json( + compute.RegionInstanceGroupManagersListInstanceConfigsResp() + ) ) request = compute.ListPerInstanceConfigsRegionInstanceGroupManagersRequest() @@ -4456,7 +4757,11 @@ def test_list_per_instance_configs_rest_interceptors(null_interceptor): post.return_value = compute.RegionInstanceGroupManagersListInstanceConfigsResp client.list_per_instance_configs( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -4468,7 +4773,8 @@ def test_list_per_instance_configs_rest_bad_request( request_type=compute.ListPerInstanceConfigsRegionInstanceGroupManagersRequest, ): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -4493,7 +4799,8 @@ def test_list_per_instance_configs_rest_bad_request( def test_list_per_instance_configs_rest_flattened(): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -4519,8 +4826,10 @@ def test_list_per_instance_configs_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = compute.RegionInstanceGroupManagersListInstanceConfigsResp.to_json( - return_value + json_return_value = ( + compute.RegionInstanceGroupManagersListInstanceConfigsResp.to_json( + return_value + ) ) response_value._content = json_return_value.encode("UTF-8") @@ -4541,7 +4850,8 @@ def test_list_per_instance_configs_rest_flattened(): def test_list_per_instance_configs_rest_flattened_error(transport: str = "rest"): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -4557,7 +4867,8 @@ def test_list_per_instance_configs_rest_flattened_error(transport: str = "rest") def test_list_per_instance_configs_rest_pager(transport: str = "rest"): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -4575,13 +4886,20 @@ def test_list_per_instance_configs_rest_pager(transport: str = "rest"): next_page_token="abc", ), compute.RegionInstanceGroupManagersListInstanceConfigsResp( - items=[], next_page_token="def", + items=[], + next_page_token="def", ), compute.RegionInstanceGroupManagersListInstanceConfigsResp( - items=[compute.PerInstanceConfig(),], next_page_token="ghi", + items=[ + compute.PerInstanceConfig(), + ], + next_page_token="ghi", ), compute.RegionInstanceGroupManagersListInstanceConfigsResp( - items=[compute.PerInstanceConfig(), compute.PerInstanceConfig(),], + items=[ + compute.PerInstanceConfig(), + compute.PerInstanceConfig(), + ], ), ) # Two responses for two calls @@ -4616,11 +4934,16 @@ def test_list_per_instance_configs_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.PatchRegionInstanceGroupManagerRequest, dict,] + "request_type", + [ + compute.PatchRegionInstanceGroupManagerRequest, + dict, + ], ) def test_patch_unary_rest(request_type): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -4803,7 +5126,8 @@ def test_patch_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -4898,7 +5222,13 @@ def test_patch_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.patch_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -4908,7 +5238,8 @@ def test_patch_unary_rest_bad_request( transport: str = "rest", request_type=compute.PatchRegionInstanceGroupManagerRequest ): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -4998,7 +5329,8 @@ def test_patch_unary_rest_bad_request( def test_patch_unary_rest_flattened(): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -5051,7 +5383,8 @@ def test_patch_unary_rest_flattened(): def test_patch_unary_rest_flattened_error(transport: str = "rest"): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -5080,11 +5413,15 @@ def test_patch_unary_rest_error(): @pytest.mark.parametrize( "request_type", - [compute.PatchPerInstanceConfigsRegionInstanceGroupManagerRequest, dict,], + [ + compute.PatchPerInstanceConfigsRegionInstanceGroupManagerRequest, + dict, + ], ) def test_patch_per_instance_configs_unary_rest(request_type): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -5212,7 +5549,8 @@ def test_patch_per_instance_configs_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -5310,7 +5648,11 @@ def test_patch_per_instance_configs_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.patch_per_instance_configs_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -5322,7 +5664,8 @@ def test_patch_per_instance_configs_unary_rest_bad_request( request_type=compute.PatchPerInstanceConfigsRegionInstanceGroupManagerRequest, ): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -5357,7 +5700,8 @@ def test_patch_per_instance_configs_unary_rest_bad_request( def test_patch_per_instance_configs_unary_rest_flattened(): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -5408,7 +5752,8 @@ def test_patch_per_instance_configs_unary_rest_flattened(): def test_patch_per_instance_configs_unary_rest_flattened_error(transport: str = "rest"): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -5434,11 +5779,16 @@ def test_patch_per_instance_configs_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.RecreateInstancesRegionInstanceGroupManagerRequest, dict,] + "request_type", + [ + compute.RecreateInstancesRegionInstanceGroupManagerRequest, + dict, + ], ) def test_recreate_instances_unary_rest(request_type): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -5559,7 +5909,8 @@ def test_recreate_instances_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -5655,7 +6006,11 @@ def test_recreate_instances_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.recreate_instances_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -5667,7 +6022,8 @@ def test_recreate_instances_unary_rest_bad_request( request_type=compute.RecreateInstancesRegionInstanceGroupManagerRequest, ): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -5695,7 +6051,8 @@ def test_recreate_instances_unary_rest_bad_request( def test_recreate_instances_unary_rest_flattened(): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -5744,7 +6101,8 @@ def test_recreate_instances_unary_rest_flattened(): def test_recreate_instances_unary_rest_flattened_error(transport: str = "rest"): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -5768,11 +6126,16 @@ def test_recreate_instances_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.ResizeRegionInstanceGroupManagerRequest, dict,] + "request_type", + [ + compute.ResizeRegionInstanceGroupManagerRequest, + dict, + ], ) def test_resize_unary_rest(request_type): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -5883,7 +6246,12 @@ def test_resize_unary_rest_required_fields( credentials=ga_credentials.AnonymousCredentials() ).resize._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("request_id", "size",)) + assert not set(unset_fields) - set( + ( + "request_id", + "size", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -5897,7 +6265,8 @@ def test_resize_unary_rest_required_fields( assert jsonified_request["size"] == 443 client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -5927,7 +6296,10 @@ def test_resize_unary_rest_required_fields( response = client.resize_unary(request) expected_params = [ - ("size", 0,), + ( + "size", + 0, + ), ] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -5940,8 +6312,20 @@ def test_resize_unary_rest_unset_required_fields(): unset_fields = transport.resize._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId", "size",)) - & set(("instanceGroupManager", "project", "region", "size",)) + set( + ( + "requestId", + "size", + ) + ) + & set( + ( + "instanceGroupManager", + "project", + "region", + "size", + ) + ) ) @@ -5987,7 +6371,11 @@ def test_resize_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.resize_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -5999,7 +6387,8 @@ def test_resize_unary_rest_bad_request( request_type=compute.ResizeRegionInstanceGroupManagerRequest, ): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -6024,7 +6413,8 @@ def test_resize_unary_rest_bad_request( def test_resize_unary_rest_flattened(): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -6071,7 +6461,8 @@ def test_resize_unary_rest_flattened(): def test_resize_unary_rest_flattened_error(transport: str = "rest"): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -6094,11 +6485,15 @@ def test_resize_unary_rest_error(): @pytest.mark.parametrize( "request_type", - [compute.SetInstanceTemplateRegionInstanceGroupManagerRequest, dict,], + [ + compute.SetInstanceTemplateRegionInstanceGroupManagerRequest, + dict, + ], ) def test_set_instance_template_unary_rest(request_type): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -6219,7 +6614,8 @@ def test_set_instance_template_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -6317,7 +6713,11 @@ def test_set_instance_template_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_instance_template_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -6329,7 +6729,8 @@ def test_set_instance_template_unary_rest_bad_request( request_type=compute.SetInstanceTemplateRegionInstanceGroupManagerRequest, ): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -6357,7 +6758,8 @@ def test_set_instance_template_unary_rest_bad_request( def test_set_instance_template_unary_rest_flattened(): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -6406,7 +6808,8 @@ def test_set_instance_template_unary_rest_flattened(): def test_set_instance_template_unary_rest_flattened_error(transport: str = "rest"): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -6430,11 +6833,16 @@ def test_set_instance_template_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SetTargetPoolsRegionInstanceGroupManagerRequest, dict,] + "request_type", + [ + compute.SetTargetPoolsRegionInstanceGroupManagerRequest, + dict, + ], ) def test_set_target_pools_unary_rest(request_type): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -6556,7 +6964,8 @@ def test_set_target_pools_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -6652,7 +7061,11 @@ def test_set_target_pools_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_target_pools_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -6664,7 +7077,8 @@ def test_set_target_pools_unary_rest_bad_request( request_type=compute.SetTargetPoolsRegionInstanceGroupManagerRequest, ): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -6693,7 +7107,8 @@ def test_set_target_pools_unary_rest_bad_request( def test_set_target_pools_unary_rest_flattened(): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -6742,7 +7157,8 @@ def test_set_target_pools_unary_rest_flattened(): def test_set_target_pools_unary_rest_flattened_error(transport: str = "rest"): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -6767,11 +7183,15 @@ def test_set_target_pools_unary_rest_error(): @pytest.mark.parametrize( "request_type", - [compute.UpdatePerInstanceConfigsRegionInstanceGroupManagerRequest, dict,], + [ + compute.UpdatePerInstanceConfigsRegionInstanceGroupManagerRequest, + dict, + ], ) def test_update_per_instance_configs_unary_rest(request_type): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -6901,7 +7321,8 @@ def test_update_per_instance_configs_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -6999,7 +7420,11 @@ def test_update_per_instance_configs_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.update_per_instance_configs_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -7011,7 +7436,8 @@ def test_update_per_instance_configs_unary_rest_bad_request( request_type=compute.UpdatePerInstanceConfigsRegionInstanceGroupManagerRequest, ): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -7048,7 +7474,8 @@ def test_update_per_instance_configs_unary_rest_bad_request( def test_update_per_instance_configs_unary_rest_flattened(): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -7101,7 +7528,8 @@ def test_update_per_instance_configs_unary_rest_flattened_error( transport: str = "rest", ): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -7133,7 +7561,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -7154,7 +7583,8 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = RegionInstanceGroupManagersClient( - client_options=options, transport=transport, + client_options=options, + transport=transport, ) # It is an error to provide an api_key and a credential. @@ -7171,7 +7601,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RegionInstanceGroupManagersClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -7185,7 +7616,10 @@ def test_transport_instance(): @pytest.mark.parametrize( - "transport_class", [transports.RegionInstanceGroupManagersRestTransport,] + "transport_class", + [ + transports.RegionInstanceGroupManagersRestTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -7255,7 +7689,8 @@ def test_region_instance_group_managers_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.RegionInstanceGroupManagersTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -7305,7 +7740,12 @@ def test_region_instance_group_managers_http_transport_client_cert_source_for_mt mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_region_instance_group_managers_host_no_port(transport_name): client = RegionInstanceGroupManagersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7321,7 +7761,12 @@ def test_region_instance_group_managers_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_region_instance_group_managers_host_with_port(transport_name): client = RegionInstanceGroupManagersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7361,7 +7806,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = RegionInstanceGroupManagersClient.common_folder_path(folder) assert expected == actual @@ -7379,7 +7826,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = RegionInstanceGroupManagersClient.common_organization_path(organization) assert expected == actual @@ -7397,7 +7846,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = RegionInstanceGroupManagersClient.common_project_path(project) assert expected == actual @@ -7417,7 +7868,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = RegionInstanceGroupManagersClient.common_location_path(project, location) assert expected == actual @@ -7442,7 +7894,8 @@ def test_client_with_default_client_info(): transports.RegionInstanceGroupManagersTransport, "_prep_wrapped_messages" ) as prep: client = RegionInstanceGroupManagersClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -7451,7 +7904,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = RegionInstanceGroupManagersClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) diff --git a/tests/unit/gapic/compute_v1/test_region_instance_groups.py b/tests/unit/gapic/compute_v1/test_region_instance_groups.py index 525ce11ce..3cb75b487 100644 --- a/tests/unit/gapic/compute_v1/test_region_instance_groups.py +++ b/tests/unit/gapic/compute_v1/test_region_instance_groups.py @@ -92,7 +92,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(RegionInstanceGroupsClient, "rest"),] + "client_class,transport_name", + [ + (RegionInstanceGroupsClient, "rest"), + ], ) def test_region_instance_groups_client_from_service_account_info( client_class, transport_name @@ -116,7 +119,9 @@ def test_region_instance_groups_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.RegionInstanceGroupsRestTransport, "rest"),], + [ + (transports.RegionInstanceGroupsRestTransport, "rest"), + ], ) def test_region_instance_groups_client_service_account_always_use_jwt( transport_class, transport_name @@ -137,7 +142,10 @@ def test_region_instance_groups_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(RegionInstanceGroupsClient, "rest"),] + "client_class,transport_name", + [ + (RegionInstanceGroupsClient, "rest"), + ], ) def test_region_instance_groups_client_from_service_account_file( client_class, transport_name @@ -490,7 +498,9 @@ def test_region_instance_groups_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -538,10 +548,17 @@ def test_region_instance_groups_client_client_options_credentials_file( ) -@pytest.mark.parametrize("request_type", [compute.GetRegionInstanceGroupRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetRegionInstanceGroupRequest, + dict, + ], +) def test_get_rest(request_type): client = RegionInstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -635,7 +652,8 @@ def test_get_rest_required_fields(request_type=compute.GetRegionInstanceGroupReq assert jsonified_request["region"] == "region_value" client = RegionInstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -675,7 +693,16 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("instanceGroup", "project", "region",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "instanceGroup", + "project", + "region", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -721,7 +748,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.InstanceGroup - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -731,7 +764,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetRegionInstanceGroupRequest ): client = RegionInstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -756,7 +790,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = RegionInstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -802,7 +837,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = RegionInstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -823,11 +859,16 @@ def test_get_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.ListRegionInstanceGroupsRequest, dict,] + "request_type", + [ + compute.ListRegionInstanceGroupsRequest, + dict, + ], ) def test_list_rest(request_type): client = RegionInstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -892,7 +933,13 @@ def test_list_rest_required_fields( ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -903,7 +950,8 @@ def test_list_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionInstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -944,8 +992,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "region",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "region", + ) + ) ) @@ -992,7 +1053,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.RegionInstanceGroupList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1002,7 +1069,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListRegionInstanceGroupsRequest ): client = RegionInstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1023,7 +1091,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = RegionInstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1035,7 +1104,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "region": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", region="region_value",) + mock_args = dict( + project="project_value", + region="region_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1061,7 +1133,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = RegionInstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1076,7 +1149,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = RegionInstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1093,12 +1167,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.RegionInstanceGroupList(items=[], next_page_token="def",), compute.RegionInstanceGroupList( - items=[compute.InstanceGroup(),], next_page_token="ghi", + items=[], + next_page_token="def", + ), + compute.RegionInstanceGroupList( + items=[ + compute.InstanceGroup(), + ], + next_page_token="ghi", ), compute.RegionInstanceGroupList( - items=[compute.InstanceGroup(), compute.InstanceGroup(),], + items=[ + compute.InstanceGroup(), + compute.InstanceGroup(), + ], ), ) # Two responses for two calls @@ -1126,11 +1209,16 @@ def test_list_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.ListInstancesRegionInstanceGroupsRequest, dict,] + "request_type", + [ + compute.ListInstancesRegionInstanceGroupsRequest, + dict, + ], ) def test_list_instances_rest(request_type): client = RegionInstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1207,7 +1295,13 @@ def test_list_instances_rest_required_fields( ).list_instances._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1220,7 +1314,8 @@ def test_list_instances_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionInstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1264,7 +1359,15 @@ def test_list_instances_rest_unset_required_fields(): unset_fields = transport.list_instances._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set( ( "instanceGroup", @@ -1320,7 +1423,11 @@ def test_list_instances_rest_interceptors(null_interceptor): post.return_value = compute.RegionInstanceGroupsListInstances client.list_instances( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1332,7 +1439,8 @@ def test_list_instances_rest_bad_request( request_type=compute.ListInstancesRegionInstanceGroupsRequest, ): client = RegionInstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1361,7 +1469,8 @@ def test_list_instances_rest_bad_request( def test_list_instances_rest_flattened(): client = RegionInstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1412,7 +1521,8 @@ def test_list_instances_rest_flattened(): def test_list_instances_rest_flattened_error(transport: str = "rest"): client = RegionInstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1431,7 +1541,8 @@ def test_list_instances_rest_flattened_error(transport: str = "rest"): def test_list_instances_rest_pager(transport: str = "rest"): client = RegionInstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1448,9 +1559,15 @@ def test_list_instances_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.RegionInstanceGroupsListInstances(items=[], next_page_token="def",), compute.RegionInstanceGroupsListInstances( - items=[compute.InstanceWithNamedPorts(),], next_page_token="ghi", + items=[], + next_page_token="def", + ), + compute.RegionInstanceGroupsListInstances( + items=[ + compute.InstanceWithNamedPorts(), + ], + next_page_token="ghi", ), compute.RegionInstanceGroupsListInstances( items=[ @@ -1495,11 +1612,16 @@ def test_list_instances_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.SetNamedPortsRegionInstanceGroupRequest, dict,] + "request_type", + [ + compute.SetNamedPortsRegionInstanceGroupRequest, + dict, + ], ) def test_set_named_ports_unary_rest(request_type): client = RegionInstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1621,7 +1743,8 @@ def test_set_named_ports_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionInstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1717,7 +1840,11 @@ def test_set_named_ports_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_named_ports_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1729,7 +1856,8 @@ def test_set_named_ports_unary_rest_bad_request( request_type=compute.SetNamedPortsRegionInstanceGroupRequest, ): client = RegionInstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1758,7 +1886,8 @@ def test_set_named_ports_unary_rest_bad_request( def test_set_named_ports_unary_rest_flattened(): client = RegionInstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1807,7 +1936,8 @@ def test_set_named_ports_unary_rest_flattened(): def test_set_named_ports_unary_rest_flattened_error(transport: str = "rest"): client = RegionInstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1837,7 +1967,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RegionInstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1858,7 +1989,8 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = RegionInstanceGroupsClient( - client_options=options, transport=transport, + client_options=options, + transport=transport, ) # It is an error to provide an api_key and a credential. @@ -1875,7 +2007,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RegionInstanceGroupsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1889,7 +2022,10 @@ def test_transport_instance(): @pytest.mark.parametrize( - "transport_class", [transports.RegionInstanceGroupsRestTransport,] + "transport_class", + [ + transports.RegionInstanceGroupsRestTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -1944,7 +2080,8 @@ def test_region_instance_groups_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.RegionInstanceGroupsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1994,7 +2131,12 @@ def test_region_instance_groups_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_region_instance_groups_host_no_port(transport_name): client = RegionInstanceGroupsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2010,7 +2152,12 @@ def test_region_instance_groups_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_region_instance_groups_host_with_port(transport_name): client = RegionInstanceGroupsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2048,7 +2195,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = RegionInstanceGroupsClient.common_folder_path(folder) assert expected == actual @@ -2066,7 +2215,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = RegionInstanceGroupsClient.common_organization_path(organization) assert expected == actual @@ -2084,7 +2235,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = RegionInstanceGroupsClient.common_project_path(project) assert expected == actual @@ -2104,7 +2257,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = RegionInstanceGroupsClient.common_location_path(project, location) assert expected == actual @@ -2129,7 +2283,8 @@ def test_client_with_default_client_info(): transports.RegionInstanceGroupsTransport, "_prep_wrapped_messages" ) as prep: client = RegionInstanceGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2138,7 +2293,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = RegionInstanceGroupsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2178,7 +2334,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(RegionInstanceGroupsClient, transports.RegionInstanceGroupsRestTransport),], + [ + (RegionInstanceGroupsClient, transports.RegionInstanceGroupsRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_region_instances.py b/tests/unit/gapic/compute_v1/test_region_instances.py index 924568430..9a5ccbe48 100644 --- a/tests/unit/gapic/compute_v1/test_region_instances.py +++ b/tests/unit/gapic/compute_v1/test_region_instances.py @@ -88,7 +88,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(RegionInstancesClient, "rest"),] + "client_class,transport_name", + [ + (RegionInstancesClient, "rest"), + ], ) def test_region_instances_client_from_service_account_info( client_class, transport_name @@ -112,7 +115,9 @@ def test_region_instances_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.RegionInstancesRestTransport, "rest"),], + [ + (transports.RegionInstancesRestTransport, "rest"), + ], ) def test_region_instances_client_service_account_always_use_jwt( transport_class, transport_name @@ -133,7 +138,10 @@ def test_region_instances_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(RegionInstancesClient, "rest"),] + "client_class,transport_name", + [ + (RegionInstancesClient, "rest"), + ], ) def test_region_instances_client_from_service_account_file( client_class, transport_name @@ -175,7 +183,9 @@ def test_region_instances_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(RegionInstancesClient, transports.RegionInstancesRestTransport, "rest"),], + [ + (RegionInstancesClient, transports.RegionInstancesRestTransport, "rest"), + ], ) @mock.patch.object( RegionInstancesClient, @@ -468,13 +478,17 @@ def test_region_instances_client_get_mtls_endpoint_and_cert_source(client_class) @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(RegionInstancesClient, transports.RegionInstancesRestTransport, "rest"),], + [ + (RegionInstancesClient, transports.RegionInstancesRestTransport, "rest"), + ], ) def test_region_instances_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -492,7 +506,9 @@ def test_region_instances_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(RegionInstancesClient, transports.RegionInstancesRestTransport, "rest", None),], + [ + (RegionInstancesClient, transports.RegionInstancesRestTransport, "rest", None), + ], ) def test_region_instances_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -516,11 +532,16 @@ def test_region_instances_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.BulkInsertRegionInstanceRequest, dict,] + "request_type", + [ + compute.BulkInsertRegionInstanceRequest, + dict, + ], ) def test_bulk_insert_unary_rest(request_type): client = RegionInstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -788,7 +809,8 @@ def test_bulk_insert_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionInstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -831,7 +853,13 @@ def test_bulk_insert_unary_rest_unset_required_fields(): unset_fields = transport.bulk_insert._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("bulkInsertInstanceResourceResource", "project", "region",)) + & set( + ( + "bulkInsertInstanceResourceResource", + "project", + "region", + ) + ) ) @@ -877,7 +905,11 @@ def test_bulk_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.bulk_insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -888,7 +920,8 @@ def test_bulk_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.BulkInsertRegionInstanceRequest ): client = RegionInstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1067,7 +1100,8 @@ def test_bulk_insert_unary_rest_bad_request( def test_bulk_insert_unary_rest_flattened(): client = RegionInstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1111,7 +1145,8 @@ def test_bulk_insert_unary_rest_flattened(): def test_bulk_insert_unary_rest_flattened_error(transport: str = "rest"): client = RegionInstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1140,7 +1175,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RegionInstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1160,7 +1196,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = RegionInstancesClient(client_options=options, transport=transport,) + client = RegionInstancesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1176,7 +1215,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RegionInstancesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1189,7 +1229,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.RegionInstancesRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.RegionInstancesRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -1238,7 +1283,8 @@ def test_region_instances_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.RegionInstancesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1288,7 +1334,12 @@ def test_region_instances_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_region_instances_host_no_port(transport_name): client = RegionInstancesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1304,7 +1355,12 @@ def test_region_instances_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_region_instances_host_with_port(transport_name): client = RegionInstancesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1342,7 +1398,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = RegionInstancesClient.common_folder_path(folder) assert expected == actual @@ -1360,7 +1418,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = RegionInstancesClient.common_organization_path(organization) assert expected == actual @@ -1378,7 +1438,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = RegionInstancesClient.common_project_path(project) assert expected == actual @@ -1398,7 +1460,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = RegionInstancesClient.common_location_path(project, location) assert expected == actual @@ -1423,7 +1486,8 @@ def test_client_with_default_client_info(): transports.RegionInstancesTransport, "_prep_wrapped_messages" ) as prep: client = RegionInstancesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1432,7 +1496,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = RegionInstancesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1472,7 +1537,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(RegionInstancesClient, transports.RegionInstancesRestTransport),], + [ + (RegionInstancesClient, transports.RegionInstancesRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_region_network_endpoint_groups.py b/tests/unit/gapic/compute_v1/test_region_network_endpoint_groups.py index ebdb3185c..3572f65a1 100644 --- a/tests/unit/gapic/compute_v1/test_region_network_endpoint_groups.py +++ b/tests/unit/gapic/compute_v1/test_region_network_endpoint_groups.py @@ -94,7 +94,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(RegionNetworkEndpointGroupsClient, "rest"),] + "client_class,transport_name", + [ + (RegionNetworkEndpointGroupsClient, "rest"), + ], ) def test_region_network_endpoint_groups_client_from_service_account_info( client_class, transport_name @@ -118,7 +121,9 @@ def test_region_network_endpoint_groups_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.RegionNetworkEndpointGroupsRestTransport, "rest"),], + [ + (transports.RegionNetworkEndpointGroupsRestTransport, "rest"), + ], ) def test_region_network_endpoint_groups_client_service_account_always_use_jwt( transport_class, transport_name @@ -139,7 +144,10 @@ def test_region_network_endpoint_groups_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(RegionNetworkEndpointGroupsClient, "rest"),] + "client_class,transport_name", + [ + (RegionNetworkEndpointGroupsClient, "rest"), + ], ) def test_region_network_endpoint_groups_client_from_service_account_file( client_class, transport_name @@ -498,7 +506,9 @@ def test_region_network_endpoint_groups_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -547,11 +557,16 @@ def test_region_network_endpoint_groups_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.DeleteRegionNetworkEndpointGroupRequest, dict,] + "request_type", + [ + compute.DeleteRegionNetworkEndpointGroupRequest, + dict, + ], ) def test_delete_unary_rest(request_type): client = RegionNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -669,7 +684,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -710,7 +726,14 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("networkEndpointGroup", "project", "region",)) + set(("requestId",)) + & set( + ( + "networkEndpointGroup", + "project", + "region", + ) + ) ) @@ -756,7 +779,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -768,7 +795,8 @@ def test_delete_unary_rest_bad_request( request_type=compute.DeleteRegionNetworkEndpointGroupRequest, ): client = RegionNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -793,7 +821,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = RegionNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -839,7 +868,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = RegionNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -860,11 +890,16 @@ def test_delete_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.GetRegionNetworkEndpointGroupRequest, dict,] + "request_type", + [ + compute.GetRegionNetworkEndpointGroupRequest, + dict, + ], ) def test_get_rest(request_type): client = RegionNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -964,7 +999,8 @@ def test_get_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1005,7 +1041,14 @@ def test_get_rest_unset_required_fields(): unset_fields = transport.get._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("networkEndpointGroup", "project", "region",)) + set(()) + & set( + ( + "networkEndpointGroup", + "project", + "region", + ) + ) ) @@ -1052,7 +1095,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.NetworkEndpointGroup - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1062,7 +1111,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetRegionNetworkEndpointGroupRequest ): client = RegionNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1087,7 +1137,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = RegionNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1133,7 +1184,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = RegionNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1154,11 +1206,16 @@ def test_get_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.InsertRegionNetworkEndpointGroupRequest, dict,] + "request_type", + [ + compute.InsertRegionNetworkEndpointGroupRequest, + dict, + ], ) def test_insert_unary_rest(request_type): client = RegionNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1296,7 +1353,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1339,7 +1397,13 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("networkEndpointGroupResource", "project", "region",)) + & set( + ( + "networkEndpointGroupResource", + "project", + "region", + ) + ) ) @@ -1385,7 +1449,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1397,7 +1465,8 @@ def test_insert_unary_rest_bad_request( request_type=compute.InsertRegionNetworkEndpointGroupRequest, ): client = RegionNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1446,7 +1515,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = RegionNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1490,7 +1560,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = RegionNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1513,11 +1584,16 @@ def test_insert_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.ListRegionNetworkEndpointGroupsRequest, dict,] + "request_type", + [ + compute.ListRegionNetworkEndpointGroupsRequest, + dict, + ], ) def test_list_rest(request_type): client = RegionNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1582,7 +1658,13 @@ def test_list_rest_required_fields( ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1593,7 +1675,8 @@ def test_list_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1634,8 +1717,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "region",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "region", + ) + ) ) @@ -1682,7 +1778,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.NetworkEndpointGroupList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1692,7 +1794,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListRegionNetworkEndpointGroupsRequest ): client = RegionNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1713,7 +1816,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = RegionNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1725,7 +1829,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "region": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", region="region_value",) + mock_args = dict( + project="project_value", + region="region_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1751,7 +1858,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = RegionNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1766,7 +1874,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = RegionNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1783,12 +1892,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.NetworkEndpointGroupList(items=[], next_page_token="def",), compute.NetworkEndpointGroupList( - items=[compute.NetworkEndpointGroup(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.NetworkEndpointGroupList( - items=[compute.NetworkEndpointGroup(), compute.NetworkEndpointGroup(),], + items=[ + compute.NetworkEndpointGroup(), + ], + next_page_token="ghi", + ), + compute.NetworkEndpointGroupList( + items=[ + compute.NetworkEndpointGroup(), + compute.NetworkEndpointGroup(), + ], ), ) # Two responses for two calls @@ -1822,7 +1940,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RegionNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1843,7 +1962,8 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = RegionNetworkEndpointGroupsClient( - client_options=options, transport=transport, + client_options=options, + transport=transport, ) # It is an error to provide an api_key and a credential. @@ -1860,7 +1980,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RegionNetworkEndpointGroupsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1874,7 +1995,10 @@ def test_transport_instance(): @pytest.mark.parametrize( - "transport_class", [transports.RegionNetworkEndpointGroupsRestTransport,] + "transport_class", + [ + transports.RegionNetworkEndpointGroupsRestTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -1929,7 +2053,8 @@ def test_region_network_endpoint_groups_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.RegionNetworkEndpointGroupsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1979,7 +2104,12 @@ def test_region_network_endpoint_groups_http_transport_client_cert_source_for_mt mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_region_network_endpoint_groups_host_no_port(transport_name): client = RegionNetworkEndpointGroupsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1995,7 +2125,12 @@ def test_region_network_endpoint_groups_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_region_network_endpoint_groups_host_with_port(transport_name): client = RegionNetworkEndpointGroupsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2035,7 +2170,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = RegionNetworkEndpointGroupsClient.common_folder_path(folder) assert expected == actual @@ -2053,7 +2190,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = RegionNetworkEndpointGroupsClient.common_organization_path(organization) assert expected == actual @@ -2071,7 +2210,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = RegionNetworkEndpointGroupsClient.common_project_path(project) assert expected == actual @@ -2091,7 +2232,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = RegionNetworkEndpointGroupsClient.common_location_path(project, location) assert expected == actual @@ -2116,7 +2258,8 @@ def test_client_with_default_client_info(): transports.RegionNetworkEndpointGroupsTransport, "_prep_wrapped_messages" ) as prep: client = RegionNetworkEndpointGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2125,7 +2268,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = RegionNetworkEndpointGroupsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) diff --git a/tests/unit/gapic/compute_v1/test_region_notification_endpoints.py b/tests/unit/gapic/compute_v1/test_region_notification_endpoints.py index ed6b96088..3224cfbbb 100644 --- a/tests/unit/gapic/compute_v1/test_region_notification_endpoints.py +++ b/tests/unit/gapic/compute_v1/test_region_notification_endpoints.py @@ -94,7 +94,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(RegionNotificationEndpointsClient, "rest"),] + "client_class,transport_name", + [ + (RegionNotificationEndpointsClient, "rest"), + ], ) def test_region_notification_endpoints_client_from_service_account_info( client_class, transport_name @@ -118,7 +121,9 @@ def test_region_notification_endpoints_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.RegionNotificationEndpointsRestTransport, "rest"),], + [ + (transports.RegionNotificationEndpointsRestTransport, "rest"), + ], ) def test_region_notification_endpoints_client_service_account_always_use_jwt( transport_class, transport_name @@ -139,7 +144,10 @@ def test_region_notification_endpoints_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(RegionNotificationEndpointsClient, "rest"),] + "client_class,transport_name", + [ + (RegionNotificationEndpointsClient, "rest"), + ], ) def test_region_notification_endpoints_client_from_service_account_file( client_class, transport_name @@ -498,7 +506,9 @@ def test_region_notification_endpoints_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -547,11 +557,16 @@ def test_region_notification_endpoints_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.DeleteRegionNotificationEndpointRequest, dict,] + "request_type", + [ + compute.DeleteRegionNotificationEndpointRequest, + dict, + ], ) def test_delete_unary_rest(request_type): client = RegionNotificationEndpointsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -669,7 +684,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionNotificationEndpointsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -710,7 +726,14 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("notificationEndpoint", "project", "region",)) + set(("requestId",)) + & set( + ( + "notificationEndpoint", + "project", + "region", + ) + ) ) @@ -756,7 +779,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -768,7 +795,8 @@ def test_delete_unary_rest_bad_request( request_type=compute.DeleteRegionNotificationEndpointRequest, ): client = RegionNotificationEndpointsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -793,7 +821,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = RegionNotificationEndpointsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -839,7 +868,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = RegionNotificationEndpointsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -860,11 +890,16 @@ def test_delete_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.GetRegionNotificationEndpointRequest, dict,] + "request_type", + [ + compute.GetRegionNotificationEndpointRequest, + dict, + ], ) def test_get_rest(request_type): client = RegionNotificationEndpointsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -950,7 +985,8 @@ def test_get_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionNotificationEndpointsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -991,7 +1027,14 @@ def test_get_rest_unset_required_fields(): unset_fields = transport.get._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("notificationEndpoint", "project", "region",)) + set(()) + & set( + ( + "notificationEndpoint", + "project", + "region", + ) + ) ) @@ -1038,7 +1081,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.NotificationEndpoint - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1048,7 +1097,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetRegionNotificationEndpointRequest ): client = RegionNotificationEndpointsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1073,7 +1123,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = RegionNotificationEndpointsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1119,7 +1170,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = RegionNotificationEndpointsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1140,11 +1192,16 @@ def test_get_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.InsertRegionNotificationEndpointRequest, dict,] + "request_type", + [ + compute.InsertRegionNotificationEndpointRequest, + dict, + ], ) def test_insert_unary_rest(request_type): client = RegionNotificationEndpointsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1270,7 +1327,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionNotificationEndpointsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1313,7 +1371,13 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("notificationEndpointResource", "project", "region",)) + & set( + ( + "notificationEndpointResource", + "project", + "region", + ) + ) ) @@ -1359,7 +1423,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1371,7 +1439,8 @@ def test_insert_unary_rest_bad_request( request_type=compute.InsertRegionNotificationEndpointRequest, ): client = RegionNotificationEndpointsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1408,7 +1477,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = RegionNotificationEndpointsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1452,7 +1522,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = RegionNotificationEndpointsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1475,11 +1546,16 @@ def test_insert_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.ListRegionNotificationEndpointsRequest, dict,] + "request_type", + [ + compute.ListRegionNotificationEndpointsRequest, + dict, + ], ) def test_list_rest(request_type): client = RegionNotificationEndpointsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1544,7 +1620,13 @@ def test_list_rest_required_fields( ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1555,7 +1637,8 @@ def test_list_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionNotificationEndpointsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1596,8 +1679,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "region",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "region", + ) + ) ) @@ -1644,7 +1740,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.NotificationEndpointList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1654,7 +1756,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListRegionNotificationEndpointsRequest ): client = RegionNotificationEndpointsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1675,7 +1778,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = RegionNotificationEndpointsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1687,7 +1791,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "region": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", region="region_value",) + mock_args = dict( + project="project_value", + region="region_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1713,7 +1820,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = RegionNotificationEndpointsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1728,7 +1836,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = RegionNotificationEndpointsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1745,12 +1854,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.NotificationEndpointList(items=[], next_page_token="def",), compute.NotificationEndpointList( - items=[compute.NotificationEndpoint(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.NotificationEndpointList( - items=[compute.NotificationEndpoint(), compute.NotificationEndpoint(),], + items=[ + compute.NotificationEndpoint(), + ], + next_page_token="ghi", + ), + compute.NotificationEndpointList( + items=[ + compute.NotificationEndpoint(), + compute.NotificationEndpoint(), + ], ), ) # Two responses for two calls @@ -1784,7 +1902,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RegionNotificationEndpointsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1805,7 +1924,8 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = RegionNotificationEndpointsClient( - client_options=options, transport=transport, + client_options=options, + transport=transport, ) # It is an error to provide an api_key and a credential. @@ -1822,7 +1942,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RegionNotificationEndpointsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1836,7 +1957,10 @@ def test_transport_instance(): @pytest.mark.parametrize( - "transport_class", [transports.RegionNotificationEndpointsRestTransport,] + "transport_class", + [ + transports.RegionNotificationEndpointsRestTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -1891,7 +2015,8 @@ def test_region_notification_endpoints_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.RegionNotificationEndpointsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1941,7 +2066,12 @@ def test_region_notification_endpoints_http_transport_client_cert_source_for_mtl mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_region_notification_endpoints_host_no_port(transport_name): client = RegionNotificationEndpointsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1957,7 +2087,12 @@ def test_region_notification_endpoints_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_region_notification_endpoints_host_with_port(transport_name): client = RegionNotificationEndpointsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1997,7 +2132,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = RegionNotificationEndpointsClient.common_folder_path(folder) assert expected == actual @@ -2015,7 +2152,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = RegionNotificationEndpointsClient.common_organization_path(organization) assert expected == actual @@ -2033,7 +2172,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = RegionNotificationEndpointsClient.common_project_path(project) assert expected == actual @@ -2053,7 +2194,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = RegionNotificationEndpointsClient.common_location_path(project, location) assert expected == actual @@ -2078,7 +2220,8 @@ def test_client_with_default_client_info(): transports.RegionNotificationEndpointsTransport, "_prep_wrapped_messages" ) as prep: client = RegionNotificationEndpointsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2087,7 +2230,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = RegionNotificationEndpointsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) diff --git a/tests/unit/gapic/compute_v1/test_region_operations.py b/tests/unit/gapic/compute_v1/test_region_operations.py index 39552538a..41898f2b8 100644 --- a/tests/unit/gapic/compute_v1/test_region_operations.py +++ b/tests/unit/gapic/compute_v1/test_region_operations.py @@ -90,7 +90,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(RegionOperationsClient, "rest"),] + "client_class,transport_name", + [ + (RegionOperationsClient, "rest"), + ], ) def test_region_operations_client_from_service_account_info( client_class, transport_name @@ -114,7 +117,9 @@ def test_region_operations_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.RegionOperationsRestTransport, "rest"),], + [ + (transports.RegionOperationsRestTransport, "rest"), + ], ) def test_region_operations_client_service_account_always_use_jwt( transport_class, transport_name @@ -135,7 +140,10 @@ def test_region_operations_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(RegionOperationsClient, "rest"),] + "client_class,transport_name", + [ + (RegionOperationsClient, "rest"), + ], ) def test_region_operations_client_from_service_account_file( client_class, transport_name @@ -177,7 +185,9 @@ def test_region_operations_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(RegionOperationsClient, transports.RegionOperationsRestTransport, "rest"),], + [ + (RegionOperationsClient, transports.RegionOperationsRestTransport, "rest"), + ], ) @mock.patch.object( RegionOperationsClient, @@ -470,13 +480,17 @@ def test_region_operations_client_get_mtls_endpoint_and_cert_source(client_class @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(RegionOperationsClient, transports.RegionOperationsRestTransport, "rest"),], + [ + (RegionOperationsClient, transports.RegionOperationsRestTransport, "rest"), + ], ) def test_region_operations_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -494,7 +508,14 @@ def test_region_operations_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(RegionOperationsClient, transports.RegionOperationsRestTransport, "rest", None),], + [ + ( + RegionOperationsClient, + transports.RegionOperationsRestTransport, + "rest", + None, + ), + ], ) def test_region_operations_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -517,10 +538,17 @@ def test_region_operations_client_client_options_credentials_file( ) -@pytest.mark.parametrize("request_type", [compute.DeleteRegionOperationRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteRegionOperationRequest, + dict, + ], +) def test_delete_rest(request_type): client = RegionOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -585,7 +613,8 @@ def test_delete_rest_required_fields(request_type=compute.DeleteRegionOperationR assert jsonified_request["region"] == "region_value" client = RegionOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -627,7 +656,16 @@ def test_delete_rest_unset_required_fields(): ) unset_fields = transport.delete._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("operation", "project", "region",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "operation", + "project", + "region", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -673,7 +711,13 @@ def test_delete_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.DeleteRegionOperationResponse - client.delete(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.delete( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -683,7 +727,8 @@ def test_delete_rest_bad_request( transport: str = "rest", request_type=compute.DeleteRegionOperationRequest ): client = RegionOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -704,7 +749,8 @@ def test_delete_rest_bad_request( def test_delete_rest_flattened(): client = RegionOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -721,7 +767,9 @@ def test_delete_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", region="region_value", operation="operation_value", + project="project_value", + region="region_value", + operation="operation_value", ) mock_args.update(sample_request) @@ -748,7 +796,8 @@ def test_delete_rest_flattened(): def test_delete_rest_flattened_error(transport: str = "rest"): client = RegionOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -768,10 +817,17 @@ def test_delete_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetRegionOperationRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetRegionOperationRequest, + dict, + ], +) def test_get_rest(request_type): client = RegionOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -881,7 +937,8 @@ def test_get_rest_required_fields(request_type=compute.GetRegionOperationRequest assert jsonified_request["region"] == "region_value" client = RegionOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -921,7 +978,16 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("operation", "project", "region",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "operation", + "project", + "region", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -965,7 +1031,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -975,7 +1047,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetRegionOperationRequest ): client = RegionOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -996,7 +1069,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = RegionOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1013,7 +1087,9 @@ def test_get_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", region="region_value", operation="operation_value", + project="project_value", + region="region_value", + operation="operation_value", ) mock_args.update(sample_request) @@ -1040,7 +1116,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = RegionOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1060,10 +1137,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListRegionOperationsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListRegionOperationsRequest, + dict, + ], +) def test_list_rest(request_type): client = RegionOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1126,7 +1210,13 @@ def test_list_rest_required_fields(request_type=compute.ListRegionOperationsRequ ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1137,7 +1227,8 @@ def test_list_rest_required_fields(request_type=compute.ListRegionOperationsRequ assert jsonified_request["region"] == "region_value" client = RegionOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1178,8 +1269,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "region",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "region", + ) + ) ) @@ -1226,7 +1330,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.OperationList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1236,7 +1346,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListRegionOperationsRequest ): client = RegionOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1257,7 +1368,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = RegionOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1269,7 +1381,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "region": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", region="region_value",) + mock_args = dict( + project="project_value", + region="region_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1295,7 +1410,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = RegionOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1310,7 +1426,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = RegionOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1320,12 +1437,29 @@ def test_list_rest_pager(transport: str = "rest"): # Set the response as a series of pages response = ( compute.OperationList( - items=[compute.Operation(), compute.Operation(), compute.Operation(),], + items=[ + compute.Operation(), + compute.Operation(), + compute.Operation(), + ], next_page_token="abc", ), - compute.OperationList(items=[], next_page_token="def",), - compute.OperationList(items=[compute.Operation(),], next_page_token="ghi",), - compute.OperationList(items=[compute.Operation(), compute.Operation(),],), + compute.OperationList( + items=[], + next_page_token="def", + ), + compute.OperationList( + items=[ + compute.Operation(), + ], + next_page_token="ghi", + ), + compute.OperationList( + items=[ + compute.Operation(), + compute.Operation(), + ], + ), ) # Two responses for two calls response = response + response @@ -1351,10 +1485,17 @@ def test_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.WaitRegionOperationRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.WaitRegionOperationRequest, + dict, + ], +) def test_wait_rest(request_type): client = RegionOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1464,7 +1605,8 @@ def test_wait_rest_required_fields(request_type=compute.WaitRegionOperationReque assert jsonified_request["region"] == "region_value" client = RegionOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1504,7 +1646,16 @@ def test_wait_rest_unset_required_fields(): ) unset_fields = transport.wait._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("operation", "project", "region",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "operation", + "project", + "region", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1548,7 +1699,13 @@ def test_wait_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.wait(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.wait( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1558,7 +1715,8 @@ def test_wait_rest_bad_request( transport: str = "rest", request_type=compute.WaitRegionOperationRequest ): client = RegionOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1579,7 +1737,8 @@ def test_wait_rest_bad_request( def test_wait_rest_flattened(): client = RegionOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1596,7 +1755,9 @@ def test_wait_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", region="region_value", operation="operation_value", + project="project_value", + region="region_value", + operation="operation_value", ) mock_args.update(sample_request) @@ -1623,7 +1784,8 @@ def test_wait_rest_flattened(): def test_wait_rest_flattened_error(transport: str = "rest"): client = RegionOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1650,7 +1812,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RegionOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1670,7 +1833,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = RegionOperationsClient(client_options=options, transport=transport,) + client = RegionOperationsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1686,7 +1852,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RegionOperationsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1699,7 +1866,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.RegionOperationsRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.RegionOperationsRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -1753,7 +1925,8 @@ def test_region_operations_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.RegionOperationsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1803,7 +1976,12 @@ def test_region_operations_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_region_operations_host_no_port(transport_name): client = RegionOperationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1819,7 +1997,12 @@ def test_region_operations_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_region_operations_host_with_port(transport_name): client = RegionOperationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1857,7 +2040,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = RegionOperationsClient.common_folder_path(folder) assert expected == actual @@ -1875,7 +2060,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = RegionOperationsClient.common_organization_path(organization) assert expected == actual @@ -1893,7 +2080,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = RegionOperationsClient.common_project_path(project) assert expected == actual @@ -1913,7 +2102,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = RegionOperationsClient.common_location_path(project, location) assert expected == actual @@ -1938,7 +2128,8 @@ def test_client_with_default_client_info(): transports.RegionOperationsTransport, "_prep_wrapped_messages" ) as prep: client = RegionOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1947,7 +2138,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = RegionOperationsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1987,7 +2179,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(RegionOperationsClient, transports.RegionOperationsRestTransport),], + [ + (RegionOperationsClient, transports.RegionOperationsRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_region_ssl_certificates.py b/tests/unit/gapic/compute_v1/test_region_ssl_certificates.py index d7a00bf8e..d083921db 100644 --- a/tests/unit/gapic/compute_v1/test_region_ssl_certificates.py +++ b/tests/unit/gapic/compute_v1/test_region_ssl_certificates.py @@ -92,7 +92,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(RegionSslCertificatesClient, "rest"),] + "client_class,transport_name", + [ + (RegionSslCertificatesClient, "rest"), + ], ) def test_region_ssl_certificates_client_from_service_account_info( client_class, transport_name @@ -116,7 +119,9 @@ def test_region_ssl_certificates_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.RegionSslCertificatesRestTransport, "rest"),], + [ + (transports.RegionSslCertificatesRestTransport, "rest"), + ], ) def test_region_ssl_certificates_client_service_account_always_use_jwt( transport_class, transport_name @@ -137,7 +142,10 @@ def test_region_ssl_certificates_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(RegionSslCertificatesClient, "rest"),] + "client_class,transport_name", + [ + (RegionSslCertificatesClient, "rest"), + ], ) def test_region_ssl_certificates_client_from_service_account_file( client_class, transport_name @@ -490,7 +498,9 @@ def test_region_ssl_certificates_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -539,11 +549,16 @@ def test_region_ssl_certificates_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.DeleteRegionSslCertificateRequest, dict,] + "request_type", + [ + compute.DeleteRegionSslCertificateRequest, + dict, + ], ) def test_delete_unary_rest(request_type): client = RegionSslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -661,7 +676,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["sslCertificate"] == "ssl_certificate_value" client = RegionSslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -702,7 +718,14 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "region", "sslCertificate",)) + set(("requestId",)) + & set( + ( + "project", + "region", + "sslCertificate", + ) + ) ) @@ -748,7 +771,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -759,7 +786,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteRegionSslCertificateRequest ): client = RegionSslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -784,7 +812,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = RegionSslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -830,7 +859,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = RegionSslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -851,11 +881,16 @@ def test_delete_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.GetRegionSslCertificateRequest, dict,] + "request_type", + [ + compute.GetRegionSslCertificateRequest, + dict, + ], ) def test_get_rest(request_type): client = RegionSslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -949,7 +984,8 @@ def test_get_rest_required_fields(request_type=compute.GetRegionSslCertificateRe assert jsonified_request["sslCertificate"] == "ssl_certificate_value" client = RegionSslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -990,7 +1026,14 @@ def test_get_rest_unset_required_fields(): unset_fields = transport.get._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("project", "region", "sslCertificate",)) + set(()) + & set( + ( + "project", + "region", + "sslCertificate", + ) + ) ) @@ -1037,7 +1080,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.SslCertificate - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1047,7 +1096,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetRegionSslCertificateRequest ): client = RegionSslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1072,7 +1122,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = RegionSslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1118,7 +1169,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = RegionSslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1139,11 +1191,16 @@ def test_get_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.InsertRegionSslCertificateRequest, dict,] + "request_type", + [ + compute.InsertRegionSslCertificateRequest, + dict, + ], ) def test_insert_unary_rest(request_type): client = RegionSslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1279,7 +1336,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionSslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1321,7 +1379,14 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "region", "sslCertificateResource",)) + set(("requestId",)) + & set( + ( + "project", + "region", + "sslCertificateResource", + ) + ) ) @@ -1367,7 +1432,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1378,7 +1447,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertRegionSslCertificateRequest ): client = RegionSslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1425,7 +1495,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = RegionSslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1469,7 +1540,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = RegionSslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1492,11 +1564,16 @@ def test_insert_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.ListRegionSslCertificatesRequest, dict,] + "request_type", + [ + compute.ListRegionSslCertificatesRequest, + dict, + ], ) def test_list_rest(request_type): client = RegionSslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1561,7 +1638,13 @@ def test_list_rest_required_fields( ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1572,7 +1655,8 @@ def test_list_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionSslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1613,8 +1697,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "region",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "region", + ) + ) ) @@ -1661,7 +1758,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.SslCertificateList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1671,7 +1774,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListRegionSslCertificatesRequest ): client = RegionSslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1692,7 +1796,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = RegionSslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1704,7 +1809,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "region": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", region="region_value",) + mock_args = dict( + project="project_value", + region="region_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1730,7 +1838,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = RegionSslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1745,7 +1854,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = RegionSslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1762,12 +1872,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.SslCertificateList(items=[], next_page_token="def",), compute.SslCertificateList( - items=[compute.SslCertificate(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.SslCertificateList( - items=[compute.SslCertificate(), compute.SslCertificate(),], + items=[ + compute.SslCertificate(), + ], + next_page_token="ghi", + ), + compute.SslCertificateList( + items=[ + compute.SslCertificate(), + compute.SslCertificate(), + ], ), ) # Two responses for two calls @@ -1801,7 +1920,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RegionSslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1822,7 +1942,8 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = RegionSslCertificatesClient( - client_options=options, transport=transport, + client_options=options, + transport=transport, ) # It is an error to provide an api_key and a credential. @@ -1839,7 +1960,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RegionSslCertificatesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1853,7 +1975,10 @@ def test_transport_instance(): @pytest.mark.parametrize( - "transport_class", [transports.RegionSslCertificatesRestTransport,] + "transport_class", + [ + transports.RegionSslCertificatesRestTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -1908,7 +2033,8 @@ def test_region_ssl_certificates_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.RegionSslCertificatesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1958,7 +2084,12 @@ def test_region_ssl_certificates_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_region_ssl_certificates_host_no_port(transport_name): client = RegionSslCertificatesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1974,7 +2105,12 @@ def test_region_ssl_certificates_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_region_ssl_certificates_host_with_port(transport_name): client = RegionSslCertificatesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2012,7 +2148,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = RegionSslCertificatesClient.common_folder_path(folder) assert expected == actual @@ -2030,7 +2168,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = RegionSslCertificatesClient.common_organization_path(organization) assert expected == actual @@ -2048,7 +2188,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = RegionSslCertificatesClient.common_project_path(project) assert expected == actual @@ -2068,7 +2210,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = RegionSslCertificatesClient.common_location_path(project, location) assert expected == actual @@ -2093,7 +2236,8 @@ def test_client_with_default_client_info(): transports.RegionSslCertificatesTransport, "_prep_wrapped_messages" ) as prep: client = RegionSslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2102,7 +2246,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = RegionSslCertificatesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2142,7 +2287,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(RegionSslCertificatesClient, transports.RegionSslCertificatesRestTransport),], + [ + (RegionSslCertificatesClient, transports.RegionSslCertificatesRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_region_target_http_proxies.py b/tests/unit/gapic/compute_v1/test_region_target_http_proxies.py index e465ccb6a..5e2d0ce43 100644 --- a/tests/unit/gapic/compute_v1/test_region_target_http_proxies.py +++ b/tests/unit/gapic/compute_v1/test_region_target_http_proxies.py @@ -92,7 +92,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(RegionTargetHttpProxiesClient, "rest"),] + "client_class,transport_name", + [ + (RegionTargetHttpProxiesClient, "rest"), + ], ) def test_region_target_http_proxies_client_from_service_account_info( client_class, transport_name @@ -116,7 +119,9 @@ def test_region_target_http_proxies_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.RegionTargetHttpProxiesRestTransport, "rest"),], + [ + (transports.RegionTargetHttpProxiesRestTransport, "rest"), + ], ) def test_region_target_http_proxies_client_service_account_always_use_jwt( transport_class, transport_name @@ -137,7 +142,10 @@ def test_region_target_http_proxies_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(RegionTargetHttpProxiesClient, "rest"),] + "client_class,transport_name", + [ + (RegionTargetHttpProxiesClient, "rest"), + ], ) def test_region_target_http_proxies_client_from_service_account_file( client_class, transport_name @@ -492,7 +500,9 @@ def test_region_target_http_proxies_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -541,11 +551,16 @@ def test_region_target_http_proxies_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.DeleteRegionTargetHttpProxyRequest, dict,] + "request_type", + [ + compute.DeleteRegionTargetHttpProxyRequest, + dict, + ], ) def test_delete_unary_rest(request_type): client = RegionTargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -663,7 +678,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["targetHttpProxy"] == "target_http_proxy_value" client = RegionTargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -704,7 +720,14 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "region", "targetHttpProxy",)) + set(("requestId",)) + & set( + ( + "project", + "region", + "targetHttpProxy", + ) + ) ) @@ -750,7 +773,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -761,7 +788,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteRegionTargetHttpProxyRequest ): client = RegionTargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -786,7 +814,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = RegionTargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -832,7 +861,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = RegionTargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -853,11 +883,16 @@ def test_delete_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.GetRegionTargetHttpProxyRequest, dict,] + "request_type", + [ + compute.GetRegionTargetHttpProxyRequest, + dict, + ], ) def test_get_rest(request_type): client = RegionTargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -947,7 +982,8 @@ def test_get_rest_required_fields(request_type=compute.GetRegionTargetHttpProxyR assert jsonified_request["targetHttpProxy"] == "target_http_proxy_value" client = RegionTargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -988,7 +1024,14 @@ def test_get_rest_unset_required_fields(): unset_fields = transport.get._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("project", "region", "targetHttpProxy",)) + set(()) + & set( + ( + "project", + "region", + "targetHttpProxy", + ) + ) ) @@ -1035,7 +1078,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.TargetHttpProxy - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1045,7 +1094,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetRegionTargetHttpProxyRequest ): client = RegionTargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1070,7 +1120,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = RegionTargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1116,7 +1167,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = RegionTargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1137,11 +1189,16 @@ def test_get_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.InsertRegionTargetHttpProxyRequest, dict,] + "request_type", + [ + compute.InsertRegionTargetHttpProxyRequest, + dict, + ], ) def test_insert_unary_rest(request_type): client = RegionTargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1263,7 +1320,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionTargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1305,7 +1363,14 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "region", "targetHttpProxyResource",)) + set(("requestId",)) + & set( + ( + "project", + "region", + "targetHttpProxyResource", + ) + ) ) @@ -1351,7 +1416,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1362,7 +1431,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertRegionTargetHttpProxyRequest ): client = RegionTargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1395,7 +1465,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = RegionTargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1439,7 +1510,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = RegionTargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1462,11 +1534,16 @@ def test_insert_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.ListRegionTargetHttpProxiesRequest, dict,] + "request_type", + [ + compute.ListRegionTargetHttpProxiesRequest, + dict, + ], ) def test_list_rest(request_type): client = RegionTargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1531,7 +1608,13 @@ def test_list_rest_required_fields( ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1542,7 +1625,8 @@ def test_list_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionTargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1583,8 +1667,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "region",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "region", + ) + ) ) @@ -1631,7 +1728,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.TargetHttpProxyList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1641,7 +1744,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListRegionTargetHttpProxiesRequest ): client = RegionTargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1662,7 +1766,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = RegionTargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1674,7 +1779,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "region": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", region="region_value",) + mock_args = dict( + project="project_value", + region="region_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1700,7 +1808,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = RegionTargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1715,7 +1824,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = RegionTargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1732,12 +1842,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.TargetHttpProxyList(items=[], next_page_token="def",), compute.TargetHttpProxyList( - items=[compute.TargetHttpProxy(),], next_page_token="ghi", + items=[], + next_page_token="def", + ), + compute.TargetHttpProxyList( + items=[ + compute.TargetHttpProxy(), + ], + next_page_token="ghi", ), compute.TargetHttpProxyList( - items=[compute.TargetHttpProxy(), compute.TargetHttpProxy(),], + items=[ + compute.TargetHttpProxy(), + compute.TargetHttpProxy(), + ], ), ) # Two responses for two calls @@ -1765,11 +1884,16 @@ def test_list_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.SetUrlMapRegionTargetHttpProxyRequest, dict,] + "request_type", + [ + compute.SetUrlMapRegionTargetHttpProxyRequest, + dict, + ], ) def test_set_url_map_unary_rest(request_type): client = RegionTargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1888,7 +2012,8 @@ def test_set_url_map_unary_rest_required_fields( assert jsonified_request["targetHttpProxy"] == "target_http_proxy_value" client = RegionTargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1931,7 +2056,14 @@ def test_set_url_map_unary_rest_unset_required_fields(): unset_fields = transport.set_url_map._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("project", "region", "targetHttpProxy", "urlMapReferenceResource",)) + & set( + ( + "project", + "region", + "targetHttpProxy", + "urlMapReferenceResource", + ) + ) ) @@ -1977,7 +2109,11 @@ def test_set_url_map_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_url_map_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1988,7 +2124,8 @@ def test_set_url_map_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetUrlMapRegionTargetHttpProxyRequest ): client = RegionTargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2014,7 +2151,8 @@ def test_set_url_map_unary_rest_bad_request( def test_set_url_map_unary_rest_flattened(): client = RegionTargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2061,7 +2199,8 @@ def test_set_url_map_unary_rest_flattened(): def test_set_url_map_unary_rest_flattened_error(transport: str = "rest"): client = RegionTargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2089,7 +2228,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RegionTargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2110,7 +2250,8 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = RegionTargetHttpProxiesClient( - client_options=options, transport=transport, + client_options=options, + transport=transport, ) # It is an error to provide an api_key and a credential. @@ -2127,7 +2268,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RegionTargetHttpProxiesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2141,7 +2283,10 @@ def test_transport_instance(): @pytest.mark.parametrize( - "transport_class", [transports.RegionTargetHttpProxiesRestTransport,] + "transport_class", + [ + transports.RegionTargetHttpProxiesRestTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -2197,7 +2342,8 @@ def test_region_target_http_proxies_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.RegionTargetHttpProxiesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2247,7 +2393,12 @@ def test_region_target_http_proxies_http_transport_client_cert_source_for_mtls() mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_region_target_http_proxies_host_no_port(transport_name): client = RegionTargetHttpProxiesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2263,7 +2414,12 @@ def test_region_target_http_proxies_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_region_target_http_proxies_host_with_port(transport_name): client = RegionTargetHttpProxiesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2301,7 +2457,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = RegionTargetHttpProxiesClient.common_folder_path(folder) assert expected == actual @@ -2319,7 +2477,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = RegionTargetHttpProxiesClient.common_organization_path(organization) assert expected == actual @@ -2337,7 +2497,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = RegionTargetHttpProxiesClient.common_project_path(project) assert expected == actual @@ -2357,7 +2519,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = RegionTargetHttpProxiesClient.common_location_path(project, location) assert expected == actual @@ -2382,7 +2545,8 @@ def test_client_with_default_client_info(): transports.RegionTargetHttpProxiesTransport, "_prep_wrapped_messages" ) as prep: client = RegionTargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2391,7 +2555,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = RegionTargetHttpProxiesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2431,7 +2596,12 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(RegionTargetHttpProxiesClient, transports.RegionTargetHttpProxiesRestTransport),], + [ + ( + RegionTargetHttpProxiesClient, + transports.RegionTargetHttpProxiesRestTransport, + ), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_region_target_https_proxies.py b/tests/unit/gapic/compute_v1/test_region_target_https_proxies.py index e11918f59..615c6126f 100644 --- a/tests/unit/gapic/compute_v1/test_region_target_https_proxies.py +++ b/tests/unit/gapic/compute_v1/test_region_target_https_proxies.py @@ -92,7 +92,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(RegionTargetHttpsProxiesClient, "rest"),] + "client_class,transport_name", + [ + (RegionTargetHttpsProxiesClient, "rest"), + ], ) def test_region_target_https_proxies_client_from_service_account_info( client_class, transport_name @@ -116,7 +119,9 @@ def test_region_target_https_proxies_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.RegionTargetHttpsProxiesRestTransport, "rest"),], + [ + (transports.RegionTargetHttpsProxiesRestTransport, "rest"), + ], ) def test_region_target_https_proxies_client_service_account_always_use_jwt( transport_class, transport_name @@ -137,7 +142,10 @@ def test_region_target_https_proxies_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(RegionTargetHttpsProxiesClient, "rest"),] + "client_class,transport_name", + [ + (RegionTargetHttpsProxiesClient, "rest"), + ], ) def test_region_target_https_proxies_client_from_service_account_file( client_class, transport_name @@ -496,7 +504,9 @@ def test_region_target_https_proxies_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -545,11 +555,16 @@ def test_region_target_https_proxies_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.DeleteRegionTargetHttpsProxyRequest, dict,] + "request_type", + [ + compute.DeleteRegionTargetHttpsProxyRequest, + dict, + ], ) def test_delete_unary_rest(request_type): client = RegionTargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -667,7 +682,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["targetHttpsProxy"] == "target_https_proxy_value" client = RegionTargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -708,7 +724,14 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "region", "targetHttpsProxy",)) + set(("requestId",)) + & set( + ( + "project", + "region", + "targetHttpsProxy", + ) + ) ) @@ -754,7 +777,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -765,7 +792,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteRegionTargetHttpsProxyRequest ): client = RegionTargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -790,7 +818,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = RegionTargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -836,7 +865,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = RegionTargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -857,11 +887,16 @@ def test_delete_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.GetRegionTargetHttpsProxyRequest, dict,] + "request_type", + [ + compute.GetRegionTargetHttpsProxyRequest, + dict, + ], ) def test_get_rest(request_type): client = RegionTargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -963,7 +998,8 @@ def test_get_rest_required_fields( assert jsonified_request["targetHttpsProxy"] == "target_https_proxy_value" client = RegionTargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1004,7 +1040,14 @@ def test_get_rest_unset_required_fields(): unset_fields = transport.get._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("project", "region", "targetHttpsProxy",)) + set(()) + & set( + ( + "project", + "region", + "targetHttpsProxy", + ) + ) ) @@ -1051,7 +1094,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.TargetHttpsProxy - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1061,7 +1110,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetRegionTargetHttpsProxyRequest ): client = RegionTargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1086,7 +1136,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = RegionTargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1132,7 +1183,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = RegionTargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1153,11 +1205,16 @@ def test_get_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.InsertRegionTargetHttpsProxyRequest, dict,] + "request_type", + [ + compute.InsertRegionTargetHttpsProxyRequest, + dict, + ], ) def test_insert_unary_rest(request_type): client = RegionTargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1284,7 +1341,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionTargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1326,7 +1384,14 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "region", "targetHttpsProxyResource",)) + set(("requestId",)) + & set( + ( + "project", + "region", + "targetHttpsProxyResource", + ) + ) ) @@ -1372,7 +1437,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1383,7 +1452,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertRegionTargetHttpsProxyRequest ): client = RegionTargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1421,7 +1491,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = RegionTargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1465,7 +1536,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = RegionTargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1488,11 +1560,16 @@ def test_insert_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.ListRegionTargetHttpsProxiesRequest, dict,] + "request_type", + [ + compute.ListRegionTargetHttpsProxiesRequest, + dict, + ], ) def test_list_rest(request_type): client = RegionTargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1557,7 +1634,13 @@ def test_list_rest_required_fields( ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1568,7 +1651,8 @@ def test_list_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionTargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1609,8 +1693,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "region",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "region", + ) + ) ) @@ -1657,7 +1754,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.TargetHttpsProxyList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1667,7 +1770,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListRegionTargetHttpsProxiesRequest ): client = RegionTargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1688,7 +1792,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = RegionTargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1700,7 +1805,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "region": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", region="region_value",) + mock_args = dict( + project="project_value", + region="region_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1726,7 +1834,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = RegionTargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1741,7 +1850,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = RegionTargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1758,12 +1868,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.TargetHttpsProxyList(items=[], next_page_token="def",), compute.TargetHttpsProxyList( - items=[compute.TargetHttpsProxy(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.TargetHttpsProxyList( - items=[compute.TargetHttpsProxy(), compute.TargetHttpsProxy(),], + items=[ + compute.TargetHttpsProxy(), + ], + next_page_token="ghi", + ), + compute.TargetHttpsProxyList( + items=[ + compute.TargetHttpsProxy(), + compute.TargetHttpsProxy(), + ], ), ) # Two responses for two calls @@ -1791,11 +1910,16 @@ def test_list_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.SetSslCertificatesRegionTargetHttpsProxyRequest, dict,] + "request_type", + [ + compute.SetSslCertificatesRegionTargetHttpsProxyRequest, + dict, + ], ) def test_set_ssl_certificates_unary_rest(request_type): client = RegionTargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1916,7 +2040,8 @@ def test_set_ssl_certificates_unary_rest_required_fields( assert jsonified_request["targetHttpsProxy"] == "target_https_proxy_value" client = RegionTargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2012,7 +2137,11 @@ def test_set_ssl_certificates_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_ssl_certificates_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2024,7 +2153,8 @@ def test_set_ssl_certificates_unary_rest_bad_request( request_type=compute.SetSslCertificatesRegionTargetHttpsProxyRequest, ): client = RegionTargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2052,7 +2182,8 @@ def test_set_ssl_certificates_unary_rest_bad_request( def test_set_ssl_certificates_unary_rest_flattened(): client = RegionTargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2101,7 +2232,8 @@ def test_set_ssl_certificates_unary_rest_flattened(): def test_set_ssl_certificates_unary_rest_flattened_error(transport: str = "rest"): client = RegionTargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2125,11 +2257,16 @@ def test_set_ssl_certificates_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SetUrlMapRegionTargetHttpsProxyRequest, dict,] + "request_type", + [ + compute.SetUrlMapRegionTargetHttpsProxyRequest, + dict, + ], ) def test_set_url_map_unary_rest(request_type): client = RegionTargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2248,7 +2385,8 @@ def test_set_url_map_unary_rest_required_fields( assert jsonified_request["targetHttpsProxy"] == "target_https_proxy_value" client = RegionTargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2291,7 +2429,14 @@ def test_set_url_map_unary_rest_unset_required_fields(): unset_fields = transport.set_url_map._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("project", "region", "targetHttpsProxy", "urlMapReferenceResource",)) + & set( + ( + "project", + "region", + "targetHttpsProxy", + "urlMapReferenceResource", + ) + ) ) @@ -2337,7 +2482,11 @@ def test_set_url_map_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_url_map_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2348,7 +2497,8 @@ def test_set_url_map_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetUrlMapRegionTargetHttpsProxyRequest ): client = RegionTargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2374,7 +2524,8 @@ def test_set_url_map_unary_rest_bad_request( def test_set_url_map_unary_rest_flattened(): client = RegionTargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2421,7 +2572,8 @@ def test_set_url_map_unary_rest_flattened(): def test_set_url_map_unary_rest_flattened_error(transport: str = "rest"): client = RegionTargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2449,7 +2601,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RegionTargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2470,7 +2623,8 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = RegionTargetHttpsProxiesClient( - client_options=options, transport=transport, + client_options=options, + transport=transport, ) # It is an error to provide an api_key and a credential. @@ -2487,7 +2641,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RegionTargetHttpsProxiesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2501,7 +2656,10 @@ def test_transport_instance(): @pytest.mark.parametrize( - "transport_class", [transports.RegionTargetHttpsProxiesRestTransport,] + "transport_class", + [ + transports.RegionTargetHttpsProxiesRestTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -2558,7 +2716,8 @@ def test_region_target_https_proxies_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.RegionTargetHttpsProxiesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2608,7 +2767,12 @@ def test_region_target_https_proxies_http_transport_client_cert_source_for_mtls( mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_region_target_https_proxies_host_no_port(transport_name): client = RegionTargetHttpsProxiesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2624,7 +2788,12 @@ def test_region_target_https_proxies_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_region_target_https_proxies_host_with_port(transport_name): client = RegionTargetHttpsProxiesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2662,7 +2831,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = RegionTargetHttpsProxiesClient.common_folder_path(folder) assert expected == actual @@ -2680,7 +2851,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = RegionTargetHttpsProxiesClient.common_organization_path(organization) assert expected == actual @@ -2698,7 +2871,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = RegionTargetHttpsProxiesClient.common_project_path(project) assert expected == actual @@ -2718,7 +2893,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = RegionTargetHttpsProxiesClient.common_location_path(project, location) assert expected == actual @@ -2743,7 +2919,8 @@ def test_client_with_default_client_info(): transports.RegionTargetHttpsProxiesTransport, "_prep_wrapped_messages" ) as prep: client = RegionTargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2752,7 +2929,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = RegionTargetHttpsProxiesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) diff --git a/tests/unit/gapic/compute_v1/test_region_url_maps.py b/tests/unit/gapic/compute_v1/test_region_url_maps.py index 6297a9b00..a0ba02bdc 100644 --- a/tests/unit/gapic/compute_v1/test_region_url_maps.py +++ b/tests/unit/gapic/compute_v1/test_region_url_maps.py @@ -89,7 +89,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(RegionUrlMapsClient, "rest"),] + "client_class,transport_name", + [ + (RegionUrlMapsClient, "rest"), + ], ) def test_region_url_maps_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() @@ -110,7 +113,10 @@ def test_region_url_maps_client_from_service_account_info(client_class, transpor @pytest.mark.parametrize( - "transport_class,transport_name", [(transports.RegionUrlMapsRestTransport, "rest"),] + "transport_class,transport_name", + [ + (transports.RegionUrlMapsRestTransport, "rest"), + ], ) def test_region_url_maps_client_service_account_always_use_jwt( transport_class, transport_name @@ -131,7 +137,10 @@ def test_region_url_maps_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(RegionUrlMapsClient, "rest"),] + "client_class,transport_name", + [ + (RegionUrlMapsClient, "rest"), + ], ) def test_region_url_maps_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() @@ -171,7 +180,9 @@ def test_region_url_maps_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(RegionUrlMapsClient, transports.RegionUrlMapsRestTransport, "rest"),], + [ + (RegionUrlMapsClient, transports.RegionUrlMapsRestTransport, "rest"), + ], ) @mock.patch.object( RegionUrlMapsClient, @@ -454,13 +465,17 @@ def test_region_url_maps_client_get_mtls_endpoint_and_cert_source(client_class): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(RegionUrlMapsClient, transports.RegionUrlMapsRestTransport, "rest"),], + [ + (RegionUrlMapsClient, transports.RegionUrlMapsRestTransport, "rest"), + ], ) def test_region_url_maps_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -478,7 +493,9 @@ def test_region_url_maps_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(RegionUrlMapsClient, transports.RegionUrlMapsRestTransport, "rest", None),], + [ + (RegionUrlMapsClient, transports.RegionUrlMapsRestTransport, "rest", None), + ], ) def test_region_url_maps_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -501,10 +518,17 @@ def test_region_url_maps_client_client_options_credentials_file( ) -@pytest.mark.parametrize("request_type", [compute.DeleteRegionUrlMapRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteRegionUrlMapRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -618,7 +642,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["urlMap"] == "url_map_value" client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -659,7 +684,14 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "region", "urlMap",)) + set(("requestId",)) + & set( + ( + "project", + "region", + "urlMap", + ) + ) ) @@ -705,7 +737,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -716,7 +752,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteRegionUrlMapRequest ): client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -737,7 +774,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -754,7 +792,9 @@ def test_delete_unary_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", region="region_value", url_map="url_map_value", + project="project_value", + region="region_value", + url_map="url_map_value", ) mock_args.update(sample_request) @@ -781,7 +821,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -801,10 +842,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetRegionUrlMapRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetRegionUrlMapRequest, + dict, + ], +) def test_get_rest(request_type): client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -888,7 +936,8 @@ def test_get_rest_required_fields(request_type=compute.GetRegionUrlMapRequest): assert jsonified_request["urlMap"] == "url_map_value" client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -928,7 +977,16 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("project", "region", "urlMap",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "project", + "region", + "urlMap", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -972,7 +1030,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.UrlMap - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -982,7 +1046,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetRegionUrlMapRequest ): client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1003,7 +1068,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1020,7 +1086,9 @@ def test_get_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", region="region_value", url_map="url_map_value", + project="project_value", + region="region_value", + url_map="url_map_value", ) mock_args.update(sample_request) @@ -1047,7 +1115,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1067,10 +1136,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertRegionUrlMapRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertRegionUrlMapRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1349,7 +1425,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1391,7 +1468,14 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "region", "urlMapResource",)) + set(("requestId",)) + & set( + ( + "project", + "region", + "urlMapResource", + ) + ) ) @@ -1437,7 +1521,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1448,7 +1536,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertRegionUrlMapRequest ): client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1638,7 +1727,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1682,7 +1772,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1704,10 +1795,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListRegionUrlMapsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListRegionUrlMapsRequest, + dict, + ], +) def test_list_rest(request_type): client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1770,7 +1868,13 @@ def test_list_rest_required_fields(request_type=compute.ListRegionUrlMapsRequest ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1781,7 +1885,8 @@ def test_list_rest_required_fields(request_type=compute.ListRegionUrlMapsRequest assert jsonified_request["region"] == "region_value" client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1822,8 +1927,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "region",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "region", + ) + ) ) @@ -1868,7 +1986,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.UrlMapList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1878,7 +2002,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListRegionUrlMapsRequest ): client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1899,7 +2024,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1911,7 +2037,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "region": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", region="region_value",) + mock_args = dict( + project="project_value", + region="region_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1937,7 +2066,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1952,7 +2082,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1962,12 +2093,29 @@ def test_list_rest_pager(transport: str = "rest"): # Set the response as a series of pages response = ( compute.UrlMapList( - items=[compute.UrlMap(), compute.UrlMap(), compute.UrlMap(),], + items=[ + compute.UrlMap(), + compute.UrlMap(), + compute.UrlMap(), + ], next_page_token="abc", ), - compute.UrlMapList(items=[], next_page_token="def",), - compute.UrlMapList(items=[compute.UrlMap(),], next_page_token="ghi",), - compute.UrlMapList(items=[compute.UrlMap(), compute.UrlMap(),],), + compute.UrlMapList( + items=[], + next_page_token="def", + ), + compute.UrlMapList( + items=[ + compute.UrlMap(), + ], + next_page_token="ghi", + ), + compute.UrlMapList( + items=[ + compute.UrlMap(), + compute.UrlMap(), + ], + ), ) # Two responses for two calls response = response + response @@ -1993,10 +2141,17 @@ def test_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.PatchRegionUrlMapRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.PatchRegionUrlMapRequest, + dict, + ], +) def test_patch_unary_rest(request_type): client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2279,7 +2434,8 @@ def test_patch_unary_rest_required_fields( assert jsonified_request["urlMap"] == "url_map_value" client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2321,7 +2477,15 @@ def test_patch_unary_rest_unset_required_fields(): unset_fields = transport.patch._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "region", "urlMap", "urlMapResource",)) + set(("requestId",)) + & set( + ( + "project", + "region", + "urlMap", + "urlMapResource", + ) + ) ) @@ -2366,7 +2530,13 @@ def test_patch_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.patch_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2376,7 +2546,8 @@ def test_patch_unary_rest_bad_request( transport: str = "rest", request_type=compute.PatchRegionUrlMapRequest ): client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2566,7 +2737,8 @@ def test_patch_unary_rest_bad_request( def test_patch_unary_rest_flattened(): client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2615,7 +2787,8 @@ def test_patch_unary_rest_flattened(): def test_patch_unary_rest_flattened_error(transport: str = "rest"): client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2638,10 +2811,17 @@ def test_patch_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.UpdateRegionUrlMapRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.UpdateRegionUrlMapRequest, + dict, + ], +) def test_update_unary_rest(request_type): client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2924,7 +3104,8 @@ def test_update_unary_rest_required_fields( assert jsonified_request["urlMap"] == "url_map_value" client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2966,7 +3147,15 @@ def test_update_unary_rest_unset_required_fields(): unset_fields = transport.update._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "region", "urlMap", "urlMapResource",)) + set(("requestId",)) + & set( + ( + "project", + "region", + "urlMap", + "urlMapResource", + ) + ) ) @@ -3012,7 +3201,11 @@ def test_update_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.update_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3023,7 +3216,8 @@ def test_update_unary_rest_bad_request( transport: str = "rest", request_type=compute.UpdateRegionUrlMapRequest ): client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3213,7 +3407,8 @@ def test_update_unary_rest_bad_request( def test_update_unary_rest_flattened(): client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3262,7 +3457,8 @@ def test_update_unary_rest_flattened(): def test_update_unary_rest_flattened_error(transport: str = "rest"): client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3285,10 +3481,17 @@ def test_update_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ValidateRegionUrlMapRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ValidateRegionUrlMapRequest, + dict, + ], +) def test_validate_rest(request_type): client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3529,7 +3732,8 @@ def test_validate_rest_required_fields( assert jsonified_request["urlMap"] == "url_map_value" client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3572,7 +3776,14 @@ def test_validate_rest_unset_required_fields(): unset_fields = transport.validate._get_unset_required_fields({}) assert set(unset_fields) == ( set(()) - & set(("project", "region", "regionUrlMapsValidateRequestResource", "urlMap",)) + & set( + ( + "project", + "region", + "regionUrlMapsValidateRequestResource", + "urlMap", + ) + ) ) @@ -3619,7 +3830,13 @@ def test_validate_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.UrlMapsValidateResponse - client.validate(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.validate( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -3629,7 +3846,8 @@ def test_validate_rest_bad_request( transport: str = "rest", request_type=compute.ValidateRegionUrlMapRequest ): client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3824,7 +4042,8 @@ def test_validate_rest_bad_request( def test_validate_rest_flattened(): client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3873,7 +4092,8 @@ def test_validate_rest_flattened(): def test_validate_rest_flattened_error(transport: str = "rest"): client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3903,7 +4123,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -3923,7 +4144,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = RegionUrlMapsClient(client_options=options, transport=transport,) + client = RegionUrlMapsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -3939,7 +4163,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RegionUrlMapsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -3952,7 +4177,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.RegionUrlMapsRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.RegionUrlMapsRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -4009,7 +4239,8 @@ def test_region_url_maps_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.RegionUrlMapsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -4059,7 +4290,12 @@ def test_region_url_maps_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_region_url_maps_host_no_port(transport_name): client = RegionUrlMapsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4075,7 +4311,12 @@ def test_region_url_maps_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_region_url_maps_host_with_port(transport_name): client = RegionUrlMapsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4113,7 +4354,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = RegionUrlMapsClient.common_folder_path(folder) assert expected == actual @@ -4131,7 +4374,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = RegionUrlMapsClient.common_organization_path(organization) assert expected == actual @@ -4149,7 +4394,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = RegionUrlMapsClient.common_project_path(project) assert expected == actual @@ -4169,7 +4416,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = RegionUrlMapsClient.common_location_path(project, location) assert expected == actual @@ -4194,7 +4442,8 @@ def test_client_with_default_client_info(): transports.RegionUrlMapsTransport, "_prep_wrapped_messages" ) as prep: client = RegionUrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4203,7 +4452,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = RegionUrlMapsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4243,7 +4493,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(RegionUrlMapsClient, transports.RegionUrlMapsRestTransport),], + [ + (RegionUrlMapsClient, transports.RegionUrlMapsRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_regions.py b/tests/unit/gapic/compute_v1/test_regions.py index db30d7d96..945128a9a 100644 --- a/tests/unit/gapic/compute_v1/test_regions.py +++ b/tests/unit/gapic/compute_v1/test_regions.py @@ -82,7 +82,12 @@ def test__get_default_mtls_endpoint(): assert RegionsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class,transport_name", [(RegionsClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (RegionsClient, "rest"), + ], +) def test_regions_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -102,7 +107,10 @@ def test_regions_client_from_service_account_info(client_class, transport_name): @pytest.mark.parametrize( - "transport_class,transport_name", [(transports.RegionsRestTransport, "rest"),] + "transport_class,transport_name", + [ + (transports.RegionsRestTransport, "rest"), + ], ) def test_regions_client_service_account_always_use_jwt(transport_class, transport_name): with mock.patch.object( @@ -120,7 +128,12 @@ def test_regions_client_service_account_always_use_jwt(transport_class, transpor use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class,transport_name", [(RegionsClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (RegionsClient, "rest"), + ], +) def test_regions_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -159,7 +172,9 @@ def test_regions_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(RegionsClient, transports.RegionsRestTransport, "rest"),], + [ + (RegionsClient, transports.RegionsRestTransport, "rest"), + ], ) @mock.patch.object( RegionsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(RegionsClient) @@ -434,13 +449,17 @@ def test_regions_client_get_mtls_endpoint_and_cert_source(client_class): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(RegionsClient, transports.RegionsRestTransport, "rest"),], + [ + (RegionsClient, transports.RegionsRestTransport, "rest"), + ], ) def test_regions_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -458,7 +477,9 @@ def test_regions_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(RegionsClient, transports.RegionsRestTransport, "rest", None),], + [ + (RegionsClient, transports.RegionsRestTransport, "rest", None), + ], ) def test_regions_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -481,10 +502,17 @@ def test_regions_client_client_options_credentials_file( ) -@pytest.mark.parametrize("request_type", [compute.GetRegionRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetRegionRequest, + dict, + ], +) def test_get_rest(request_type): client = RegionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -564,7 +592,8 @@ def test_get_rest_required_fields(request_type=compute.GetRegionRequest): assert jsonified_request["region"] == "region_value" client = RegionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -604,7 +633,15 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("project", "region",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "project", + "region", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -646,7 +683,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Region - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -656,7 +699,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetRegionRequest ): client = RegionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -677,7 +721,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = RegionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -689,7 +734,10 @@ def test_get_rest_flattened(): sample_request = {"project": "sample1", "region": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", region="region_value",) + mock_args = dict( + project="project_value", + region="region_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -715,14 +763,17 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = RegionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get( - compute.GetRegionRequest(), project="project_value", region="region_value", + compute.GetRegionRequest(), + project="project_value", + region="region_value", ) @@ -732,10 +783,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListRegionsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListRegionsRequest, + dict, + ], +) def test_list_rest(request_type): client = RegionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -796,7 +854,13 @@ def test_list_rest_required_fields(request_type=compute.ListRegionsRequest): ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -805,7 +869,8 @@ def test_list_rest_required_fields(request_type=compute.ListRegionsRequest): assert jsonified_request["project"] == "project_value" client = RegionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -846,7 +911,15 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set(("project",)) ) @@ -890,7 +963,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.RegionList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -900,7 +979,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListRegionsRequest ): client = RegionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -921,7 +1001,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = RegionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -933,7 +1014,9 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -957,20 +1040,23 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = RegionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list( - compute.ListRegionsRequest(), project="project_value", + compute.ListRegionsRequest(), + project="project_value", ) def test_list_rest_pager(transport: str = "rest"): client = RegionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -980,12 +1066,29 @@ def test_list_rest_pager(transport: str = "rest"): # Set the response as a series of pages response = ( compute.RegionList( - items=[compute.Region(), compute.Region(), compute.Region(),], + items=[ + compute.Region(), + compute.Region(), + compute.Region(), + ], next_page_token="abc", ), - compute.RegionList(items=[], next_page_token="def",), - compute.RegionList(items=[compute.Region(),], next_page_token="ghi",), - compute.RegionList(items=[compute.Region(), compute.Region(),],), + compute.RegionList( + items=[], + next_page_token="def", + ), + compute.RegionList( + items=[ + compute.Region(), + ], + next_page_token="ghi", + ), + compute.RegionList( + items=[ + compute.Region(), + compute.Region(), + ], + ), ) # Two responses for two calls response = response + response @@ -1018,7 +1121,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RegionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1038,7 +1142,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = RegionsClient(client_options=options, transport=transport,) + client = RegionsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1054,7 +1161,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RegionsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1067,7 +1175,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.RegionsRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.RegionsRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -1119,7 +1232,8 @@ def test_regions_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.RegionsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1171,7 +1285,12 @@ def test_regions_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_regions_host_no_port(transport_name): client = RegionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1187,7 +1306,12 @@ def test_regions_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_regions_host_with_port(transport_name): client = RegionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1225,7 +1349,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = RegionsClient.common_folder_path(folder) assert expected == actual @@ -1243,7 +1369,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = RegionsClient.common_organization_path(organization) assert expected == actual @@ -1261,7 +1389,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = RegionsClient.common_project_path(project) assert expected == actual @@ -1281,7 +1411,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = RegionsClient.common_location_path(project, location) assert expected == actual @@ -1306,7 +1437,8 @@ def test_client_with_default_client_info(): transports.RegionsTransport, "_prep_wrapped_messages" ) as prep: client = RegionsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1315,7 +1447,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = RegionsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1354,7 +1487,10 @@ def test_client_ctx(): @pytest.mark.parametrize( - "client_class,transport_class", [(RegionsClient, transports.RegionsRestTransport),] + "client_class,transport_class", + [ + (RegionsClient, transports.RegionsRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_reservations.py b/tests/unit/gapic/compute_v1/test_reservations.py index a79497982..8d4c8b50a 100644 --- a/tests/unit/gapic/compute_v1/test_reservations.py +++ b/tests/unit/gapic/compute_v1/test_reservations.py @@ -85,7 +85,12 @@ def test__get_default_mtls_endpoint(): assert ReservationsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class,transport_name", [(ReservationsClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (ReservationsClient, "rest"), + ], +) def test_reservations_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -105,7 +110,10 @@ def test_reservations_client_from_service_account_info(client_class, transport_n @pytest.mark.parametrize( - "transport_class,transport_name", [(transports.ReservationsRestTransport, "rest"),] + "transport_class,transport_name", + [ + (transports.ReservationsRestTransport, "rest"), + ], ) def test_reservations_client_service_account_always_use_jwt( transport_class, transport_name @@ -125,7 +133,12 @@ def test_reservations_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class,transport_name", [(ReservationsClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (ReservationsClient, "rest"), + ], +) def test_reservations_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -164,7 +177,9 @@ def test_reservations_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(ReservationsClient, transports.ReservationsRestTransport, "rest"),], + [ + (ReservationsClient, transports.ReservationsRestTransport, "rest"), + ], ) @mock.patch.object( ReservationsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(ReservationsClient) @@ -441,13 +456,17 @@ def test_reservations_client_get_mtls_endpoint_and_cert_source(client_class): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(ReservationsClient, transports.ReservationsRestTransport, "rest"),], + [ + (ReservationsClient, transports.ReservationsRestTransport, "rest"), + ], ) def test_reservations_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -465,7 +484,9 @@ def test_reservations_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(ReservationsClient, transports.ReservationsRestTransport, "rest", None),], + [ + (ReservationsClient, transports.ReservationsRestTransport, "rest", None), + ], ) def test_reservations_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -489,11 +510,16 @@ def test_reservations_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.AggregatedListReservationsRequest, dict,] + "request_type", + [ + compute.AggregatedListReservationsRequest, + dict, + ], ) def test_aggregated_list_rest(request_type): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -574,7 +600,8 @@ def test_aggregated_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -673,7 +700,11 @@ def test_aggregated_list_rest_interceptors(null_interceptor): post.return_value = compute.ReservationAggregatedList client.aggregated_list( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -684,7 +715,8 @@ def test_aggregated_list_rest_bad_request( transport: str = "rest", request_type=compute.AggregatedListReservationsRequest ): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -705,7 +737,8 @@ def test_aggregated_list_rest_bad_request( def test_aggregated_list_rest_flattened(): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -717,7 +750,9 @@ def test_aggregated_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -743,20 +778,23 @@ def test_aggregated_list_rest_flattened(): def test_aggregated_list_rest_flattened_error(transport: str = "rest"): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.aggregated_list( - compute.AggregatedListReservationsRequest(), project="project_value", + compute.AggregatedListReservationsRequest(), + project="project_value", ) def test_aggregated_list_rest_pager(transport: str = "rest"): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -773,9 +811,15 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): }, next_page_token="abc", ), - compute.ReservationAggregatedList(items={}, next_page_token="def",), compute.ReservationAggregatedList( - items={"g": compute.ReservationsScopedList(),}, next_page_token="ghi", + items={}, + next_page_token="def", + ), + compute.ReservationAggregatedList( + items={ + "g": compute.ReservationsScopedList(), + }, + next_page_token="ghi", ), compute.ReservationAggregatedList( items={ @@ -820,10 +864,17 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.DeleteReservationRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteReservationRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -937,7 +988,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -978,7 +1030,14 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "reservation", "zone",)) + set(("requestId",)) + & set( + ( + "project", + "reservation", + "zone", + ) + ) ) @@ -1024,7 +1083,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1035,7 +1098,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteReservationRequest ): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1056,7 +1120,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1073,7 +1138,9 @@ def test_delete_unary_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", zone="zone_value", reservation="reservation_value", + project="project_value", + zone="zone_value", + reservation="reservation_value", ) mock_args.update(sample_request) @@ -1100,7 +1167,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1120,10 +1188,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetReservationRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetReservationRequest, + dict, + ], +) def test_get_rest(request_type): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1211,7 +1286,8 @@ def test_get_rest_required_fields(request_type=compute.GetReservationRequest): assert jsonified_request["zone"] == "zone_value" client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1251,7 +1327,16 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("project", "reservation", "zone",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "project", + "reservation", + "zone", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1295,7 +1380,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Reservation - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1305,7 +1396,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetReservationRequest ): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1326,7 +1418,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1343,7 +1436,9 @@ def test_get_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", zone="zone_value", reservation="reservation_value", + project="project_value", + zone="zone_value", + reservation="reservation_value", ) mock_args.update(sample_request) @@ -1370,7 +1465,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1391,11 +1487,16 @@ def test_get_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.GetIamPolicyReservationRequest, dict,] + "request_type", + [ + compute.GetIamPolicyReservationRequest, + dict, + ], ) def test_get_iam_policy_rest(request_type): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1405,7 +1506,11 @@ def test_get_iam_policy_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = compute.Policy(etag="etag_value", iam_owned=True, version=774,) + return_value = compute.Policy( + etag="etag_value", + iam_owned=True, + version=774, + ) # Wrap the value into a proper Response obj response_value = Response() @@ -1467,7 +1572,8 @@ def test_get_iam_policy_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1508,7 +1614,14 @@ def test_get_iam_policy_rest_unset_required_fields(): unset_fields = transport.get_iam_policy._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("optionsRequestedPolicyVersion",)) & set(("project", "resource", "zone",)) + set(("optionsRequestedPolicyVersion",)) + & set( + ( + "project", + "resource", + "zone", + ) + ) ) @@ -1554,7 +1667,11 @@ def test_get_iam_policy_rest_interceptors(null_interceptor): post.return_value = compute.Policy client.get_iam_policy( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1565,7 +1682,8 @@ def test_get_iam_policy_rest_bad_request( transport: str = "rest", request_type=compute.GetIamPolicyReservationRequest ): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1586,7 +1704,8 @@ def test_get_iam_policy_rest_bad_request( def test_get_iam_policy_rest_flattened(): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1603,7 +1722,9 @@ def test_get_iam_policy_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", zone="zone_value", resource="resource_value", + project="project_value", + zone="zone_value", + resource="resource_value", ) mock_args.update(sample_request) @@ -1630,7 +1751,8 @@ def test_get_iam_policy_rest_flattened(): def test_get_iam_policy_rest_flattened_error(transport: str = "rest"): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1650,10 +1772,17 @@ def test_get_iam_policy_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertReservationRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertReservationRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1793,7 +1922,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1835,7 +1965,14 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "reservationResource", "zone",)) + set(("requestId",)) + & set( + ( + "project", + "reservationResource", + "zone", + ) + ) ) @@ -1881,7 +2018,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1892,7 +2033,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertReservationRequest ): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1943,7 +2085,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1985,7 +2128,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2005,10 +2149,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListReservationsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListReservationsRequest, + dict, + ], +) def test_list_rest(request_type): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2071,7 +2222,13 @@ def test_list_rest_required_fields(request_type=compute.ListReservationsRequest) ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -2082,7 +2239,8 @@ def test_list_rest_required_fields(request_type=compute.ListReservationsRequest) assert jsonified_request["zone"] == "zone_value" client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2123,8 +2281,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "zone",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "zone", + ) + ) ) @@ -2171,7 +2342,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.ReservationList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2181,7 +2358,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListReservationsRequest ): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2202,7 +2380,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2214,7 +2393,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "zone": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", zone="zone_value",) + mock_args = dict( + project="project_value", + zone="zone_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2240,7 +2422,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2255,7 +2438,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2272,12 +2456,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.ReservationList(items=[], next_page_token="def",), compute.ReservationList( - items=[compute.Reservation(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.ReservationList( - items=[compute.Reservation(), compute.Reservation(),], + items=[ + compute.Reservation(), + ], + next_page_token="ghi", + ), + compute.ReservationList( + items=[ + compute.Reservation(), + compute.Reservation(), + ], ), ) # Two responses for two calls @@ -2304,10 +2497,17 @@ def test_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.ResizeReservationRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ResizeReservationRequest, + dict, + ], +) def test_resize_unary_rest(request_type): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2422,7 +2622,8 @@ def test_resize_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2465,7 +2666,14 @@ def test_resize_unary_rest_unset_required_fields(): unset_fields = transport.resize._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("project", "reservation", "reservationsResizeRequestResource", "zone",)) + & set( + ( + "project", + "reservation", + "reservationsResizeRequestResource", + "zone", + ) + ) ) @@ -2511,7 +2719,11 @@ def test_resize_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.resize_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2522,7 +2734,8 @@ def test_resize_unary_rest_bad_request( transport: str = "rest", request_type=compute.ResizeReservationRequest ): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2544,7 +2757,8 @@ def test_resize_unary_rest_bad_request( def test_resize_unary_rest_flattened(): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2593,7 +2807,8 @@ def test_resize_unary_rest_flattened(): def test_resize_unary_rest_flattened_error(transport: str = "rest"): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2617,11 +2832,16 @@ def test_resize_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SetIamPolicyReservationRequest, dict,] + "request_type", + [ + compute.SetIamPolicyReservationRequest, + dict, + ], ) def test_set_iam_policy_rest(request_type): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2708,7 +2928,11 @@ def test_set_iam_policy_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = compute.Policy(etag="etag_value", iam_owned=True, version=774,) + return_value = compute.Policy( + etag="etag_value", + iam_owned=True, + version=774, + ) # Wrap the value into a proper Response obj response_value = Response() @@ -2768,7 +2992,8 @@ def test_set_iam_policy_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2810,7 +3035,15 @@ def test_set_iam_policy_rest_unset_required_fields(): unset_fields = transport.set_iam_policy._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("project", "resource", "zone", "zoneSetPolicyRequestResource",)) + set(()) + & set( + ( + "project", + "resource", + "zone", + "zoneSetPolicyRequestResource", + ) + ) ) @@ -2856,7 +3089,11 @@ def test_set_iam_policy_rest_interceptors(null_interceptor): post.return_value = compute.Policy client.set_iam_policy( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2867,7 +3104,8 @@ def test_set_iam_policy_rest_bad_request( transport: str = "rest", request_type=compute.SetIamPolicyReservationRequest ): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2965,7 +3203,8 @@ def test_set_iam_policy_rest_bad_request( def test_set_iam_policy_rest_flattened(): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3014,7 +3253,8 @@ def test_set_iam_policy_rest_flattened(): def test_set_iam_policy_rest_flattened_error(transport: str = "rest"): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3038,11 +3278,16 @@ def test_set_iam_policy_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.TestIamPermissionsReservationRequest, dict,] + "request_type", + [ + compute.TestIamPermissionsReservationRequest, + dict, + ], ) def test_test_iam_permissions_rest(request_type): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3115,7 +3360,8 @@ def test_test_iam_permissions_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3158,7 +3404,14 @@ def test_test_iam_permissions_rest_unset_required_fields(): unset_fields = transport.test_iam_permissions._get_unset_required_fields({}) assert set(unset_fields) == ( set(()) - & set(("project", "resource", "testPermissionsRequestResource", "zone",)) + & set( + ( + "project", + "resource", + "testPermissionsRequestResource", + "zone", + ) + ) ) @@ -3206,7 +3459,11 @@ def test_test_iam_permissions_rest_interceptors(null_interceptor): post.return_value = compute.TestPermissionsResponse client.test_iam_permissions( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3217,7 +3474,8 @@ def test_test_iam_permissions_rest_bad_request( transport: str = "rest", request_type=compute.TestIamPermissionsReservationRequest ): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3241,7 +3499,8 @@ def test_test_iam_permissions_rest_bad_request( def test_test_iam_permissions_rest_flattened(): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3290,7 +3549,8 @@ def test_test_iam_permissions_rest_flattened(): def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3313,10 +3573,17 @@ def test_test_iam_permissions_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.UpdateReservationRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.UpdateReservationRequest, + dict, + ], +) def test_update_unary_rest(request_type): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3448,7 +3715,13 @@ def test_update_unary_rest_required_fields( credentials=ga_credentials.AnonymousCredentials() ).update._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("paths", "request_id", "update_mask",)) + assert not set(unset_fields) - set( + ( + "paths", + "request_id", + "update_mask", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -3460,7 +3733,8 @@ def test_update_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3502,8 +3776,21 @@ def test_update_unary_rest_unset_required_fields(): unset_fields = transport.update._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("paths", "requestId", "updateMask",)) - & set(("project", "reservation", "reservationResource", "zone",)) + set( + ( + "paths", + "requestId", + "updateMask", + ) + ) + & set( + ( + "project", + "reservation", + "reservationResource", + "zone", + ) + ) ) @@ -3549,7 +3836,11 @@ def test_update_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.update_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3560,7 +3851,8 @@ def test_update_unary_rest_bad_request( transport: str = "rest", request_type=compute.UpdateReservationRequest ): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3611,7 +3903,8 @@ def test_update_unary_rest_bad_request( def test_update_unary_rest_flattened(): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3658,7 +3951,8 @@ def test_update_unary_rest_flattened(): def test_update_unary_rest_flattened_error(transport: str = "rest"): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3686,7 +3980,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -3706,7 +4001,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = ReservationsClient(client_options=options, transport=transport,) + client = ReservationsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -3722,7 +4020,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ReservationsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -3735,7 +4034,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.ReservationsRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.ReservationsRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -3795,7 +4099,8 @@ def test_reservations_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ReservationsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -3845,7 +4150,12 @@ def test_reservations_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_reservations_host_no_port(transport_name): client = ReservationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3861,7 +4171,12 @@ def test_reservations_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_reservations_host_with_port(transport_name): client = ReservationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3899,7 +4214,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = ReservationsClient.common_folder_path(folder) assert expected == actual @@ -3917,7 +4234,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = ReservationsClient.common_organization_path(organization) assert expected == actual @@ -3935,7 +4254,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = ReservationsClient.common_project_path(project) assert expected == actual @@ -3955,7 +4276,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = ReservationsClient.common_location_path(project, location) assert expected == actual @@ -3980,7 +4302,8 @@ def test_client_with_default_client_info(): transports.ReservationsTransport, "_prep_wrapped_messages" ) as prep: client = ReservationsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3989,7 +4312,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ReservationsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4029,7 +4353,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(ReservationsClient, transports.ReservationsRestTransport),], + [ + (ReservationsClient, transports.ReservationsRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_resource_policies.py b/tests/unit/gapic/compute_v1/test_resource_policies.py index c6ecfd75c..8b628cd8a 100644 --- a/tests/unit/gapic/compute_v1/test_resource_policies.py +++ b/tests/unit/gapic/compute_v1/test_resource_policies.py @@ -90,7 +90,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(ResourcePoliciesClient, "rest"),] + "client_class,transport_name", + [ + (ResourcePoliciesClient, "rest"), + ], ) def test_resource_policies_client_from_service_account_info( client_class, transport_name @@ -114,7 +117,9 @@ def test_resource_policies_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.ResourcePoliciesRestTransport, "rest"),], + [ + (transports.ResourcePoliciesRestTransport, "rest"), + ], ) def test_resource_policies_client_service_account_always_use_jwt( transport_class, transport_name @@ -135,7 +140,10 @@ def test_resource_policies_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(ResourcePoliciesClient, "rest"),] + "client_class,transport_name", + [ + (ResourcePoliciesClient, "rest"), + ], ) def test_resource_policies_client_from_service_account_file( client_class, transport_name @@ -177,7 +185,9 @@ def test_resource_policies_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(ResourcePoliciesClient, transports.ResourcePoliciesRestTransport, "rest"),], + [ + (ResourcePoliciesClient, transports.ResourcePoliciesRestTransport, "rest"), + ], ) @mock.patch.object( ResourcePoliciesClient, @@ -470,13 +480,17 @@ def test_resource_policies_client_get_mtls_endpoint_and_cert_source(client_class @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(ResourcePoliciesClient, transports.ResourcePoliciesRestTransport, "rest"),], + [ + (ResourcePoliciesClient, transports.ResourcePoliciesRestTransport, "rest"), + ], ) def test_resource_policies_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -494,7 +508,14 @@ def test_resource_policies_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(ResourcePoliciesClient, transports.ResourcePoliciesRestTransport, "rest", None),], + [ + ( + ResourcePoliciesClient, + transports.ResourcePoliciesRestTransport, + "rest", + None, + ), + ], ) def test_resource_policies_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -518,11 +539,16 @@ def test_resource_policies_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.AggregatedListResourcePoliciesRequest, dict,] + "request_type", + [ + compute.AggregatedListResourcePoliciesRequest, + dict, + ], ) def test_aggregated_list_rest(request_type): client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -605,7 +631,8 @@ def test_aggregated_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -706,7 +733,11 @@ def test_aggregated_list_rest_interceptors(null_interceptor): post.return_value = compute.ResourcePolicyAggregatedList client.aggregated_list( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -717,7 +748,8 @@ def test_aggregated_list_rest_bad_request( transport: str = "rest", request_type=compute.AggregatedListResourcePoliciesRequest ): client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -738,7 +770,8 @@ def test_aggregated_list_rest_bad_request( def test_aggregated_list_rest_flattened(): client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -750,7 +783,9 @@ def test_aggregated_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -776,20 +811,23 @@ def test_aggregated_list_rest_flattened(): def test_aggregated_list_rest_flattened_error(transport: str = "rest"): client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.aggregated_list( - compute.AggregatedListResourcePoliciesRequest(), project="project_value", + compute.AggregatedListResourcePoliciesRequest(), + project="project_value", ) def test_aggregated_list_rest_pager(transport: str = "rest"): client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -806,9 +844,14 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): }, next_page_token="abc", ), - compute.ResourcePolicyAggregatedList(items={}, next_page_token="def",), compute.ResourcePolicyAggregatedList( - items={"g": compute.ResourcePoliciesScopedList(),}, + items={}, + next_page_token="def", + ), + compute.ResourcePolicyAggregatedList( + items={ + "g": compute.ResourcePoliciesScopedList(), + }, next_page_token="ghi", ), compute.ResourcePolicyAggregatedList( @@ -856,10 +899,17 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.DeleteResourcePolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteResourcePolicyRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -977,7 +1027,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["resourcePolicy"] == "resource_policy_value" client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1018,7 +1069,14 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "region", "resourcePolicy",)) + set(("requestId",)) + & set( + ( + "project", + "region", + "resourcePolicy", + ) + ) ) @@ -1064,7 +1122,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1075,7 +1137,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteResourcePolicyRequest ): client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1100,7 +1163,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1146,7 +1210,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1166,10 +1231,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetResourcePolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetResourcePolicyRequest, + dict, + ], +) def test_get_rest(request_type): client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1255,7 +1327,8 @@ def test_get_rest_required_fields(request_type=compute.GetResourcePolicyRequest) assert jsonified_request["resourcePolicy"] == "resource_policy_value" client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1296,7 +1369,14 @@ def test_get_rest_unset_required_fields(): unset_fields = transport.get._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("project", "region", "resourcePolicy",)) + set(()) + & set( + ( + "project", + "region", + "resourcePolicy", + ) + ) ) @@ -1343,7 +1423,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.ResourcePolicy - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1353,7 +1439,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetResourcePolicyRequest ): client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1378,7 +1465,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1424,7 +1512,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1445,11 +1534,16 @@ def test_get_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.GetIamPolicyResourcePolicyRequest, dict,] + "request_type", + [ + compute.GetIamPolicyResourcePolicyRequest, + dict, + ], ) def test_get_iam_policy_rest(request_type): client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1459,7 +1553,11 @@ def test_get_iam_policy_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = compute.Policy(etag="etag_value", iam_owned=True, version=774,) + return_value = compute.Policy( + etag="etag_value", + iam_owned=True, + version=774, + ) # Wrap the value into a proper Response obj response_value = Response() @@ -1521,7 +1619,8 @@ def test_get_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1563,7 +1662,13 @@ def test_get_iam_policy_rest_unset_required_fields(): unset_fields = transport.get_iam_policy._get_unset_required_fields({}) assert set(unset_fields) == ( set(("optionsRequestedPolicyVersion",)) - & set(("project", "region", "resource",)) + & set( + ( + "project", + "region", + "resource", + ) + ) ) @@ -1609,7 +1714,11 @@ def test_get_iam_policy_rest_interceptors(null_interceptor): post.return_value = compute.Policy client.get_iam_policy( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1620,7 +1729,8 @@ def test_get_iam_policy_rest_bad_request( transport: str = "rest", request_type=compute.GetIamPolicyResourcePolicyRequest ): client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1641,7 +1751,8 @@ def test_get_iam_policy_rest_bad_request( def test_get_iam_policy_rest_flattened(): client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1658,7 +1769,9 @@ def test_get_iam_policy_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", region="region_value", resource="resource_value", + project="project_value", + region="region_value", + resource="resource_value", ) mock_args.update(sample_request) @@ -1685,7 +1798,8 @@ def test_get_iam_policy_rest_flattened(): def test_get_iam_policy_rest_flattened_error(transport: str = "rest"): client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1705,10 +1819,17 @@ def test_get_iam_policy_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertResourcePolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertResourcePolicyRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1882,7 +2003,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1924,7 +2046,14 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "region", "resourcePolicyResource",)) + set(("requestId",)) + & set( + ( + "project", + "region", + "resourcePolicyResource", + ) + ) ) @@ -1970,7 +2099,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1981,7 +2114,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertResourcePolicyRequest ): client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2066,7 +2200,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2110,7 +2245,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2132,10 +2268,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListResourcePoliciesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListResourcePoliciesRequest, + dict, + ], +) def test_list_rest(request_type): client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2200,7 +2343,13 @@ def test_list_rest_required_fields(request_type=compute.ListResourcePoliciesRequ ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -2211,7 +2360,8 @@ def test_list_rest_required_fields(request_type=compute.ListResourcePoliciesRequ assert jsonified_request["region"] == "region_value" client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2252,8 +2402,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "region",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "region", + ) + ) ) @@ -2300,7 +2463,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.ResourcePolicyList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2310,7 +2479,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListResourcePoliciesRequest ): client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2331,7 +2501,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2343,7 +2514,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "region": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", region="region_value",) + mock_args = dict( + project="project_value", + region="region_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2369,7 +2543,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2384,7 +2559,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2401,12 +2577,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.ResourcePolicyList(items=[], next_page_token="def",), compute.ResourcePolicyList( - items=[compute.ResourcePolicy(),], next_page_token="ghi", + items=[], + next_page_token="def", + ), + compute.ResourcePolicyList( + items=[ + compute.ResourcePolicy(), + ], + next_page_token="ghi", ), compute.ResourcePolicyList( - items=[compute.ResourcePolicy(), compute.ResourcePolicy(),], + items=[ + compute.ResourcePolicy(), + compute.ResourcePolicy(), + ], ), ) # Two responses for two calls @@ -2434,11 +2619,16 @@ def test_list_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.SetIamPolicyResourcePolicyRequest, dict,] + "request_type", + [ + compute.SetIamPolicyResourcePolicyRequest, + dict, + ], ) def test_set_iam_policy_rest(request_type): client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2525,7 +2715,11 @@ def test_set_iam_policy_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = compute.Policy(etag="etag_value", iam_owned=True, version=774,) + return_value = compute.Policy( + etag="etag_value", + iam_owned=True, + version=774, + ) # Wrap the value into a proper Response obj response_value = Response() @@ -2585,7 +2779,8 @@ def test_set_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2628,7 +2823,14 @@ def test_set_iam_policy_rest_unset_required_fields(): unset_fields = transport.set_iam_policy._get_unset_required_fields({}) assert set(unset_fields) == ( set(()) - & set(("project", "region", "regionSetPolicyRequestResource", "resource",)) + & set( + ( + "project", + "region", + "regionSetPolicyRequestResource", + "resource", + ) + ) ) @@ -2674,7 +2876,11 @@ def test_set_iam_policy_rest_interceptors(null_interceptor): post.return_value = compute.Policy client.set_iam_policy( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2685,7 +2891,8 @@ def test_set_iam_policy_rest_bad_request( transport: str = "rest", request_type=compute.SetIamPolicyResourcePolicyRequest ): client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2783,7 +2990,8 @@ def test_set_iam_policy_rest_bad_request( def test_set_iam_policy_rest_flattened(): client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2832,7 +3040,8 @@ def test_set_iam_policy_rest_flattened(): def test_set_iam_policy_rest_flattened_error(transport: str = "rest"): client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2856,11 +3065,16 @@ def test_set_iam_policy_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.TestIamPermissionsResourcePolicyRequest, dict,] + "request_type", + [ + compute.TestIamPermissionsResourcePolicyRequest, + dict, + ], ) def test_test_iam_permissions_rest(request_type): client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2933,7 +3147,8 @@ def test_test_iam_permissions_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2976,7 +3191,14 @@ def test_test_iam_permissions_rest_unset_required_fields(): unset_fields = transport.test_iam_permissions._get_unset_required_fields({}) assert set(unset_fields) == ( set(()) - & set(("project", "region", "resource", "testPermissionsRequestResource",)) + & set( + ( + "project", + "region", + "resource", + "testPermissionsRequestResource", + ) + ) ) @@ -3024,7 +3246,11 @@ def test_test_iam_permissions_rest_interceptors(null_interceptor): post.return_value = compute.TestPermissionsResponse client.test_iam_permissions( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3036,7 +3262,8 @@ def test_test_iam_permissions_rest_bad_request( request_type=compute.TestIamPermissionsResourcePolicyRequest, ): client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3060,7 +3287,8 @@ def test_test_iam_permissions_rest_bad_request( def test_test_iam_permissions_rest_flattened(): client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3109,7 +3337,8 @@ def test_test_iam_permissions_rest_flattened(): def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3139,7 +3368,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -3159,7 +3389,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = ResourcePoliciesClient(client_options=options, transport=transport,) + client = ResourcePoliciesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -3175,7 +3408,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ResourcePoliciesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -3188,7 +3422,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.ResourcePoliciesRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.ResourcePoliciesRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -3246,7 +3485,8 @@ def test_resource_policies_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ResourcePoliciesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -3296,7 +3536,12 @@ def test_resource_policies_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_resource_policies_host_no_port(transport_name): client = ResourcePoliciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3312,7 +3557,12 @@ def test_resource_policies_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_resource_policies_host_with_port(transport_name): client = ResourcePoliciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3350,7 +3600,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = ResourcePoliciesClient.common_folder_path(folder) assert expected == actual @@ -3368,7 +3620,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = ResourcePoliciesClient.common_organization_path(organization) assert expected == actual @@ -3386,7 +3640,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = ResourcePoliciesClient.common_project_path(project) assert expected == actual @@ -3406,7 +3662,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = ResourcePoliciesClient.common_location_path(project, location) assert expected == actual @@ -3431,7 +3688,8 @@ def test_client_with_default_client_info(): transports.ResourcePoliciesTransport, "_prep_wrapped_messages" ) as prep: client = ResourcePoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3440,7 +3698,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ResourcePoliciesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3480,7 +3739,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(ResourcePoliciesClient, transports.ResourcePoliciesRestTransport),], + [ + (ResourcePoliciesClient, transports.ResourcePoliciesRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_routers.py b/tests/unit/gapic/compute_v1/test_routers.py index 8bc3ef170..d60d5e3d3 100644 --- a/tests/unit/gapic/compute_v1/test_routers.py +++ b/tests/unit/gapic/compute_v1/test_routers.py @@ -82,7 +82,12 @@ def test__get_default_mtls_endpoint(): assert RoutersClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class,transport_name", [(RoutersClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (RoutersClient, "rest"), + ], +) def test_routers_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -102,7 +107,10 @@ def test_routers_client_from_service_account_info(client_class, transport_name): @pytest.mark.parametrize( - "transport_class,transport_name", [(transports.RoutersRestTransport, "rest"),] + "transport_class,transport_name", + [ + (transports.RoutersRestTransport, "rest"), + ], ) def test_routers_client_service_account_always_use_jwt(transport_class, transport_name): with mock.patch.object( @@ -120,7 +128,12 @@ def test_routers_client_service_account_always_use_jwt(transport_class, transpor use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class,transport_name", [(RoutersClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (RoutersClient, "rest"), + ], +) def test_routers_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -159,7 +172,9 @@ def test_routers_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(RoutersClient, transports.RoutersRestTransport, "rest"),], + [ + (RoutersClient, transports.RoutersRestTransport, "rest"), + ], ) @mock.patch.object( RoutersClient, "DEFAULT_ENDPOINT", modify_default_endpoint(RoutersClient) @@ -434,13 +449,17 @@ def test_routers_client_get_mtls_endpoint_and_cert_source(client_class): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(RoutersClient, transports.RoutersRestTransport, "rest"),], + [ + (RoutersClient, transports.RoutersRestTransport, "rest"), + ], ) def test_routers_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -458,7 +477,9 @@ def test_routers_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(RoutersClient, transports.RoutersRestTransport, "rest", None),], + [ + (RoutersClient, transports.RoutersRestTransport, "rest", None), + ], ) def test_routers_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -481,10 +502,17 @@ def test_routers_client_client_options_credentials_file( ) -@pytest.mark.parametrize("request_type", [compute.AggregatedListRoutersRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.AggregatedListRoutersRequest, + dict, + ], +) def test_aggregated_list_rest(request_type): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -565,7 +593,8 @@ def test_aggregated_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -662,7 +691,11 @@ def test_aggregated_list_rest_interceptors(null_interceptor): post.return_value = compute.RouterAggregatedList client.aggregated_list( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -673,7 +706,8 @@ def test_aggregated_list_rest_bad_request( transport: str = "rest", request_type=compute.AggregatedListRoutersRequest ): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -694,7 +728,8 @@ def test_aggregated_list_rest_bad_request( def test_aggregated_list_rest_flattened(): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -706,7 +741,9 @@ def test_aggregated_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -732,20 +769,23 @@ def test_aggregated_list_rest_flattened(): def test_aggregated_list_rest_flattened_error(transport: str = "rest"): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.aggregated_list( - compute.AggregatedListRoutersRequest(), project="project_value", + compute.AggregatedListRoutersRequest(), + project="project_value", ) def test_aggregated_list_rest_pager(transport: str = "rest"): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -762,9 +802,15 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): }, next_page_token="abc", ), - compute.RouterAggregatedList(items={}, next_page_token="def",), compute.RouterAggregatedList( - items={"g": compute.RoutersScopedList(),}, next_page_token="ghi", + items={}, + next_page_token="def", + ), + compute.RouterAggregatedList( + items={ + "g": compute.RoutersScopedList(), + }, + next_page_token="ghi", ), compute.RouterAggregatedList( items={ @@ -806,10 +852,17 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.DeleteRouterRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteRouterRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -921,7 +974,8 @@ def test_delete_unary_rest_required_fields(request_type=compute.DeleteRouterRequ assert jsonified_request["router"] == "router_value" client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -962,7 +1016,14 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "region", "router",)) + set(("requestId",)) + & set( + ( + "project", + "region", + "router", + ) + ) ) @@ -1006,7 +1067,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1017,7 +1082,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteRouterRequest ): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1038,7 +1104,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1055,7 +1122,9 @@ def test_delete_unary_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", region="region_value", router="router_value", + project="project_value", + region="region_value", + router="router_value", ) mock_args.update(sample_request) @@ -1082,7 +1151,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1102,10 +1172,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetRouterRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetRouterRequest, + dict, + ], +) def test_get_rest(request_type): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1189,7 +1266,8 @@ def test_get_rest_required_fields(request_type=compute.GetRouterRequest): assert jsonified_request["router"] == "router_value" client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1229,7 +1307,16 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("project", "region", "router",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "project", + "region", + "router", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1271,7 +1358,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Router - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1281,7 +1374,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetRouterRequest ): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1302,7 +1396,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1319,7 +1414,9 @@ def test_get_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", region="region_value", router="router_value", + project="project_value", + region="region_value", + router="router_value", ) mock_args.update(sample_request) @@ -1346,7 +1443,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1367,11 +1465,16 @@ def test_get_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.GetNatMappingInfoRoutersRequest, dict,] + "request_type", + [ + compute.GetNatMappingInfoRoutersRequest, + dict, + ], ) def test_get_nat_mapping_info_rest(request_type): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1438,7 +1541,13 @@ def test_get_nat_mapping_info_rest_required_fields( ).get_nat_mapping_info._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1451,7 +1560,8 @@ def test_get_nat_mapping_info_rest_required_fields( assert jsonified_request["router"] == "router_value" client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1492,8 +1602,22 @@ def test_get_nat_mapping_info_rest_unset_required_fields(): unset_fields = transport.get_nat_mapping_info._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "region", "router",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "region", + "router", + ) + ) ) @@ -1539,7 +1663,11 @@ def test_get_nat_mapping_info_rest_interceptors(null_interceptor): post.return_value = compute.VmEndpointNatMappingsList client.get_nat_mapping_info( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1550,7 +1678,8 @@ def test_get_nat_mapping_info_rest_bad_request( transport: str = "rest", request_type=compute.GetNatMappingInfoRoutersRequest ): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1571,7 +1700,8 @@ def test_get_nat_mapping_info_rest_bad_request( def test_get_nat_mapping_info_rest_flattened(): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1588,7 +1718,9 @@ def test_get_nat_mapping_info_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", region="region_value", router="router_value", + project="project_value", + region="region_value", + router="router_value", ) mock_args.update(sample_request) @@ -1615,7 +1747,8 @@ def test_get_nat_mapping_info_rest_flattened(): def test_get_nat_mapping_info_rest_flattened_error(transport: str = "rest"): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1631,7 +1764,8 @@ def test_get_nat_mapping_info_rest_flattened_error(transport: str = "rest"): def test_get_nat_mapping_info_rest_pager(transport: str = "rest"): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1648,9 +1782,15 @@ def test_get_nat_mapping_info_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.VmEndpointNatMappingsList(result=[], next_page_token="def",), compute.VmEndpointNatMappingsList( - result=[compute.VmEndpointNatMappings(),], next_page_token="ghi", + result=[], + next_page_token="def", + ), + compute.VmEndpointNatMappingsList( + result=[ + compute.VmEndpointNatMappings(), + ], + next_page_token="ghi", ), compute.VmEndpointNatMappingsList( result=[ @@ -1687,10 +1827,17 @@ def test_get_nat_mapping_info_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.GetRouterStatusRouterRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetRouterStatusRouterRequest, + dict, + ], +) def test_get_router_status_rest(request_type): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1700,7 +1847,9 @@ def test_get_router_status_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = compute.RouterStatusResponse(kind="kind_value",) + return_value = compute.RouterStatusResponse( + kind="kind_value", + ) # Wrap the value into a proper Response obj response_value = Response() @@ -1758,7 +1907,8 @@ def test_get_router_status_rest_required_fields( assert jsonified_request["router"] == "router_value" client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1798,7 +1948,16 @@ def test_get_router_status_rest_unset_required_fields(): ) unset_fields = transport.get_router_status._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("project", "region", "router",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "project", + "region", + "router", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1843,7 +2002,11 @@ def test_get_router_status_rest_interceptors(null_interceptor): post.return_value = compute.RouterStatusResponse client.get_router_status( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1854,7 +2017,8 @@ def test_get_router_status_rest_bad_request( transport: str = "rest", request_type=compute.GetRouterStatusRouterRequest ): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1875,7 +2039,8 @@ def test_get_router_status_rest_bad_request( def test_get_router_status_rest_flattened(): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1892,7 +2057,9 @@ def test_get_router_status_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", region="region_value", router="router_value", + project="project_value", + region="region_value", + router="router_value", ) mock_args.update(sample_request) @@ -1919,7 +2086,8 @@ def test_get_router_status_rest_flattened(): def test_get_router_status_rest_flattened_error(transport: str = "rest"): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1939,10 +2107,17 @@ def test_get_router_status_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertRouterRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertRouterRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2162,7 +2337,8 @@ def test_insert_unary_rest_required_fields(request_type=compute.InsertRouterRequ assert jsonified_request["region"] == "region_value" client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2204,7 +2380,14 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "region", "routerResource",)) + set(("requestId",)) + & set( + ( + "project", + "region", + "routerResource", + ) + ) ) @@ -2248,7 +2431,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2259,7 +2446,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertRouterRequest ): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2392,7 +2580,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2436,7 +2625,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2458,10 +2648,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListRoutersRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListRoutersRequest, + dict, + ], +) def test_list_rest(request_type): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2524,7 +2721,13 @@ def test_list_rest_required_fields(request_type=compute.ListRoutersRequest): ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -2535,7 +2738,8 @@ def test_list_rest_required_fields(request_type=compute.ListRoutersRequest): assert jsonified_request["region"] == "region_value" client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2576,8 +2780,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "region",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "region", + ) + ) ) @@ -2620,7 +2837,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.RouterList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2630,7 +2853,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListRoutersRequest ): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2651,7 +2875,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2663,7 +2888,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "region": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", region="region_value",) + mock_args = dict( + project="project_value", + region="region_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2689,7 +2917,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2704,7 +2933,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2714,12 +2944,29 @@ def test_list_rest_pager(transport: str = "rest"): # Set the response as a series of pages response = ( compute.RouterList( - items=[compute.Router(), compute.Router(), compute.Router(),], + items=[ + compute.Router(), + compute.Router(), + compute.Router(), + ], next_page_token="abc", ), - compute.RouterList(items=[], next_page_token="def",), - compute.RouterList(items=[compute.Router(),], next_page_token="ghi",), - compute.RouterList(items=[compute.Router(), compute.Router(),],), + compute.RouterList( + items=[], + next_page_token="def", + ), + compute.RouterList( + items=[ + compute.Router(), + ], + next_page_token="ghi", + ), + compute.RouterList( + items=[ + compute.Router(), + compute.Router(), + ], + ), ) # Two responses for two calls response = response + response @@ -2745,10 +2992,17 @@ def test_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.PatchRouterRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.PatchRouterRequest, + dict, + ], +) def test_patch_unary_rest(request_type): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2972,7 +3226,8 @@ def test_patch_unary_rest_required_fields(request_type=compute.PatchRouterReques assert jsonified_request["router"] == "router_value" client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3014,7 +3269,15 @@ def test_patch_unary_rest_unset_required_fields(): unset_fields = transport.patch._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "region", "router", "routerResource",)) + set(("requestId",)) + & set( + ( + "project", + "region", + "router", + "routerResource", + ) + ) ) @@ -3057,7 +3320,13 @@ def test_patch_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.patch_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -3067,7 +3336,8 @@ def test_patch_unary_rest_bad_request( transport: str = "rest", request_type=compute.PatchRouterRequest ): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3200,7 +3470,8 @@ def test_patch_unary_rest_bad_request( def test_patch_unary_rest_flattened(): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3249,7 +3520,8 @@ def test_patch_unary_rest_flattened(): def test_patch_unary_rest_flattened_error(transport: str = "rest"): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3272,10 +3544,17 @@ def test_patch_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.PreviewRouterRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.PreviewRouterRequest, + dict, + ], +) def test_preview_rest(request_type): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3452,7 +3731,8 @@ def test_preview_rest_required_fields(request_type=compute.PreviewRouterRequest) assert jsonified_request["router"] == "router_value" client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3494,7 +3774,15 @@ def test_preview_rest_unset_required_fields(): unset_fields = transport.preview._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("project", "region", "router", "routerResource",)) + set(()) + & set( + ( + "project", + "region", + "router", + "routerResource", + ) + ) ) @@ -3539,7 +3827,13 @@ def test_preview_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.RoutersPreviewResponse - client.preview(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.preview( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -3549,7 +3843,8 @@ def test_preview_rest_bad_request( transport: str = "rest", request_type=compute.PreviewRouterRequest ): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3682,7 +3977,8 @@ def test_preview_rest_bad_request( def test_preview_rest_flattened(): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3731,7 +4027,8 @@ def test_preview_rest_flattened(): def test_preview_rest_flattened_error(transport: str = "rest"): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3754,10 +4051,17 @@ def test_preview_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.UpdateRouterRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.UpdateRouterRequest, + dict, + ], +) def test_update_unary_rest(request_type): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3981,7 +4285,8 @@ def test_update_unary_rest_required_fields(request_type=compute.UpdateRouterRequ assert jsonified_request["router"] == "router_value" client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -4023,7 +4328,15 @@ def test_update_unary_rest_unset_required_fields(): unset_fields = transport.update._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "region", "router", "routerResource",)) + set(("requestId",)) + & set( + ( + "project", + "region", + "router", + "routerResource", + ) + ) ) @@ -4067,7 +4380,11 @@ def test_update_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.update_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -4078,7 +4395,8 @@ def test_update_unary_rest_bad_request( transport: str = "rest", request_type=compute.UpdateRouterRequest ): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -4211,7 +4529,8 @@ def test_update_unary_rest_bad_request( def test_update_unary_rest_flattened(): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -4260,7 +4579,8 @@ def test_update_unary_rest_flattened(): def test_update_unary_rest_flattened_error(transport: str = "rest"): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -4290,7 +4610,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -4310,7 +4631,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = RoutersClient(client_options=options, transport=transport,) + client = RoutersClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -4326,7 +4650,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RoutersClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -4339,7 +4664,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.RoutersRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.RoutersRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -4399,7 +4729,8 @@ def test_routers_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.RoutersTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -4449,7 +4780,12 @@ def test_routers_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_routers_host_no_port(transport_name): client = RoutersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4465,7 +4801,12 @@ def test_routers_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_routers_host_with_port(transport_name): client = RoutersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4503,7 +4844,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = RoutersClient.common_folder_path(folder) assert expected == actual @@ -4521,7 +4864,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = RoutersClient.common_organization_path(organization) assert expected == actual @@ -4539,7 +4884,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = RoutersClient.common_project_path(project) assert expected == actual @@ -4559,7 +4906,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = RoutersClient.common_location_path(project, location) assert expected == actual @@ -4584,7 +4932,8 @@ def test_client_with_default_client_info(): transports.RoutersTransport, "_prep_wrapped_messages" ) as prep: client = RoutersClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4593,7 +4942,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = RoutersClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4632,7 +4982,10 @@ def test_client_ctx(): @pytest.mark.parametrize( - "client_class,transport_class", [(RoutersClient, transports.RoutersRestTransport),] + "client_class,transport_class", + [ + (RoutersClient, transports.RoutersRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_routes.py b/tests/unit/gapic/compute_v1/test_routes.py index 22210cb50..6cbcb8a05 100644 --- a/tests/unit/gapic/compute_v1/test_routes.py +++ b/tests/unit/gapic/compute_v1/test_routes.py @@ -82,7 +82,12 @@ def test__get_default_mtls_endpoint(): assert RoutesClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class,transport_name", [(RoutesClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (RoutesClient, "rest"), + ], +) def test_routes_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -102,7 +107,10 @@ def test_routes_client_from_service_account_info(client_class, transport_name): @pytest.mark.parametrize( - "transport_class,transport_name", [(transports.RoutesRestTransport, "rest"),] + "transport_class,transport_name", + [ + (transports.RoutesRestTransport, "rest"), + ], ) def test_routes_client_service_account_always_use_jwt(transport_class, transport_name): with mock.patch.object( @@ -120,7 +128,12 @@ def test_routes_client_service_account_always_use_jwt(transport_class, transport use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class,transport_name", [(RoutesClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (RoutesClient, "rest"), + ], +) def test_routes_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -159,7 +172,9 @@ def test_routes_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(RoutesClient, transports.RoutesRestTransport, "rest"),], + [ + (RoutesClient, transports.RoutesRestTransport, "rest"), + ], ) @mock.patch.object( RoutesClient, "DEFAULT_ENDPOINT", modify_default_endpoint(RoutesClient) @@ -434,13 +449,17 @@ def test_routes_client_get_mtls_endpoint_and_cert_source(client_class): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(RoutesClient, transports.RoutesRestTransport, "rest"),], + [ + (RoutesClient, transports.RoutesRestTransport, "rest"), + ], ) def test_routes_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -458,7 +477,9 @@ def test_routes_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(RoutesClient, transports.RoutesRestTransport, "rest", None),], + [ + (RoutesClient, transports.RoutesRestTransport, "rest", None), + ], ) def test_routes_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -481,10 +502,17 @@ def test_routes_client_client_options_credentials_file( ) -@pytest.mark.parametrize("request_type", [compute.DeleteRouteRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteRouteRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = RoutesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -592,7 +620,8 @@ def test_delete_unary_rest_required_fields(request_type=compute.DeleteRouteReque assert jsonified_request["route"] == "route_value" client = RoutesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -632,7 +661,15 @@ def test_delete_unary_rest_unset_required_fields(): ) unset_fields = transport.delete._get_unset_required_fields({}) - assert set(unset_fields) == (set(("requestId",)) & set(("project", "route",))) + assert set(unset_fields) == ( + set(("requestId",)) + & set( + ( + "project", + "route", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -675,7 +712,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -686,7 +727,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteRouteRequest ): client = RoutesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -707,7 +749,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = RoutesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -719,7 +762,10 @@ def test_delete_unary_rest_flattened(): sample_request = {"project": "sample1", "route": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", route="route_value",) + mock_args = dict( + project="project_value", + route="route_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -745,14 +791,17 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = RoutesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_unary( - compute.DeleteRouteRequest(), project="project_value", route="route_value", + compute.DeleteRouteRequest(), + project="project_value", + route="route_value", ) @@ -762,10 +811,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetRouteRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetRouteRequest, + dict, + ], +) def test_get_rest(request_type): client = RoutesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -863,7 +919,8 @@ def test_get_rest_required_fields(request_type=compute.GetRouteRequest): assert jsonified_request["route"] == "route_value" client = RoutesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -903,7 +960,15 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("project", "route",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "project", + "route", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -945,7 +1010,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Route - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -955,7 +1026,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetRouteRequest ): client = RoutesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -976,7 +1048,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = RoutesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -988,7 +1061,10 @@ def test_get_rest_flattened(): sample_request = {"project": "sample1", "route": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", route="route_value",) + mock_args = dict( + project="project_value", + route="route_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1014,14 +1090,17 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = RoutesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get( - compute.GetRouteRequest(), project="project_value", route="route_value", + compute.GetRouteRequest(), + project="project_value", + route="route_value", ) @@ -1031,10 +1110,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertRouteRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertRouteRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = RoutesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1168,7 +1254,8 @@ def test_insert_unary_rest_required_fields(request_type=compute.InsertRouteReque assert jsonified_request["project"] == "project_value" client = RoutesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1210,7 +1297,13 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "routeResource",)) + set(("requestId",)) + & set( + ( + "project", + "routeResource", + ) + ) ) @@ -1254,7 +1347,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1265,7 +1362,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertRouteRequest ): client = RoutesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1316,7 +1414,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = RoutesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1358,7 +1457,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = RoutesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1379,10 +1479,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListRoutesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListRoutesRequest, + dict, + ], +) def test_list_rest(request_type): client = RoutesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1443,7 +1550,13 @@ def test_list_rest_required_fields(request_type=compute.ListRoutesRequest): ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1452,7 +1565,8 @@ def test_list_rest_required_fields(request_type=compute.ListRoutesRequest): assert jsonified_request["project"] == "project_value" client = RoutesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1493,7 +1607,15 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set(("project",)) ) @@ -1537,7 +1659,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.RouteList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1547,7 +1675,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListRoutesRequest ): client = RoutesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1568,7 +1697,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = RoutesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1580,7 +1710,9 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1605,20 +1737,23 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = RoutesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list( - compute.ListRoutesRequest(), project="project_value", + compute.ListRoutesRequest(), + project="project_value", ) def test_list_rest_pager(transport: str = "rest"): client = RoutesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1628,12 +1763,29 @@ def test_list_rest_pager(transport: str = "rest"): # Set the response as a series of pages response = ( compute.RouteList( - items=[compute.Route(), compute.Route(), compute.Route(),], + items=[ + compute.Route(), + compute.Route(), + compute.Route(), + ], next_page_token="abc", ), - compute.RouteList(items=[], next_page_token="def",), - compute.RouteList(items=[compute.Route(),], next_page_token="ghi",), - compute.RouteList(items=[compute.Route(), compute.Route(),],), + compute.RouteList( + items=[], + next_page_token="def", + ), + compute.RouteList( + items=[ + compute.Route(), + ], + next_page_token="ghi", + ), + compute.RouteList( + items=[ + compute.Route(), + compute.Route(), + ], + ), ) # Two responses for two calls response = response + response @@ -1666,7 +1818,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RoutesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1686,7 +1839,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = RoutesClient(client_options=options, transport=transport,) + client = RoutesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1702,7 +1858,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = RoutesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1715,7 +1872,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.RoutesRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.RoutesRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -1769,7 +1931,8 @@ def test_routes_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.RoutesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1819,7 +1982,12 @@ def test_routes_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_routes_host_no_port(transport_name): client = RoutesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1835,7 +2003,12 @@ def test_routes_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_routes_host_with_port(transport_name): client = RoutesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1873,7 +2046,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = RoutesClient.common_folder_path(folder) assert expected == actual @@ -1891,7 +2066,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = RoutesClient.common_organization_path(organization) assert expected == actual @@ -1909,7 +2086,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = RoutesClient.common_project_path(project) assert expected == actual @@ -1929,7 +2108,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = RoutesClient.common_location_path(project, location) assert expected == actual @@ -1954,7 +2134,8 @@ def test_client_with_default_client_info(): transports.RoutesTransport, "_prep_wrapped_messages" ) as prep: client = RoutesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1963,7 +2144,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = RoutesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2002,7 +2184,10 @@ def test_client_ctx(): @pytest.mark.parametrize( - "client_class,transport_class", [(RoutesClient, transports.RoutesRestTransport),] + "client_class,transport_class", + [ + (RoutesClient, transports.RoutesRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_security_policies.py b/tests/unit/gapic/compute_v1/test_security_policies.py index be250ce06..8ea4e1365 100644 --- a/tests/unit/gapic/compute_v1/test_security_policies.py +++ b/tests/unit/gapic/compute_v1/test_security_policies.py @@ -90,7 +90,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(SecurityPoliciesClient, "rest"),] + "client_class,transport_name", + [ + (SecurityPoliciesClient, "rest"), + ], ) def test_security_policies_client_from_service_account_info( client_class, transport_name @@ -114,7 +117,9 @@ def test_security_policies_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.SecurityPoliciesRestTransport, "rest"),], + [ + (transports.SecurityPoliciesRestTransport, "rest"), + ], ) def test_security_policies_client_service_account_always_use_jwt( transport_class, transport_name @@ -135,7 +140,10 @@ def test_security_policies_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(SecurityPoliciesClient, "rest"),] + "client_class,transport_name", + [ + (SecurityPoliciesClient, "rest"), + ], ) def test_security_policies_client_from_service_account_file( client_class, transport_name @@ -177,7 +185,9 @@ def test_security_policies_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(SecurityPoliciesClient, transports.SecurityPoliciesRestTransport, "rest"),], + [ + (SecurityPoliciesClient, transports.SecurityPoliciesRestTransport, "rest"), + ], ) @mock.patch.object( SecurityPoliciesClient, @@ -470,13 +480,17 @@ def test_security_policies_client_get_mtls_endpoint_and_cert_source(client_class @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(SecurityPoliciesClient, transports.SecurityPoliciesRestTransport, "rest"),], + [ + (SecurityPoliciesClient, transports.SecurityPoliciesRestTransport, "rest"), + ], ) def test_security_policies_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -494,7 +508,14 @@ def test_security_policies_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(SecurityPoliciesClient, transports.SecurityPoliciesRestTransport, "rest", None),], + [ + ( + SecurityPoliciesClient, + transports.SecurityPoliciesRestTransport, + "rest", + None, + ), + ], ) def test_security_policies_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -517,10 +538,17 @@ def test_security_policies_client_client_options_credentials_file( ) -@pytest.mark.parametrize("request_type", [compute.AddRuleSecurityPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.AddRuleSecurityPolicyRequest, + dict, + ], +) def test_add_rule_unary_rest(request_type): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -669,7 +697,8 @@ def test_add_rule_unary_rest_required_fields( assert jsonified_request["securityPolicy"] == "security_policy_value" client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -711,7 +740,14 @@ def test_add_rule_unary_rest_unset_required_fields(): unset_fields = transport.add_rule._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("project", "securityPolicy", "securityPolicyRuleResource",)) + set(()) + & set( + ( + "project", + "securityPolicy", + "securityPolicyRuleResource", + ) + ) ) @@ -757,7 +793,11 @@ def test_add_rule_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.add_rule_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -768,7 +808,8 @@ def test_add_rule_unary_rest_bad_request( transport: str = "rest", request_type=compute.AddRuleSecurityPolicyRequest ): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -830,7 +871,8 @@ def test_add_rule_unary_rest_bad_request( def test_add_rule_unary_rest_flattened(): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -874,7 +916,8 @@ def test_add_rule_unary_rest_flattened(): def test_add_rule_unary_rest_flattened_error(transport: str = "rest"): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -896,10 +939,17 @@ def test_add_rule_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.DeleteSecurityPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteSecurityPolicyRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1009,7 +1059,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["securityPolicy"] == "security_policy_value" client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1050,7 +1101,13 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "securityPolicy",)) + set(("requestId",)) + & set( + ( + "project", + "securityPolicy", + ) + ) ) @@ -1096,7 +1153,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1107,7 +1168,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteSecurityPolicyRequest ): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1128,7 +1190,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1141,7 +1204,8 @@ def test_delete_unary_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", security_policy="security_policy_value", + project="project_value", + security_policy="security_policy_value", ) mock_args.update(sample_request) @@ -1168,7 +1232,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1187,10 +1252,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetSecurityPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetSecurityPolicyRequest, + dict, + ], +) def test_get_rest(request_type): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1268,7 +1340,8 @@ def test_get_rest_required_fields(request_type=compute.GetSecurityPolicyRequest) assert jsonified_request["securityPolicy"] == "security_policy_value" client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1308,7 +1381,15 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("project", "securityPolicy",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "project", + "securityPolicy", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1354,7 +1435,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.SecurityPolicy - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1364,7 +1451,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetSecurityPolicyRequest ): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1385,7 +1473,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1398,7 +1487,8 @@ def test_get_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", security_policy="security_policy_value", + project="project_value", + security_policy="security_policy_value", ) mock_args.update(sample_request) @@ -1425,7 +1515,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1444,10 +1535,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetRuleSecurityPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetRuleSecurityPolicyRequest, + dict, + ], +) def test_get_rule_rest(request_type): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1523,7 +1621,8 @@ def test_get_rule_rest_required_fields( assert jsonified_request["securityPolicy"] == "security_policy_value" client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1564,7 +1663,13 @@ def test_get_rule_rest_unset_required_fields(): unset_fields = transport.get_rule._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("priority",)) & set(("project", "securityPolicy",)) + set(("priority",)) + & set( + ( + "project", + "securityPolicy", + ) + ) ) @@ -1611,7 +1716,13 @@ def test_get_rule_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.SecurityPolicyRule - client.get_rule(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get_rule( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1621,7 +1732,8 @@ def test_get_rule_rest_bad_request( transport: str = "rest", request_type=compute.GetRuleSecurityPolicyRequest ): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1642,7 +1754,8 @@ def test_get_rule_rest_bad_request( def test_get_rule_rest_flattened(): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1655,7 +1768,8 @@ def test_get_rule_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", security_policy="security_policy_value", + project="project_value", + security_policy="security_policy_value", ) mock_args.update(sample_request) @@ -1682,7 +1796,8 @@ def test_get_rule_rest_flattened(): def test_get_rule_rest_flattened_error(transport: str = "rest"): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1701,10 +1816,17 @@ def test_get_rule_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertSecurityPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertSecurityPolicyRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1877,7 +1999,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1919,7 +2042,13 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "securityPolicyResource",)) + set(("requestId",)) + & set( + ( + "project", + "securityPolicyResource", + ) + ) ) @@ -1965,7 +2094,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1976,7 +2109,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertSecurityPolicyRequest ): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2064,7 +2198,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2111,7 +2246,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2136,10 +2272,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListSecurityPoliciesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListSecurityPoliciesRequest, + dict, + ], +) def test_list_rest(request_type): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2150,7 +2293,9 @@ def test_list_rest(request_type): with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. return_value = compute.SecurityPolicyList( - id="id_value", kind="kind_value", next_page_token="next_page_token_value", + id="id_value", + kind="kind_value", + next_page_token="next_page_token_value", ) # Wrap the value into a proper Response obj @@ -2196,7 +2341,13 @@ def test_list_rest_required_fields(request_type=compute.ListSecurityPoliciesRequ ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -2205,7 +2356,8 @@ def test_list_rest_required_fields(request_type=compute.ListSecurityPoliciesRequ assert jsonified_request["project"] == "project_value" client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2246,7 +2398,15 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set(("project",)) ) @@ -2294,7 +2454,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.SecurityPolicyList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2304,7 +2470,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListSecurityPoliciesRequest ): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2325,7 +2492,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2337,7 +2505,9 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2363,20 +2533,23 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list( - compute.ListSecurityPoliciesRequest(), project="project_value", + compute.ListSecurityPoliciesRequest(), + project="project_value", ) def test_list_rest_pager(transport: str = "rest"): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2393,12 +2566,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.SecurityPolicyList(items=[], next_page_token="def",), compute.SecurityPolicyList( - items=[compute.SecurityPolicy(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.SecurityPolicyList( - items=[compute.SecurityPolicy(), compute.SecurityPolicy(),], + items=[ + compute.SecurityPolicy(), + ], + next_page_token="ghi", + ), + compute.SecurityPolicyList( + items=[ + compute.SecurityPolicy(), + compute.SecurityPolicy(), + ], ), ) # Two responses for two calls @@ -2427,11 +2609,15 @@ def test_list_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( "request_type", - [compute.ListPreconfiguredExpressionSetsSecurityPoliciesRequest, dict,], + [ + compute.ListPreconfiguredExpressionSetsSecurityPoliciesRequest, + dict, + ], ) def test_list_preconfigured_expression_sets_rest(request_type): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2446,8 +2632,10 @@ def test_list_preconfigured_expression_sets_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = compute.SecurityPoliciesListPreconfiguredExpressionSetsResponse.to_json( - return_value + json_return_value = ( + compute.SecurityPoliciesListPreconfiguredExpressionSetsResponse.to_json( + return_value + ) ) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -2489,7 +2677,13 @@ def test_list_preconfigured_expression_sets_rest_required_fields( ).list_preconfigured_expression_sets._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -2498,7 +2692,8 @@ def test_list_preconfigured_expression_sets_rest_required_fields( assert jsonified_request["project"] == "project_value" client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2521,8 +2716,10 @@ def test_list_preconfigured_expression_sets_rest_required_fields( response_value = Response() response_value.status_code = 200 - json_return_value = compute.SecurityPoliciesListPreconfiguredExpressionSetsResponse.to_json( - return_value + json_return_value = ( + compute.SecurityPoliciesListPreconfiguredExpressionSetsResponse.to_json( + return_value + ) ) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -2539,11 +2736,19 @@ def test_list_preconfigured_expression_sets_rest_unset_required_fields(): credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.list_preconfigured_expression_sets._get_unset_required_fields( - {} + unset_fields = ( + transport.list_preconfigured_expression_sets._get_unset_required_fields({}) ) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set(("project",)) ) @@ -2581,8 +2786,10 @@ def test_list_preconfigured_expression_sets_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = compute.SecurityPoliciesListPreconfiguredExpressionSetsResponse.to_json( - compute.SecurityPoliciesListPreconfiguredExpressionSetsResponse() + req.return_value._content = ( + compute.SecurityPoliciesListPreconfiguredExpressionSetsResponse.to_json( + compute.SecurityPoliciesListPreconfiguredExpressionSetsResponse() + ) ) request = compute.ListPreconfiguredExpressionSetsSecurityPoliciesRequest() @@ -2596,7 +2803,11 @@ def test_list_preconfigured_expression_sets_rest_interceptors(null_interceptor): ) client.list_preconfigured_expression_sets( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2608,7 +2819,8 @@ def test_list_preconfigured_expression_sets_rest_bad_request( request_type=compute.ListPreconfiguredExpressionSetsSecurityPoliciesRequest, ): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2629,7 +2841,8 @@ def test_list_preconfigured_expression_sets_rest_bad_request( def test_list_preconfigured_expression_sets_rest_flattened(): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2641,14 +2854,18 @@ def test_list_preconfigured_expression_sets_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = compute.SecurityPoliciesListPreconfiguredExpressionSetsResponse.to_json( - return_value + json_return_value = ( + compute.SecurityPoliciesListPreconfiguredExpressionSetsResponse.to_json( + return_value + ) ) response_value._content = json_return_value.encode("UTF-8") @@ -2671,7 +2888,8 @@ def test_list_preconfigured_expression_sets_rest_flattened_error( transport: str = "rest", ): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2689,10 +2907,17 @@ def test_list_preconfigured_expression_sets_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.PatchSecurityPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.PatchSecurityPolicyRequest, + dict, + ], +) def test_patch_unary_rest(request_type): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2869,7 +3094,8 @@ def test_patch_unary_rest_required_fields( assert jsonified_request["securityPolicy"] == "security_policy_value" client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2912,7 +3138,13 @@ def test_patch_unary_rest_unset_required_fields(): unset_fields = transport.patch._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("project", "securityPolicy", "securityPolicyResource",)) + & set( + ( + "project", + "securityPolicy", + "securityPolicyResource", + ) + ) ) @@ -2957,7 +3189,13 @@ def test_patch_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.patch_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2967,7 +3205,8 @@ def test_patch_unary_rest_bad_request( transport: str = "rest", request_type=compute.PatchSecurityPolicyRequest ): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3055,7 +3294,8 @@ def test_patch_unary_rest_bad_request( def test_patch_unary_rest_flattened(): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3103,7 +3343,8 @@ def test_patch_unary_rest_flattened(): def test_patch_unary_rest_flattened_error(transport: str = "rest"): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3130,11 +3371,16 @@ def test_patch_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.PatchRuleSecurityPolicyRequest, dict,] + "request_type", + [ + compute.PatchRuleSecurityPolicyRequest, + dict, + ], ) def test_patch_rule_unary_rest(request_type): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3285,7 +3531,8 @@ def test_patch_rule_unary_rest_required_fields( assert jsonified_request["securityPolicy"] == "security_policy_value" client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3328,7 +3575,13 @@ def test_patch_rule_unary_rest_unset_required_fields(): unset_fields = transport.patch_rule._get_unset_required_fields({}) assert set(unset_fields) == ( set(("priority",)) - & set(("project", "securityPolicy", "securityPolicyRuleResource",)) + & set( + ( + "project", + "securityPolicy", + "securityPolicyRuleResource", + ) + ) ) @@ -3374,7 +3627,11 @@ def test_patch_rule_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.patch_rule_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3385,7 +3642,8 @@ def test_patch_rule_unary_rest_bad_request( transport: str = "rest", request_type=compute.PatchRuleSecurityPolicyRequest ): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3447,7 +3705,8 @@ def test_patch_rule_unary_rest_bad_request( def test_patch_rule_unary_rest_flattened(): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3491,7 +3750,8 @@ def test_patch_rule_unary_rest_flattened(): def test_patch_rule_unary_rest_flattened_error(transport: str = "rest"): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3514,11 +3774,16 @@ def test_patch_rule_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.RemoveRuleSecurityPolicyRequest, dict,] + "request_type", + [ + compute.RemoveRuleSecurityPolicyRequest, + dict, + ], ) def test_remove_rule_unary_rest(request_type): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3628,7 +3893,8 @@ def test_remove_rule_unary_rest_required_fields( assert jsonified_request["securityPolicy"] == "security_policy_value" client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3669,7 +3935,13 @@ def test_remove_rule_unary_rest_unset_required_fields(): unset_fields = transport.remove_rule._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("priority",)) & set(("project", "securityPolicy",)) + set(("priority",)) + & set( + ( + "project", + "securityPolicy", + ) + ) ) @@ -3715,7 +3987,11 @@ def test_remove_rule_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.remove_rule_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3726,7 +4002,8 @@ def test_remove_rule_unary_rest_bad_request( transport: str = "rest", request_type=compute.RemoveRuleSecurityPolicyRequest ): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3747,7 +4024,8 @@ def test_remove_rule_unary_rest_bad_request( def test_remove_rule_unary_rest_flattened(): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3760,7 +4038,8 @@ def test_remove_rule_unary_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", security_policy="security_policy_value", + project="project_value", + security_policy="security_policy_value", ) mock_args.update(sample_request) @@ -3787,7 +4066,8 @@ def test_remove_rule_unary_rest_flattened(): def test_remove_rule_unary_rest_flattened_error(transport: str = "rest"): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3813,7 +4093,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -3833,7 +4114,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = SecurityPoliciesClient(client_options=options, transport=transport,) + client = SecurityPoliciesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -3849,7 +4133,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = SecurityPoliciesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -3862,7 +4147,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.SecurityPoliciesRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.SecurityPoliciesRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -3922,7 +4212,8 @@ def test_security_policies_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SecurityPoliciesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -3972,7 +4263,12 @@ def test_security_policies_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_security_policies_host_no_port(transport_name): client = SecurityPoliciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3988,7 +4284,12 @@ def test_security_policies_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_security_policies_host_with_port(transport_name): client = SecurityPoliciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4026,7 +4327,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = SecurityPoliciesClient.common_folder_path(folder) assert expected == actual @@ -4044,7 +4347,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = SecurityPoliciesClient.common_organization_path(organization) assert expected == actual @@ -4062,7 +4367,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = SecurityPoliciesClient.common_project_path(project) assert expected == actual @@ -4082,7 +4389,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = SecurityPoliciesClient.common_location_path(project, location) assert expected == actual @@ -4107,7 +4415,8 @@ def test_client_with_default_client_info(): transports.SecurityPoliciesTransport, "_prep_wrapped_messages" ) as prep: client = SecurityPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4116,7 +4425,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = SecurityPoliciesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4156,7 +4466,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(SecurityPoliciesClient, transports.SecurityPoliciesRestTransport),], + [ + (SecurityPoliciesClient, transports.SecurityPoliciesRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_service_attachments.py b/tests/unit/gapic/compute_v1/test_service_attachments.py index 1d143b535..0816b7bd5 100644 --- a/tests/unit/gapic/compute_v1/test_service_attachments.py +++ b/tests/unit/gapic/compute_v1/test_service_attachments.py @@ -92,7 +92,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(ServiceAttachmentsClient, "rest"),] + "client_class,transport_name", + [ + (ServiceAttachmentsClient, "rest"), + ], ) def test_service_attachments_client_from_service_account_info( client_class, transport_name @@ -116,7 +119,9 @@ def test_service_attachments_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.ServiceAttachmentsRestTransport, "rest"),], + [ + (transports.ServiceAttachmentsRestTransport, "rest"), + ], ) def test_service_attachments_client_service_account_always_use_jwt( transport_class, transport_name @@ -137,7 +142,10 @@ def test_service_attachments_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(ServiceAttachmentsClient, "rest"),] + "client_class,transport_name", + [ + (ServiceAttachmentsClient, "rest"), + ], ) def test_service_attachments_client_from_service_account_file( client_class, transport_name @@ -179,7 +187,9 @@ def test_service_attachments_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(ServiceAttachmentsClient, transports.ServiceAttachmentsRestTransport, "rest"),], + [ + (ServiceAttachmentsClient, transports.ServiceAttachmentsRestTransport, "rest"), + ], ) @mock.patch.object( ServiceAttachmentsClient, @@ -472,13 +482,17 @@ def test_service_attachments_client_get_mtls_endpoint_and_cert_source(client_cla @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(ServiceAttachmentsClient, transports.ServiceAttachmentsRestTransport, "rest"),], + [ + (ServiceAttachmentsClient, transports.ServiceAttachmentsRestTransport, "rest"), + ], ) def test_service_attachments_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -527,11 +541,16 @@ def test_service_attachments_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.AggregatedListServiceAttachmentsRequest, dict,] + "request_type", + [ + compute.AggregatedListServiceAttachmentsRequest, + dict, + ], ) def test_aggregated_list_rest(request_type): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -614,7 +633,8 @@ def test_aggregated_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -715,7 +735,11 @@ def test_aggregated_list_rest_interceptors(null_interceptor): post.return_value = compute.ServiceAttachmentAggregatedList client.aggregated_list( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -727,7 +751,8 @@ def test_aggregated_list_rest_bad_request( request_type=compute.AggregatedListServiceAttachmentsRequest, ): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -748,7 +773,8 @@ def test_aggregated_list_rest_bad_request( def test_aggregated_list_rest_flattened(): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -760,7 +786,9 @@ def test_aggregated_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -788,20 +816,23 @@ def test_aggregated_list_rest_flattened(): def test_aggregated_list_rest_flattened_error(transport: str = "rest"): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.aggregated_list( - compute.AggregatedListServiceAttachmentsRequest(), project="project_value", + compute.AggregatedListServiceAttachmentsRequest(), + project="project_value", ) def test_aggregated_list_rest_pager(transport: str = "rest"): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -818,9 +849,14 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): }, next_page_token="abc", ), - compute.ServiceAttachmentAggregatedList(items={}, next_page_token="def",), compute.ServiceAttachmentAggregatedList( - items={"g": compute.ServiceAttachmentsScopedList(),}, + items={}, + next_page_token="def", + ), + compute.ServiceAttachmentAggregatedList( + items={ + "g": compute.ServiceAttachmentsScopedList(), + }, next_page_token="ghi", ), compute.ServiceAttachmentAggregatedList( @@ -869,11 +905,16 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.DeleteServiceAttachmentRequest, dict,] + "request_type", + [ + compute.DeleteServiceAttachmentRequest, + dict, + ], ) def test_delete_unary_rest(request_type): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -991,7 +1032,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["serviceAttachment"] == "service_attachment_value" client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1032,7 +1074,14 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "region", "serviceAttachment",)) + set(("requestId",)) + & set( + ( + "project", + "region", + "serviceAttachment", + ) + ) ) @@ -1078,7 +1127,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1089,7 +1142,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteServiceAttachmentRequest ): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1114,7 +1168,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1160,7 +1215,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1180,10 +1236,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetServiceAttachmentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetServiceAttachmentRequest, + dict, + ], +) def test_get_rest(request_type): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1283,7 +1346,8 @@ def test_get_rest_required_fields(request_type=compute.GetServiceAttachmentReque assert jsonified_request["serviceAttachment"] == "service_attachment_value" client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1324,7 +1388,14 @@ def test_get_rest_unset_required_fields(): unset_fields = transport.get._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("project", "region", "serviceAttachment",)) + set(()) + & set( + ( + "project", + "region", + "serviceAttachment", + ) + ) ) @@ -1371,7 +1442,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.ServiceAttachment - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1381,7 +1458,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetServiceAttachmentRequest ): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1406,7 +1484,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1452,7 +1531,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1473,11 +1553,16 @@ def test_get_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.GetIamPolicyServiceAttachmentRequest, dict,] + "request_type", + [ + compute.GetIamPolicyServiceAttachmentRequest, + dict, + ], ) def test_get_iam_policy_rest(request_type): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1487,7 +1572,11 @@ def test_get_iam_policy_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = compute.Policy(etag="etag_value", iam_owned=True, version=774,) + return_value = compute.Policy( + etag="etag_value", + iam_owned=True, + version=774, + ) # Wrap the value into a proper Response obj response_value = Response() @@ -1549,7 +1638,8 @@ def test_get_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1591,7 +1681,13 @@ def test_get_iam_policy_rest_unset_required_fields(): unset_fields = transport.get_iam_policy._get_unset_required_fields({}) assert set(unset_fields) == ( set(("optionsRequestedPolicyVersion",)) - & set(("project", "region", "resource",)) + & set( + ( + "project", + "region", + "resource", + ) + ) ) @@ -1637,7 +1733,11 @@ def test_get_iam_policy_rest_interceptors(null_interceptor): post.return_value = compute.Policy client.get_iam_policy( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1648,7 +1748,8 @@ def test_get_iam_policy_rest_bad_request( transport: str = "rest", request_type=compute.GetIamPolicyServiceAttachmentRequest ): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1669,7 +1770,8 @@ def test_get_iam_policy_rest_bad_request( def test_get_iam_policy_rest_flattened(): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1686,7 +1788,9 @@ def test_get_iam_policy_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", region="region_value", resource="resource_value", + project="project_value", + region="region_value", + resource="resource_value", ) mock_args.update(sample_request) @@ -1713,7 +1817,8 @@ def test_get_iam_policy_rest_flattened(): def test_get_iam_policy_rest_flattened_error(transport: str = "rest"): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1734,11 +1839,16 @@ def test_get_iam_policy_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.InsertServiceAttachmentRequest, dict,] + "request_type", + [ + compute.InsertServiceAttachmentRequest, + dict, + ], ) def test_insert_unary_rest(request_type): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1879,7 +1989,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1921,7 +2032,14 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "region", "serviceAttachmentResource",)) + set(("requestId",)) + & set( + ( + "project", + "region", + "serviceAttachmentResource", + ) + ) ) @@ -1967,7 +2085,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1978,7 +2100,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertServiceAttachmentRequest ): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2030,7 +2153,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2078,7 +2202,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2104,10 +2229,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListServiceAttachmentsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListServiceAttachmentsRequest, + dict, + ], +) def test_list_rest(request_type): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2170,7 +2302,13 @@ def test_list_rest_required_fields(request_type=compute.ListServiceAttachmentsRe ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -2181,7 +2319,8 @@ def test_list_rest_required_fields(request_type=compute.ListServiceAttachmentsRe assert jsonified_request["region"] == "region_value" client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2222,8 +2361,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "region",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "region", + ) + ) ) @@ -2270,7 +2422,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.ServiceAttachmentList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2280,7 +2438,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListServiceAttachmentsRequest ): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2301,7 +2460,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2313,7 +2473,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "region": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", region="region_value",) + mock_args = dict( + project="project_value", + region="region_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2339,7 +2502,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2354,7 +2518,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2371,12 +2536,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.ServiceAttachmentList(items=[], next_page_token="def",), compute.ServiceAttachmentList( - items=[compute.ServiceAttachment(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.ServiceAttachmentList( - items=[compute.ServiceAttachment(), compute.ServiceAttachment(),], + items=[ + compute.ServiceAttachment(), + ], + next_page_token="ghi", + ), + compute.ServiceAttachmentList( + items=[ + compute.ServiceAttachment(), + compute.ServiceAttachment(), + ], ), ) # Two responses for two calls @@ -2403,10 +2577,17 @@ def test_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.PatchServiceAttachmentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.PatchServiceAttachmentRequest, + dict, + ], +) def test_patch_unary_rest(request_type): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2555,7 +2736,8 @@ def test_patch_unary_rest_required_fields( assert jsonified_request["serviceAttachment"] == "service_attachment_value" client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2598,7 +2780,14 @@ def test_patch_unary_rest_unset_required_fields(): unset_fields = transport.patch._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("project", "region", "serviceAttachment", "serviceAttachmentResource",)) + & set( + ( + "project", + "region", + "serviceAttachment", + "serviceAttachmentResource", + ) + ) ) @@ -2643,7 +2832,13 @@ def test_patch_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.patch_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2653,7 +2848,8 @@ def test_patch_unary_rest_bad_request( transport: str = "rest", request_type=compute.PatchServiceAttachmentRequest ): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2709,7 +2905,8 @@ def test_patch_unary_rest_bad_request( def test_patch_unary_rest_flattened(): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2762,7 +2959,8 @@ def test_patch_unary_rest_flattened(): def test_patch_unary_rest_flattened_error(transport: str = "rest"): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2790,11 +2988,16 @@ def test_patch_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SetIamPolicyServiceAttachmentRequest, dict,] + "request_type", + [ + compute.SetIamPolicyServiceAttachmentRequest, + dict, + ], ) def test_set_iam_policy_rest(request_type): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2881,7 +3084,11 @@ def test_set_iam_policy_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = compute.Policy(etag="etag_value", iam_owned=True, version=774,) + return_value = compute.Policy( + etag="etag_value", + iam_owned=True, + version=774, + ) # Wrap the value into a proper Response obj response_value = Response() @@ -2941,7 +3148,8 @@ def test_set_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2984,7 +3192,14 @@ def test_set_iam_policy_rest_unset_required_fields(): unset_fields = transport.set_iam_policy._get_unset_required_fields({}) assert set(unset_fields) == ( set(()) - & set(("project", "region", "regionSetPolicyRequestResource", "resource",)) + & set( + ( + "project", + "region", + "regionSetPolicyRequestResource", + "resource", + ) + ) ) @@ -3030,7 +3245,11 @@ def test_set_iam_policy_rest_interceptors(null_interceptor): post.return_value = compute.Policy client.set_iam_policy( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3041,7 +3260,8 @@ def test_set_iam_policy_rest_bad_request( transport: str = "rest", request_type=compute.SetIamPolicyServiceAttachmentRequest ): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3139,7 +3359,8 @@ def test_set_iam_policy_rest_bad_request( def test_set_iam_policy_rest_flattened(): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3188,7 +3409,8 @@ def test_set_iam_policy_rest_flattened(): def test_set_iam_policy_rest_flattened_error(transport: str = "rest"): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3212,11 +3434,16 @@ def test_set_iam_policy_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.TestIamPermissionsServiceAttachmentRequest, dict,] + "request_type", + [ + compute.TestIamPermissionsServiceAttachmentRequest, + dict, + ], ) def test_test_iam_permissions_rest(request_type): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3289,7 +3516,8 @@ def test_test_iam_permissions_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3332,7 +3560,14 @@ def test_test_iam_permissions_rest_unset_required_fields(): unset_fields = transport.test_iam_permissions._get_unset_required_fields({}) assert set(unset_fields) == ( set(()) - & set(("project", "region", "resource", "testPermissionsRequestResource",)) + & set( + ( + "project", + "region", + "resource", + "testPermissionsRequestResource", + ) + ) ) @@ -3380,7 +3615,11 @@ def test_test_iam_permissions_rest_interceptors(null_interceptor): post.return_value = compute.TestPermissionsResponse client.test_iam_permissions( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3392,7 +3631,8 @@ def test_test_iam_permissions_rest_bad_request( request_type=compute.TestIamPermissionsServiceAttachmentRequest, ): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3416,7 +3656,8 @@ def test_test_iam_permissions_rest_bad_request( def test_test_iam_permissions_rest_flattened(): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3465,7 +3706,8 @@ def test_test_iam_permissions_rest_flattened(): def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3495,7 +3737,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -3515,7 +3758,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = ServiceAttachmentsClient(client_options=options, transport=transport,) + client = ServiceAttachmentsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -3531,7 +3777,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ServiceAttachmentsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -3545,7 +3792,10 @@ def test_transport_instance(): @pytest.mark.parametrize( - "transport_class", [transports.ServiceAttachmentsRestTransport,] + "transport_class", + [ + transports.ServiceAttachmentsRestTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -3605,7 +3855,8 @@ def test_service_attachments_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ServiceAttachmentsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -3655,7 +3906,12 @@ def test_service_attachments_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_service_attachments_host_no_port(transport_name): client = ServiceAttachmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3671,7 +3927,12 @@ def test_service_attachments_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_service_attachments_host_with_port(transport_name): client = ServiceAttachmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3709,7 +3970,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = ServiceAttachmentsClient.common_folder_path(folder) assert expected == actual @@ -3727,7 +3990,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = ServiceAttachmentsClient.common_organization_path(organization) assert expected == actual @@ -3745,7 +4010,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = ServiceAttachmentsClient.common_project_path(project) assert expected == actual @@ -3765,7 +4032,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = ServiceAttachmentsClient.common_location_path(project, location) assert expected == actual @@ -3790,7 +4058,8 @@ def test_client_with_default_client_info(): transports.ServiceAttachmentsTransport, "_prep_wrapped_messages" ) as prep: client = ServiceAttachmentsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3799,7 +4068,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ServiceAttachmentsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3839,7 +4109,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(ServiceAttachmentsClient, transports.ServiceAttachmentsRestTransport),], + [ + (ServiceAttachmentsClient, transports.ServiceAttachmentsRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_snapshots.py b/tests/unit/gapic/compute_v1/test_snapshots.py index 5cdfdbc9f..7e974ffba 100644 --- a/tests/unit/gapic/compute_v1/test_snapshots.py +++ b/tests/unit/gapic/compute_v1/test_snapshots.py @@ -83,7 +83,12 @@ def test__get_default_mtls_endpoint(): assert SnapshotsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class,transport_name", [(SnapshotsClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (SnapshotsClient, "rest"), + ], +) def test_snapshots_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -103,7 +108,10 @@ def test_snapshots_client_from_service_account_info(client_class, transport_name @pytest.mark.parametrize( - "transport_class,transport_name", [(transports.SnapshotsRestTransport, "rest"),] + "transport_class,transport_name", + [ + (transports.SnapshotsRestTransport, "rest"), + ], ) def test_snapshots_client_service_account_always_use_jwt( transport_class, transport_name @@ -123,7 +131,12 @@ def test_snapshots_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class,transport_name", [(SnapshotsClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (SnapshotsClient, "rest"), + ], +) def test_snapshots_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -162,7 +175,9 @@ def test_snapshots_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(SnapshotsClient, transports.SnapshotsRestTransport, "rest"),], + [ + (SnapshotsClient, transports.SnapshotsRestTransport, "rest"), + ], ) @mock.patch.object( SnapshotsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(SnapshotsClient) @@ -437,13 +452,17 @@ def test_snapshots_client_get_mtls_endpoint_and_cert_source(client_class): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(SnapshotsClient, transports.SnapshotsRestTransport, "rest"),], + [ + (SnapshotsClient, transports.SnapshotsRestTransport, "rest"), + ], ) def test_snapshots_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -461,7 +480,9 @@ def test_snapshots_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(SnapshotsClient, transports.SnapshotsRestTransport, "rest", None),], + [ + (SnapshotsClient, transports.SnapshotsRestTransport, "rest", None), + ], ) def test_snapshots_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -484,10 +505,17 @@ def test_snapshots_client_client_options_credentials_file( ) -@pytest.mark.parametrize("request_type", [compute.DeleteSnapshotRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteSnapshotRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -595,7 +623,8 @@ def test_delete_unary_rest_required_fields(request_type=compute.DeleteSnapshotRe assert jsonified_request["snapshot"] == "snapshot_value" client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -635,7 +664,15 @@ def test_delete_unary_rest_unset_required_fields(): ) unset_fields = transport.delete._get_unset_required_fields({}) - assert set(unset_fields) == (set(("requestId",)) & set(("project", "snapshot",))) + assert set(unset_fields) == ( + set(("requestId",)) + & set( + ( + "project", + "snapshot", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -678,7 +715,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -689,7 +730,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteSnapshotRequest ): client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -710,7 +752,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -722,7 +765,10 @@ def test_delete_unary_rest_flattened(): sample_request = {"project": "sample1", "snapshot": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", snapshot="snapshot_value",) + mock_args = dict( + project="project_value", + snapshot="snapshot_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -748,7 +794,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -767,10 +814,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetSnapshotRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetSnapshotRequest, + dict, + ], +) def test_get_rest(request_type): client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -874,7 +928,8 @@ def test_get_rest_required_fields(request_type=compute.GetSnapshotRequest): assert jsonified_request["snapshot"] == "snapshot_value" client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -914,7 +969,15 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("project", "snapshot",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "project", + "snapshot", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -956,7 +1019,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Snapshot - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -966,7 +1035,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetSnapshotRequest ): client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -987,7 +1057,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -999,7 +1070,10 @@ def test_get_rest_flattened(): sample_request = {"project": "sample1", "snapshot": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", snapshot="snapshot_value",) + mock_args = dict( + project="project_value", + snapshot="snapshot_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1025,7 +1099,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1044,10 +1119,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetIamPolicySnapshotRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetIamPolicySnapshotRequest, + dict, + ], +) def test_get_iam_policy_rest(request_type): client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1057,7 +1139,11 @@ def test_get_iam_policy_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = compute.Policy(etag="etag_value", iam_owned=True, version=774,) + return_value = compute.Policy( + etag="etag_value", + iam_owned=True, + version=774, + ) # Wrap the value into a proper Response obj response_value = Response() @@ -1115,7 +1201,8 @@ def test_get_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1156,7 +1243,13 @@ def test_get_iam_policy_rest_unset_required_fields(): unset_fields = transport.get_iam_policy._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("optionsRequestedPolicyVersion",)) & set(("project", "resource",)) + set(("optionsRequestedPolicyVersion",)) + & set( + ( + "project", + "resource", + ) + ) ) @@ -1200,7 +1293,11 @@ def test_get_iam_policy_rest_interceptors(null_interceptor): post.return_value = compute.Policy client.get_iam_policy( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1211,7 +1308,8 @@ def test_get_iam_policy_rest_bad_request( transport: str = "rest", request_type=compute.GetIamPolicySnapshotRequest ): client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1232,7 +1330,8 @@ def test_get_iam_policy_rest_bad_request( def test_get_iam_policy_rest_flattened(): client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1244,7 +1343,10 @@ def test_get_iam_policy_rest_flattened(): sample_request = {"project": "sample1", "resource": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", resource="resource_value",) + mock_args = dict( + project="project_value", + resource="resource_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1270,7 +1372,8 @@ def test_get_iam_policy_rest_flattened(): def test_get_iam_policy_rest_flattened_error(transport: str = "rest"): client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1289,10 +1392,17 @@ def test_get_iam_policy_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertSnapshotRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertSnapshotRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1428,7 +1538,8 @@ def test_insert_unary_rest_required_fields(request_type=compute.InsertSnapshotRe assert jsonified_request["project"] == "project_value" client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1470,7 +1581,13 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "snapshotResource",)) + set(("requestId",)) + & set( + ( + "project", + "snapshotResource", + ) + ) ) @@ -1514,7 +1631,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1525,7 +1646,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertSnapshotRequest ): client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1578,7 +1700,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1619,7 +1742,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1638,10 +1762,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListSnapshotsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListSnapshotsRequest, + dict, + ], +) def test_list_rest(request_type): client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1702,7 +1833,13 @@ def test_list_rest_required_fields(request_type=compute.ListSnapshotsRequest): ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1711,7 +1848,8 @@ def test_list_rest_required_fields(request_type=compute.ListSnapshotsRequest): assert jsonified_request["project"] == "project_value" client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1752,7 +1890,15 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set(("project",)) ) @@ -1796,7 +1942,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.SnapshotList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1806,7 +1958,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListSnapshotsRequest ): client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1827,7 +1980,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1839,7 +1993,9 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1865,20 +2021,23 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list( - compute.ListSnapshotsRequest(), project="project_value", + compute.ListSnapshotsRequest(), + project="project_value", ) def test_list_rest_pager(transport: str = "rest"): client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1888,12 +2047,29 @@ def test_list_rest_pager(transport: str = "rest"): # Set the response as a series of pages response = ( compute.SnapshotList( - items=[compute.Snapshot(), compute.Snapshot(), compute.Snapshot(),], + items=[ + compute.Snapshot(), + compute.Snapshot(), + compute.Snapshot(), + ], next_page_token="abc", ), - compute.SnapshotList(items=[], next_page_token="def",), - compute.SnapshotList(items=[compute.Snapshot(),], next_page_token="ghi",), - compute.SnapshotList(items=[compute.Snapshot(), compute.Snapshot(),],), + compute.SnapshotList( + items=[], + next_page_token="def", + ), + compute.SnapshotList( + items=[ + compute.Snapshot(), + ], + next_page_token="ghi", + ), + compute.SnapshotList( + items=[ + compute.Snapshot(), + compute.Snapshot(), + ], + ), ) # Two responses for two calls response = response + response @@ -1919,10 +2095,17 @@ def test_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.SetIamPolicySnapshotRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.SetIamPolicySnapshotRequest, + dict, + ], +) def test_set_iam_policy_rest(request_type): client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2009,7 +2192,11 @@ def test_set_iam_policy_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = compute.Policy(etag="etag_value", iam_owned=True, version=774,) + return_value = compute.Policy( + etag="etag_value", + iam_owned=True, + version=774, + ) # Wrap the value into a proper Response obj response_value = Response() @@ -2065,7 +2252,8 @@ def test_set_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2107,7 +2295,14 @@ def test_set_iam_policy_rest_unset_required_fields(): unset_fields = transport.set_iam_policy._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("globalSetPolicyRequestResource", "project", "resource",)) + set(()) + & set( + ( + "globalSetPolicyRequestResource", + "project", + "resource", + ) + ) ) @@ -2151,7 +2346,11 @@ def test_set_iam_policy_rest_interceptors(null_interceptor): post.return_value = compute.Policy client.set_iam_policy( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2162,7 +2361,8 @@ def test_set_iam_policy_rest_bad_request( transport: str = "rest", request_type=compute.SetIamPolicySnapshotRequest ): client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2260,7 +2460,8 @@ def test_set_iam_policy_rest_bad_request( def test_set_iam_policy_rest_flattened(): client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2304,7 +2505,8 @@ def test_set_iam_policy_rest_flattened(): def test_set_iam_policy_rest_flattened_error(transport: str = "rest"): client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2326,10 +2528,17 @@ def test_set_iam_policy_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.SetLabelsSnapshotRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.SetLabelsSnapshotRequest, + dict, + ], +) def test_set_labels_unary_rest(request_type): client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2441,7 +2650,8 @@ def test_set_labels_unary_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2483,7 +2693,14 @@ def test_set_labels_unary_rest_unset_required_fields(): unset_fields = transport.set_labels._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("globalSetLabelsRequestResource", "project", "resource",)) + set(()) + & set( + ( + "globalSetLabelsRequestResource", + "project", + "resource", + ) + ) ) @@ -2527,7 +2744,11 @@ def test_set_labels_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_labels_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2538,7 +2759,8 @@ def test_set_labels_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetLabelsSnapshotRequest ): client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2563,7 +2785,8 @@ def test_set_labels_unary_rest_bad_request( def test_set_labels_unary_rest_flattened(): client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2607,7 +2830,8 @@ def test_set_labels_unary_rest_flattened(): def test_set_labels_unary_rest_flattened_error(transport: str = "rest"): client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2630,11 +2854,16 @@ def test_set_labels_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.TestIamPermissionsSnapshotRequest, dict,] + "request_type", + [ + compute.TestIamPermissionsSnapshotRequest, + dict, + ], ) def test_test_iam_permissions_rest(request_type): client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2703,7 +2932,8 @@ def test_test_iam_permissions_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2745,7 +2975,14 @@ def test_test_iam_permissions_rest_unset_required_fields(): unset_fields = transport.test_iam_permissions._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("project", "resource", "testPermissionsRequestResource",)) + set(()) + & set( + ( + "project", + "resource", + "testPermissionsRequestResource", + ) + ) ) @@ -2791,7 +3028,11 @@ def test_test_iam_permissions_rest_interceptors(null_interceptor): post.return_value = compute.TestPermissionsResponse client.test_iam_permissions( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2802,7 +3043,8 @@ def test_test_iam_permissions_rest_bad_request( transport: str = "rest", request_type=compute.TestIamPermissionsSnapshotRequest ): client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2826,7 +3068,8 @@ def test_test_iam_permissions_rest_bad_request( def test_test_iam_permissions_rest_flattened(): client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2870,7 +3113,8 @@ def test_test_iam_permissions_rest_flattened(): def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2899,7 +3143,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2919,7 +3164,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = SnapshotsClient(client_options=options, transport=transport,) + client = SnapshotsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2935,7 +3183,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = SnapshotsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2948,7 +3197,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.SnapshotsRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.SnapshotsRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -3006,7 +3260,8 @@ def test_snapshots_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SnapshotsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -3056,7 +3311,12 @@ def test_snapshots_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_snapshots_host_no_port(transport_name): client = SnapshotsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3072,7 +3332,12 @@ def test_snapshots_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_snapshots_host_with_port(transport_name): client = SnapshotsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3110,7 +3375,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = SnapshotsClient.common_folder_path(folder) assert expected == actual @@ -3128,7 +3395,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = SnapshotsClient.common_organization_path(organization) assert expected == actual @@ -3146,7 +3415,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = SnapshotsClient.common_project_path(project) assert expected == actual @@ -3166,7 +3437,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = SnapshotsClient.common_location_path(project, location) assert expected == actual @@ -3191,7 +3463,8 @@ def test_client_with_default_client_info(): transports.SnapshotsTransport, "_prep_wrapped_messages" ) as prep: client = SnapshotsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3200,7 +3473,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = SnapshotsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3240,7 +3514,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(SnapshotsClient, transports.SnapshotsRestTransport),], + [ + (SnapshotsClient, transports.SnapshotsRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_ssl_certificates.py b/tests/unit/gapic/compute_v1/test_ssl_certificates.py index b3e90db0b..cf52072e7 100644 --- a/tests/unit/gapic/compute_v1/test_ssl_certificates.py +++ b/tests/unit/gapic/compute_v1/test_ssl_certificates.py @@ -89,7 +89,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(SslCertificatesClient, "rest"),] + "client_class,transport_name", + [ + (SslCertificatesClient, "rest"), + ], ) def test_ssl_certificates_client_from_service_account_info( client_class, transport_name @@ -113,7 +116,9 @@ def test_ssl_certificates_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.SslCertificatesRestTransport, "rest"),], + [ + (transports.SslCertificatesRestTransport, "rest"), + ], ) def test_ssl_certificates_client_service_account_always_use_jwt( transport_class, transport_name @@ -134,7 +139,10 @@ def test_ssl_certificates_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(SslCertificatesClient, "rest"),] + "client_class,transport_name", + [ + (SslCertificatesClient, "rest"), + ], ) def test_ssl_certificates_client_from_service_account_file( client_class, transport_name @@ -176,7 +184,9 @@ def test_ssl_certificates_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(SslCertificatesClient, transports.SslCertificatesRestTransport, "rest"),], + [ + (SslCertificatesClient, transports.SslCertificatesRestTransport, "rest"), + ], ) @mock.patch.object( SslCertificatesClient, @@ -469,13 +479,17 @@ def test_ssl_certificates_client_get_mtls_endpoint_and_cert_source(client_class) @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(SslCertificatesClient, transports.SslCertificatesRestTransport, "rest"),], + [ + (SslCertificatesClient, transports.SslCertificatesRestTransport, "rest"), + ], ) def test_ssl_certificates_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -493,7 +507,9 @@ def test_ssl_certificates_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(SslCertificatesClient, transports.SslCertificatesRestTransport, "rest", None),], + [ + (SslCertificatesClient, transports.SslCertificatesRestTransport, "rest", None), + ], ) def test_ssl_certificates_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -517,11 +533,16 @@ def test_ssl_certificates_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.AggregatedListSslCertificatesRequest, dict,] + "request_type", + [ + compute.AggregatedListSslCertificatesRequest, + dict, + ], ) def test_aggregated_list_rest(request_type): client = SslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -602,7 +623,8 @@ def test_aggregated_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = SslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -703,7 +725,11 @@ def test_aggregated_list_rest_interceptors(null_interceptor): post.return_value = compute.SslCertificateAggregatedList client.aggregated_list( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -714,7 +740,8 @@ def test_aggregated_list_rest_bad_request( transport: str = "rest", request_type=compute.AggregatedListSslCertificatesRequest ): client = SslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -735,7 +762,8 @@ def test_aggregated_list_rest_bad_request( def test_aggregated_list_rest_flattened(): client = SslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -747,7 +775,9 @@ def test_aggregated_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -773,20 +803,23 @@ def test_aggregated_list_rest_flattened(): def test_aggregated_list_rest_flattened_error(transport: str = "rest"): client = SslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.aggregated_list( - compute.AggregatedListSslCertificatesRequest(), project="project_value", + compute.AggregatedListSslCertificatesRequest(), + project="project_value", ) def test_aggregated_list_rest_pager(transport: str = "rest"): client = SslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -803,9 +836,14 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): }, next_page_token="abc", ), - compute.SslCertificateAggregatedList(items={}, next_page_token="def",), compute.SslCertificateAggregatedList( - items={"g": compute.SslCertificatesScopedList(),}, + items={}, + next_page_token="def", + ), + compute.SslCertificateAggregatedList( + items={ + "g": compute.SslCertificatesScopedList(), + }, next_page_token="ghi", ), compute.SslCertificateAggregatedList( @@ -853,10 +891,17 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.DeleteSslCertificateRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteSslCertificateRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = SslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -966,7 +1011,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["sslCertificate"] == "ssl_certificate_value" client = SslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1007,7 +1053,13 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "sslCertificate",)) + set(("requestId",)) + & set( + ( + "project", + "sslCertificate", + ) + ) ) @@ -1053,7 +1105,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1064,7 +1120,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteSslCertificateRequest ): client = SslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1085,7 +1142,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = SslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1098,7 +1156,8 @@ def test_delete_unary_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", ssl_certificate="ssl_certificate_value", + project="project_value", + ssl_certificate="ssl_certificate_value", ) mock_args.update(sample_request) @@ -1125,7 +1184,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = SslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1144,10 +1204,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetSslCertificateRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetSslCertificateRequest, + dict, + ], +) def test_get_rest(request_type): client = SslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1233,7 +1300,8 @@ def test_get_rest_required_fields(request_type=compute.GetSslCertificateRequest) assert jsonified_request["sslCertificate"] == "ssl_certificate_value" client = SslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1273,7 +1341,15 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("project", "sslCertificate",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "project", + "sslCertificate", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1319,7 +1395,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.SslCertificate - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1329,7 +1411,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetSslCertificateRequest ): client = SslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1350,7 +1433,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = SslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1363,7 +1447,8 @@ def test_get_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", ssl_certificate="ssl_certificate_value", + project="project_value", + ssl_certificate="ssl_certificate_value", ) mock_args.update(sample_request) @@ -1390,7 +1475,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = SslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1409,10 +1495,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertSslCertificateRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertSslCertificateRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = SslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1544,7 +1637,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = SslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1586,7 +1680,13 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "sslCertificateResource",)) + set(("requestId",)) + & set( + ( + "project", + "sslCertificateResource", + ) + ) ) @@ -1632,7 +1732,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1643,7 +1747,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertSslCertificateRequest ): client = SslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1690,7 +1795,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = SslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1733,7 +1839,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = SslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1754,10 +1861,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListSslCertificatesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListSslCertificatesRequest, + dict, + ], +) def test_list_rest(request_type): client = SslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1818,7 +1932,13 @@ def test_list_rest_required_fields(request_type=compute.ListSslCertificatesReque ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1827,7 +1947,8 @@ def test_list_rest_required_fields(request_type=compute.ListSslCertificatesReque assert jsonified_request["project"] == "project_value" client = SslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1868,7 +1989,15 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set(("project",)) ) @@ -1916,7 +2045,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.SslCertificateList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1926,7 +2061,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListSslCertificatesRequest ): client = SslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1947,7 +2083,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = SslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1959,7 +2096,9 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1985,20 +2124,23 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = SslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list( - compute.ListSslCertificatesRequest(), project="project_value", + compute.ListSslCertificatesRequest(), + project="project_value", ) def test_list_rest_pager(transport: str = "rest"): client = SslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2015,12 +2157,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.SslCertificateList(items=[], next_page_token="def",), compute.SslCertificateList( - items=[compute.SslCertificate(),], next_page_token="ghi", + items=[], + next_page_token="def", + ), + compute.SslCertificateList( + items=[ + compute.SslCertificate(), + ], + next_page_token="ghi", ), compute.SslCertificateList( - items=[compute.SslCertificate(), compute.SslCertificate(),], + items=[ + compute.SslCertificate(), + compute.SslCertificate(), + ], ), ) # Two responses for two calls @@ -2054,7 +2205,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = SslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2074,7 +2226,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = SslCertificatesClient(client_options=options, transport=transport,) + client = SslCertificatesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2090,7 +2245,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = SslCertificatesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2103,7 +2259,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.SslCertificatesRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.SslCertificatesRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -2158,7 +2319,8 @@ def test_ssl_certificates_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SslCertificatesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2208,7 +2370,12 @@ def test_ssl_certificates_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_ssl_certificates_host_no_port(transport_name): client = SslCertificatesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2224,7 +2391,12 @@ def test_ssl_certificates_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_ssl_certificates_host_with_port(transport_name): client = SslCertificatesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2262,7 +2434,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = SslCertificatesClient.common_folder_path(folder) assert expected == actual @@ -2280,7 +2454,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = SslCertificatesClient.common_organization_path(organization) assert expected == actual @@ -2298,7 +2474,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = SslCertificatesClient.common_project_path(project) assert expected == actual @@ -2318,7 +2496,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = SslCertificatesClient.common_location_path(project, location) assert expected == actual @@ -2343,7 +2522,8 @@ def test_client_with_default_client_info(): transports.SslCertificatesTransport, "_prep_wrapped_messages" ) as prep: client = SslCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2352,7 +2532,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = SslCertificatesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2392,7 +2573,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(SslCertificatesClient, transports.SslCertificatesRestTransport),], + [ + (SslCertificatesClient, transports.SslCertificatesRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_ssl_policies.py b/tests/unit/gapic/compute_v1/test_ssl_policies.py index e00c00409..200514f8c 100644 --- a/tests/unit/gapic/compute_v1/test_ssl_policies.py +++ b/tests/unit/gapic/compute_v1/test_ssl_policies.py @@ -85,7 +85,12 @@ def test__get_default_mtls_endpoint(): assert SslPoliciesClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class,transport_name", [(SslPoliciesClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (SslPoliciesClient, "rest"), + ], +) def test_ssl_policies_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -105,7 +110,10 @@ def test_ssl_policies_client_from_service_account_info(client_class, transport_n @pytest.mark.parametrize( - "transport_class,transport_name", [(transports.SslPoliciesRestTransport, "rest"),] + "transport_class,transport_name", + [ + (transports.SslPoliciesRestTransport, "rest"), + ], ) def test_ssl_policies_client_service_account_always_use_jwt( transport_class, transport_name @@ -125,7 +133,12 @@ def test_ssl_policies_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class,transport_name", [(SslPoliciesClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (SslPoliciesClient, "rest"), + ], +) def test_ssl_policies_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -164,7 +177,9 @@ def test_ssl_policies_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(SslPoliciesClient, transports.SslPoliciesRestTransport, "rest"),], + [ + (SslPoliciesClient, transports.SslPoliciesRestTransport, "rest"), + ], ) @mock.patch.object( SslPoliciesClient, "DEFAULT_ENDPOINT", modify_default_endpoint(SslPoliciesClient) @@ -441,13 +456,17 @@ def test_ssl_policies_client_get_mtls_endpoint_and_cert_source(client_class): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(SslPoliciesClient, transports.SslPoliciesRestTransport, "rest"),], + [ + (SslPoliciesClient, transports.SslPoliciesRestTransport, "rest"), + ], ) def test_ssl_policies_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -465,7 +484,9 @@ def test_ssl_policies_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(SslPoliciesClient, transports.SslPoliciesRestTransport, "rest", None),], + [ + (SslPoliciesClient, transports.SslPoliciesRestTransport, "rest", None), + ], ) def test_ssl_policies_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -488,10 +509,17 @@ def test_ssl_policies_client_client_options_credentials_file( ) -@pytest.mark.parametrize("request_type", [compute.DeleteSslPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteSslPolicyRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = SslPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -599,7 +627,8 @@ def test_delete_unary_rest_required_fields(request_type=compute.DeleteSslPolicyR assert jsonified_request["sslPolicy"] == "ssl_policy_value" client = SslPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -639,7 +668,15 @@ def test_delete_unary_rest_unset_required_fields(): ) unset_fields = transport.delete._get_unset_required_fields({}) - assert set(unset_fields) == (set(("requestId",)) & set(("project", "sslPolicy",))) + assert set(unset_fields) == ( + set(("requestId",)) + & set( + ( + "project", + "sslPolicy", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -684,7 +721,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -695,7 +736,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteSslPolicyRequest ): client = SslPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -716,7 +758,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = SslPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -728,7 +771,10 @@ def test_delete_unary_rest_flattened(): sample_request = {"project": "sample1", "ssl_policy": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", ssl_policy="ssl_policy_value",) + mock_args = dict( + project="project_value", + ssl_policy="ssl_policy_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -754,7 +800,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = SslPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -773,10 +820,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetSslPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetSslPolicyRequest, + dict, + ], +) def test_get_rest(request_type): client = SslPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -860,7 +914,8 @@ def test_get_rest_required_fields(request_type=compute.GetSslPolicyRequest): assert jsonified_request["sslPolicy"] == "ssl_policy_value" client = SslPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -900,7 +955,15 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("project", "sslPolicy",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "project", + "sslPolicy", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -944,7 +1007,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.SslPolicy - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -954,7 +1023,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetSslPolicyRequest ): client = SslPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -975,7 +1045,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = SslPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -987,7 +1058,10 @@ def test_get_rest_flattened(): sample_request = {"project": "sample1", "ssl_policy": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", ssl_policy="ssl_policy_value",) + mock_args = dict( + project="project_value", + ssl_policy="ssl_policy_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1013,7 +1087,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = SslPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1032,10 +1107,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertSslPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertSslPolicyRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = SslPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1159,7 +1241,8 @@ def test_insert_unary_rest_required_fields(request_type=compute.InsertSslPolicyR assert jsonified_request["project"] == "project_value" client = SslPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1201,7 +1284,13 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "sslPolicyResource",)) + set(("requestId",)) + & set( + ( + "project", + "sslPolicyResource", + ) + ) ) @@ -1247,7 +1336,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1258,7 +1351,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertSslPolicyRequest ): client = SslPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1299,7 +1393,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = SslPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1342,7 +1437,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = SslPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1363,10 +1459,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListSslPoliciesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListSslPoliciesRequest, + dict, + ], +) def test_list_rest(request_type): client = SslPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1427,7 +1530,13 @@ def test_list_rest_required_fields(request_type=compute.ListSslPoliciesRequest): ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1436,7 +1545,8 @@ def test_list_rest_required_fields(request_type=compute.ListSslPoliciesRequest): assert jsonified_request["project"] == "project_value" client = SslPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1477,7 +1587,15 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set(("project",)) ) @@ -1525,7 +1643,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.SslPoliciesList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1535,7 +1659,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListSslPoliciesRequest ): client = SslPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1556,7 +1681,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = SslPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1568,7 +1694,9 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1594,20 +1722,23 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = SslPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list( - compute.ListSslPoliciesRequest(), project="project_value", + compute.ListSslPoliciesRequest(), + project="project_value", ) def test_list_rest_pager(transport: str = "rest"): client = SslPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1617,14 +1748,29 @@ def test_list_rest_pager(transport: str = "rest"): # Set the response as a series of pages response = ( compute.SslPoliciesList( - items=[compute.SslPolicy(), compute.SslPolicy(), compute.SslPolicy(),], + items=[ + compute.SslPolicy(), + compute.SslPolicy(), + compute.SslPolicy(), + ], next_page_token="abc", ), - compute.SslPoliciesList(items=[], next_page_token="def",), compute.SslPoliciesList( - items=[compute.SslPolicy(),], next_page_token="ghi", + items=[], + next_page_token="def", + ), + compute.SslPoliciesList( + items=[ + compute.SslPolicy(), + ], + next_page_token="ghi", + ), + compute.SslPoliciesList( + items=[ + compute.SslPolicy(), + compute.SslPolicy(), + ], ), - compute.SslPoliciesList(items=[compute.SslPolicy(), compute.SslPolicy(),],), ) # Two responses for two calls response = response + response @@ -1651,11 +1797,16 @@ def test_list_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.ListAvailableFeaturesSslPoliciesRequest, dict,] + "request_type", + [ + compute.ListAvailableFeaturesSslPoliciesRequest, + dict, + ], ) def test_list_available_features_rest(request_type): client = SslPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1714,7 +1865,13 @@ def test_list_available_features_rest_required_fields( ).list_available_features._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1723,7 +1880,8 @@ def test_list_available_features_rest_required_fields( assert jsonified_request["project"] == "project_value" client = SslPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1746,8 +1904,8 @@ def test_list_available_features_rest_required_fields( response_value = Response() response_value.status_code = 200 - json_return_value = compute.SslPoliciesListAvailableFeaturesResponse.to_json( - return_value + json_return_value = ( + compute.SslPoliciesListAvailableFeaturesResponse.to_json(return_value) ) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -1766,7 +1924,15 @@ def test_list_available_features_rest_unset_required_fields(): unset_fields = transport.list_available_features._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set(("project",)) ) @@ -1802,8 +1968,10 @@ def test_list_available_features_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = compute.SslPoliciesListAvailableFeaturesResponse.to_json( - compute.SslPoliciesListAvailableFeaturesResponse() + req.return_value._content = ( + compute.SslPoliciesListAvailableFeaturesResponse.to_json( + compute.SslPoliciesListAvailableFeaturesResponse() + ) ) request = compute.ListAvailableFeaturesSslPoliciesRequest() @@ -1815,7 +1983,11 @@ def test_list_available_features_rest_interceptors(null_interceptor): post.return_value = compute.SslPoliciesListAvailableFeaturesResponse client.list_available_features( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1827,7 +1999,8 @@ def test_list_available_features_rest_bad_request( request_type=compute.ListAvailableFeaturesSslPoliciesRequest, ): client = SslPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1848,7 +2021,8 @@ def test_list_available_features_rest_bad_request( def test_list_available_features_rest_flattened(): client = SslPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1860,7 +2034,9 @@ def test_list_available_features_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1888,14 +2064,16 @@ def test_list_available_features_rest_flattened(): def test_list_available_features_rest_flattened_error(transport: str = "rest"): client = SslPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_available_features( - compute.ListAvailableFeaturesSslPoliciesRequest(), project="project_value", + compute.ListAvailableFeaturesSslPoliciesRequest(), + project="project_value", ) @@ -1905,10 +2083,17 @@ def test_list_available_features_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.PatchSslPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.PatchSslPolicyRequest, + dict, + ], +) def test_patch_unary_rest(request_type): client = SslPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2036,7 +2221,8 @@ def test_patch_unary_rest_required_fields(request_type=compute.PatchSslPolicyReq assert jsonified_request["sslPolicy"] == "ssl_policy_value" client = SslPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2078,7 +2264,14 @@ def test_patch_unary_rest_unset_required_fields(): unset_fields = transport.patch._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "sslPolicy", "sslPolicyResource",)) + set(("requestId",)) + & set( + ( + "project", + "sslPolicy", + "sslPolicyResource", + ) + ) ) @@ -2123,7 +2316,13 @@ def test_patch_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.patch_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2133,7 +2332,8 @@ def test_patch_unary_rest_bad_request( transport: str = "rest", request_type=compute.PatchSslPolicyRequest ): client = SslPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2174,7 +2374,8 @@ def test_patch_unary_rest_bad_request( def test_patch_unary_rest_flattened(): client = SslPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2218,7 +2419,8 @@ def test_patch_unary_rest_flattened(): def test_patch_unary_rest_flattened_error(transport: str = "rest"): client = SslPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2247,7 +2449,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = SslPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2267,7 +2470,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = SslPoliciesClient(client_options=options, transport=transport,) + client = SslPoliciesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2283,7 +2489,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = SslPoliciesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2296,7 +2503,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.SslPoliciesRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.SslPoliciesRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -2352,7 +2564,8 @@ def test_ssl_policies_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SslPoliciesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2402,7 +2615,12 @@ def test_ssl_policies_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_ssl_policies_host_no_port(transport_name): client = SslPoliciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2418,7 +2636,12 @@ def test_ssl_policies_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_ssl_policies_host_with_port(transport_name): client = SslPoliciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2456,7 +2679,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = SslPoliciesClient.common_folder_path(folder) assert expected == actual @@ -2474,7 +2699,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = SslPoliciesClient.common_organization_path(organization) assert expected == actual @@ -2492,7 +2719,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = SslPoliciesClient.common_project_path(project) assert expected == actual @@ -2512,7 +2741,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = SslPoliciesClient.common_location_path(project, location) assert expected == actual @@ -2537,7 +2767,8 @@ def test_client_with_default_client_info(): transports.SslPoliciesTransport, "_prep_wrapped_messages" ) as prep: client = SslPoliciesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2546,7 +2777,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = SslPoliciesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2586,7 +2818,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(SslPoliciesClient, transports.SslPoliciesRestTransport),], + [ + (SslPoliciesClient, transports.SslPoliciesRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_subnetworks.py b/tests/unit/gapic/compute_v1/test_subnetworks.py index 3c0d7068d..d6643c6ad 100644 --- a/tests/unit/gapic/compute_v1/test_subnetworks.py +++ b/tests/unit/gapic/compute_v1/test_subnetworks.py @@ -85,7 +85,12 @@ def test__get_default_mtls_endpoint(): assert SubnetworksClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class,transport_name", [(SubnetworksClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (SubnetworksClient, "rest"), + ], +) def test_subnetworks_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -105,7 +110,10 @@ def test_subnetworks_client_from_service_account_info(client_class, transport_na @pytest.mark.parametrize( - "transport_class,transport_name", [(transports.SubnetworksRestTransport, "rest"),] + "transport_class,transport_name", + [ + (transports.SubnetworksRestTransport, "rest"), + ], ) def test_subnetworks_client_service_account_always_use_jwt( transport_class, transport_name @@ -125,7 +133,12 @@ def test_subnetworks_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class,transport_name", [(SubnetworksClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (SubnetworksClient, "rest"), + ], +) def test_subnetworks_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -164,7 +177,9 @@ def test_subnetworks_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(SubnetworksClient, transports.SubnetworksRestTransport, "rest"),], + [ + (SubnetworksClient, transports.SubnetworksRestTransport, "rest"), + ], ) @mock.patch.object( SubnetworksClient, "DEFAULT_ENDPOINT", modify_default_endpoint(SubnetworksClient) @@ -441,13 +456,17 @@ def test_subnetworks_client_get_mtls_endpoint_and_cert_source(client_class): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(SubnetworksClient, transports.SubnetworksRestTransport, "rest"),], + [ + (SubnetworksClient, transports.SubnetworksRestTransport, "rest"), + ], ) def test_subnetworks_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -465,7 +484,9 @@ def test_subnetworks_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(SubnetworksClient, transports.SubnetworksRestTransport, "rest", None),], + [ + (SubnetworksClient, transports.SubnetworksRestTransport, "rest", None), + ], ) def test_subnetworks_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -489,11 +510,16 @@ def test_subnetworks_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.AggregatedListSubnetworksRequest, dict,] + "request_type", + [ + compute.AggregatedListSubnetworksRequest, + dict, + ], ) def test_aggregated_list_rest(request_type): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -574,7 +600,8 @@ def test_aggregated_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -673,7 +700,11 @@ def test_aggregated_list_rest_interceptors(null_interceptor): post.return_value = compute.SubnetworkAggregatedList client.aggregated_list( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -684,7 +715,8 @@ def test_aggregated_list_rest_bad_request( transport: str = "rest", request_type=compute.AggregatedListSubnetworksRequest ): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -705,7 +737,8 @@ def test_aggregated_list_rest_bad_request( def test_aggregated_list_rest_flattened(): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -717,7 +750,9 @@ def test_aggregated_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -743,20 +778,23 @@ def test_aggregated_list_rest_flattened(): def test_aggregated_list_rest_flattened_error(transport: str = "rest"): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.aggregated_list( - compute.AggregatedListSubnetworksRequest(), project="project_value", + compute.AggregatedListSubnetworksRequest(), + project="project_value", ) def test_aggregated_list_rest_pager(transport: str = "rest"): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -773,9 +811,15 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): }, next_page_token="abc", ), - compute.SubnetworkAggregatedList(items={}, next_page_token="def",), compute.SubnetworkAggregatedList( - items={"g": compute.SubnetworksScopedList(),}, next_page_token="ghi", + items={}, + next_page_token="def", + ), + compute.SubnetworkAggregatedList( + items={ + "g": compute.SubnetworksScopedList(), + }, + next_page_token="ghi", ), compute.SubnetworkAggregatedList( items={ @@ -820,10 +864,17 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.DeleteSubnetworkRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteSubnetworkRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -937,7 +988,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["subnetwork"] == "subnetwork_value" client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -978,7 +1030,14 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "region", "subnetwork",)) + set(("requestId",)) + & set( + ( + "project", + "region", + "subnetwork", + ) + ) ) @@ -1024,7 +1083,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1035,7 +1098,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteSubnetworkRequest ): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1056,7 +1120,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1102,7 +1167,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1123,11 +1189,16 @@ def test_delete_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.ExpandIpCidrRangeSubnetworkRequest, dict,] + "request_type", + [ + compute.ExpandIpCidrRangeSubnetworkRequest, + dict, + ], ) def test_expand_ip_cidr_range_unary_rest(request_type): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1244,7 +1315,8 @@ def test_expand_ip_cidr_range_unary_rest_required_fields( assert jsonified_request["subnetwork"] == "subnetwork_value" client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1340,7 +1412,11 @@ def test_expand_ip_cidr_range_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.expand_ip_cidr_range_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1351,7 +1427,8 @@ def test_expand_ip_cidr_range_unary_rest_bad_request( transport: str = "rest", request_type=compute.ExpandIpCidrRangeSubnetworkRequest ): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1375,7 +1452,8 @@ def test_expand_ip_cidr_range_unary_rest_bad_request( def test_expand_ip_cidr_range_unary_rest_flattened(): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1424,7 +1502,8 @@ def test_expand_ip_cidr_range_unary_rest_flattened(): def test_expand_ip_cidr_range_unary_rest_flattened_error(transport: str = "rest"): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1447,10 +1526,17 @@ def test_expand_ip_cidr_range_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetSubnetworkRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetSubnetworkRequest, + dict, + ], +) def test_get_rest(request_type): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1558,7 +1644,8 @@ def test_get_rest_required_fields(request_type=compute.GetSubnetworkRequest): assert jsonified_request["subnetwork"] == "subnetwork_value" client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1598,7 +1685,16 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("project", "region", "subnetwork",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "project", + "region", + "subnetwork", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1642,7 +1738,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Subnetwork - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1652,7 +1754,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetSubnetworkRequest ): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1673,7 +1776,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1719,7 +1823,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1739,10 +1844,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetIamPolicySubnetworkRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetIamPolicySubnetworkRequest, + dict, + ], +) def test_get_iam_policy_rest(request_type): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1752,7 +1864,11 @@ def test_get_iam_policy_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = compute.Policy(etag="etag_value", iam_owned=True, version=774,) + return_value = compute.Policy( + etag="etag_value", + iam_owned=True, + version=774, + ) # Wrap the value into a proper Response obj response_value = Response() @@ -1814,7 +1930,8 @@ def test_get_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1856,7 +1973,13 @@ def test_get_iam_policy_rest_unset_required_fields(): unset_fields = transport.get_iam_policy._get_unset_required_fields({}) assert set(unset_fields) == ( set(("optionsRequestedPolicyVersion",)) - & set(("project", "region", "resource",)) + & set( + ( + "project", + "region", + "resource", + ) + ) ) @@ -1902,7 +2025,11 @@ def test_get_iam_policy_rest_interceptors(null_interceptor): post.return_value = compute.Policy client.get_iam_policy( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1913,7 +2040,8 @@ def test_get_iam_policy_rest_bad_request( transport: str = "rest", request_type=compute.GetIamPolicySubnetworkRequest ): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1934,7 +2062,8 @@ def test_get_iam_policy_rest_bad_request( def test_get_iam_policy_rest_flattened(): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1951,7 +2080,9 @@ def test_get_iam_policy_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", region="region_value", resource="resource_value", + project="project_value", + region="region_value", + resource="resource_value", ) mock_args.update(sample_request) @@ -1978,7 +2109,8 @@ def test_get_iam_policy_rest_flattened(): def test_get_iam_policy_rest_flattened_error(transport: str = "rest"): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1998,10 +2130,17 @@ def test_get_iam_policy_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertSubnetworkRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertSubnetworkRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2145,7 +2284,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2187,7 +2327,14 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "region", "subnetworkResource",)) + set(("requestId",)) + & set( + ( + "project", + "region", + "subnetworkResource", + ) + ) ) @@ -2233,7 +2380,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2244,7 +2395,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertSubnetworkRequest ): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2299,7 +2451,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2343,7 +2496,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2365,10 +2519,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListSubnetworksRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListSubnetworksRequest, + dict, + ], +) def test_list_rest(request_type): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2431,7 +2592,13 @@ def test_list_rest_required_fields(request_type=compute.ListSubnetworksRequest): ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -2442,7 +2609,8 @@ def test_list_rest_required_fields(request_type=compute.ListSubnetworksRequest): assert jsonified_request["region"] == "region_value" client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2483,8 +2651,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "region",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "region", + ) + ) ) @@ -2531,7 +2712,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.SubnetworkList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2541,7 +2728,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListSubnetworksRequest ): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2562,7 +2750,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2574,7 +2763,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "region": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", region="region_value",) + mock_args = dict( + project="project_value", + region="region_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2600,7 +2792,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2615,7 +2808,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2632,12 +2826,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.SubnetworkList(items=[], next_page_token="def",), compute.SubnetworkList( - items=[compute.Subnetwork(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.SubnetworkList( - items=[compute.Subnetwork(), compute.Subnetwork(),], + items=[ + compute.Subnetwork(), + ], + next_page_token="ghi", + ), + compute.SubnetworkList( + items=[ + compute.Subnetwork(), + compute.Subnetwork(), + ], ), ) # Two responses for two calls @@ -2664,10 +2867,17 @@ def test_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.ListUsableSubnetworksRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListUsableSubnetworksRequest, + dict, + ], +) def test_list_usable_rest(request_type): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2732,7 +2942,13 @@ def test_list_usable_rest_required_fields( ).list_usable._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -2741,7 +2957,8 @@ def test_list_usable_rest_required_fields( assert jsonified_request["project"] == "project_value" client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2784,7 +3001,15 @@ def test_list_usable_rest_unset_required_fields(): unset_fields = transport.list_usable._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set(("project",)) ) @@ -2832,7 +3057,13 @@ def test_list_usable_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.UsableSubnetworksAggregatedList - client.list_usable(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list_usable( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2842,7 +3073,8 @@ def test_list_usable_rest_bad_request( transport: str = "rest", request_type=compute.ListUsableSubnetworksRequest ): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2863,7 +3095,8 @@ def test_list_usable_rest_bad_request( def test_list_usable_rest_flattened(): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2875,7 +3108,9 @@ def test_list_usable_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2903,20 +3138,23 @@ def test_list_usable_rest_flattened(): def test_list_usable_rest_flattened_error(transport: str = "rest"): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_usable( - compute.ListUsableSubnetworksRequest(), project="project_value", + compute.ListUsableSubnetworksRequest(), + project="project_value", ) def test_list_usable_rest_pager(transport: str = "rest"): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2933,12 +3171,21 @@ def test_list_usable_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.UsableSubnetworksAggregatedList(items=[], next_page_token="def",), compute.UsableSubnetworksAggregatedList( - items=[compute.UsableSubnetwork(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.UsableSubnetworksAggregatedList( - items=[compute.UsableSubnetwork(), compute.UsableSubnetwork(),], + items=[ + compute.UsableSubnetwork(), + ], + next_page_token="ghi", + ), + compute.UsableSubnetworksAggregatedList( + items=[ + compute.UsableSubnetwork(), + compute.UsableSubnetwork(), + ], ), ) # Two responses for two calls @@ -2967,10 +3214,17 @@ def test_list_usable_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.PatchSubnetworkRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.PatchSubnetworkRequest, + dict, + ], +) def test_patch_unary_rest(request_type): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3104,7 +3358,12 @@ def test_patch_unary_rest_required_fields(request_type=compute.PatchSubnetworkRe credentials=ga_credentials.AnonymousCredentials() ).patch._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("drain_timeout_seconds", "request_id",)) + assert not set(unset_fields) - set( + ( + "drain_timeout_seconds", + "request_id", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -3116,7 +3375,8 @@ def test_patch_unary_rest_required_fields(request_type=compute.PatchSubnetworkRe assert jsonified_request["subnetwork"] == "subnetwork_value" client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3158,8 +3418,20 @@ def test_patch_unary_rest_unset_required_fields(): unset_fields = transport.patch._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("drainTimeoutSeconds", "requestId",)) - & set(("project", "region", "subnetwork", "subnetworkResource",)) + set( + ( + "drainTimeoutSeconds", + "requestId", + ) + ) + & set( + ( + "project", + "region", + "subnetwork", + "subnetworkResource", + ) + ) ) @@ -3204,7 +3476,13 @@ def test_patch_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.patch_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -3214,7 +3492,8 @@ def test_patch_unary_rest_bad_request( transport: str = "rest", request_type=compute.PatchSubnetworkRequest ): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3269,7 +3548,8 @@ def test_patch_unary_rest_bad_request( def test_patch_unary_rest_flattened(): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3318,7 +3598,8 @@ def test_patch_unary_rest_flattened(): def test_patch_unary_rest_flattened_error(transport: str = "rest"): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3341,10 +3622,17 @@ def test_patch_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.SetIamPolicySubnetworkRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.SetIamPolicySubnetworkRequest, + dict, + ], +) def test_set_iam_policy_rest(request_type): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3431,7 +3719,11 @@ def test_set_iam_policy_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = compute.Policy(etag="etag_value", iam_owned=True, version=774,) + return_value = compute.Policy( + etag="etag_value", + iam_owned=True, + version=774, + ) # Wrap the value into a proper Response obj response_value = Response() @@ -3491,7 +3783,8 @@ def test_set_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3534,7 +3827,14 @@ def test_set_iam_policy_rest_unset_required_fields(): unset_fields = transport.set_iam_policy._get_unset_required_fields({}) assert set(unset_fields) == ( set(()) - & set(("project", "region", "regionSetPolicyRequestResource", "resource",)) + & set( + ( + "project", + "region", + "regionSetPolicyRequestResource", + "resource", + ) + ) ) @@ -3580,7 +3880,11 @@ def test_set_iam_policy_rest_interceptors(null_interceptor): post.return_value = compute.Policy client.set_iam_policy( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3591,7 +3895,8 @@ def test_set_iam_policy_rest_bad_request( transport: str = "rest", request_type=compute.SetIamPolicySubnetworkRequest ): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3689,7 +3994,8 @@ def test_set_iam_policy_rest_bad_request( def test_set_iam_policy_rest_flattened(): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3738,7 +4044,8 @@ def test_set_iam_policy_rest_flattened(): def test_set_iam_policy_rest_flattened_error(transport: str = "rest"): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3762,11 +4069,16 @@ def test_set_iam_policy_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SetPrivateIpGoogleAccessSubnetworkRequest, dict,] + "request_type", + [ + compute.SetPrivateIpGoogleAccessSubnetworkRequest, + dict, + ], ) def test_set_private_ip_google_access_unary_rest(request_type): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3883,7 +4195,8 @@ def test_set_private_ip_google_access_unary_rest_required_fields( assert jsonified_request["subnetwork"] == "subnetwork_value" client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3979,7 +4292,11 @@ def test_set_private_ip_google_access_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_private_ip_google_access_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3991,7 +4308,8 @@ def test_set_private_ip_google_access_unary_rest_bad_request( request_type=compute.SetPrivateIpGoogleAccessSubnetworkRequest, ): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -4015,7 +4333,8 @@ def test_set_private_ip_google_access_unary_rest_bad_request( def test_set_private_ip_google_access_unary_rest_flattened(): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -4066,7 +4385,8 @@ def test_set_private_ip_google_access_unary_rest_flattened_error( transport: str = "rest", ): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -4090,11 +4410,16 @@ def test_set_private_ip_google_access_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.TestIamPermissionsSubnetworkRequest, dict,] + "request_type", + [ + compute.TestIamPermissionsSubnetworkRequest, + dict, + ], ) def test_test_iam_permissions_rest(request_type): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -4167,7 +4492,8 @@ def test_test_iam_permissions_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -4210,7 +4536,14 @@ def test_test_iam_permissions_rest_unset_required_fields(): unset_fields = transport.test_iam_permissions._get_unset_required_fields({}) assert set(unset_fields) == ( set(()) - & set(("project", "region", "resource", "testPermissionsRequestResource",)) + & set( + ( + "project", + "region", + "resource", + "testPermissionsRequestResource", + ) + ) ) @@ -4258,7 +4591,11 @@ def test_test_iam_permissions_rest_interceptors(null_interceptor): post.return_value = compute.TestPermissionsResponse client.test_iam_permissions( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -4269,7 +4606,8 @@ def test_test_iam_permissions_rest_bad_request( transport: str = "rest", request_type=compute.TestIamPermissionsSubnetworkRequest ): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -4293,7 +4631,8 @@ def test_test_iam_permissions_rest_bad_request( def test_test_iam_permissions_rest_flattened(): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -4342,7 +4681,8 @@ def test_test_iam_permissions_rest_flattened(): def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -4372,7 +4712,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -4392,7 +4733,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = SubnetworksClient(client_options=options, transport=transport,) + client = SubnetworksClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -4408,7 +4752,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = SubnetworksClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -4421,7 +4766,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.SubnetworksRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.SubnetworksRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -4483,7 +4833,8 @@ def test_subnetworks_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SubnetworksTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -4533,7 +4884,12 @@ def test_subnetworks_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_subnetworks_host_no_port(transport_name): client = SubnetworksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4549,7 +4905,12 @@ def test_subnetworks_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_subnetworks_host_with_port(transport_name): client = SubnetworksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4587,7 +4948,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = SubnetworksClient.common_folder_path(folder) assert expected == actual @@ -4605,7 +4968,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = SubnetworksClient.common_organization_path(organization) assert expected == actual @@ -4623,7 +4988,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = SubnetworksClient.common_project_path(project) assert expected == actual @@ -4643,7 +5010,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = SubnetworksClient.common_location_path(project, location) assert expected == actual @@ -4668,7 +5036,8 @@ def test_client_with_default_client_info(): transports.SubnetworksTransport, "_prep_wrapped_messages" ) as prep: client = SubnetworksClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4677,7 +5046,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = SubnetworksClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4717,7 +5087,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(SubnetworksClient, transports.SubnetworksRestTransport),], + [ + (SubnetworksClient, transports.SubnetworksRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_target_grpc_proxies.py b/tests/unit/gapic/compute_v1/test_target_grpc_proxies.py index 6b816411d..57b6e548a 100644 --- a/tests/unit/gapic/compute_v1/test_target_grpc_proxies.py +++ b/tests/unit/gapic/compute_v1/test_target_grpc_proxies.py @@ -90,7 +90,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(TargetGrpcProxiesClient, "rest"),] + "client_class,transport_name", + [ + (TargetGrpcProxiesClient, "rest"), + ], ) def test_target_grpc_proxies_client_from_service_account_info( client_class, transport_name @@ -114,7 +117,9 @@ def test_target_grpc_proxies_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.TargetGrpcProxiesRestTransport, "rest"),], + [ + (transports.TargetGrpcProxiesRestTransport, "rest"), + ], ) def test_target_grpc_proxies_client_service_account_always_use_jwt( transport_class, transport_name @@ -135,7 +140,10 @@ def test_target_grpc_proxies_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(TargetGrpcProxiesClient, "rest"),] + "client_class,transport_name", + [ + (TargetGrpcProxiesClient, "rest"), + ], ) def test_target_grpc_proxies_client_from_service_account_file( client_class, transport_name @@ -177,7 +185,9 @@ def test_target_grpc_proxies_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(TargetGrpcProxiesClient, transports.TargetGrpcProxiesRestTransport, "rest"),], + [ + (TargetGrpcProxiesClient, transports.TargetGrpcProxiesRestTransport, "rest"), + ], ) @mock.patch.object( TargetGrpcProxiesClient, @@ -470,13 +480,17 @@ def test_target_grpc_proxies_client_get_mtls_endpoint_and_cert_source(client_cla @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(TargetGrpcProxiesClient, transports.TargetGrpcProxiesRestTransport, "rest"),], + [ + (TargetGrpcProxiesClient, transports.TargetGrpcProxiesRestTransport, "rest"), + ], ) def test_target_grpc_proxies_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -524,10 +538,17 @@ def test_target_grpc_proxies_client_client_options_credentials_file( ) -@pytest.mark.parametrize("request_type", [compute.DeleteTargetGrpcProxyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteTargetGrpcProxyRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = TargetGrpcProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -637,7 +658,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["targetGrpcProxy"] == "target_grpc_proxy_value" client = TargetGrpcProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -678,7 +700,13 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "targetGrpcProxy",)) + set(("requestId",)) + & set( + ( + "project", + "targetGrpcProxy", + ) + ) ) @@ -724,7 +752,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -735,7 +767,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteTargetGrpcProxyRequest ): client = TargetGrpcProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -756,7 +789,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = TargetGrpcProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -769,7 +803,8 @@ def test_delete_unary_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", target_grpc_proxy="target_grpc_proxy_value", + project="project_value", + target_grpc_proxy="target_grpc_proxy_value", ) mock_args.update(sample_request) @@ -796,7 +831,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = TargetGrpcProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -815,10 +851,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetTargetGrpcProxyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetTargetGrpcProxyRequest, + dict, + ], +) def test_get_rest(request_type): client = TargetGrpcProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -900,7 +943,8 @@ def test_get_rest_required_fields(request_type=compute.GetTargetGrpcProxyRequest assert jsonified_request["targetGrpcProxy"] == "target_grpc_proxy_value" client = TargetGrpcProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -940,7 +984,15 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("project", "targetGrpcProxy",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "project", + "targetGrpcProxy", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -986,7 +1038,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.TargetGrpcProxy - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -996,7 +1054,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetTargetGrpcProxyRequest ): client = TargetGrpcProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1017,7 +1076,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = TargetGrpcProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1030,7 +1090,8 @@ def test_get_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", target_grpc_proxy="target_grpc_proxy_value", + project="project_value", + target_grpc_proxy="target_grpc_proxy_value", ) mock_args.update(sample_request) @@ -1057,7 +1118,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = TargetGrpcProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1076,10 +1138,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertTargetGrpcProxyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertTargetGrpcProxyRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = TargetGrpcProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1197,7 +1266,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = TargetGrpcProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1239,7 +1309,13 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "targetGrpcProxyResource",)) + set(("requestId",)) + & set( + ( + "project", + "targetGrpcProxyResource", + ) + ) ) @@ -1285,7 +1361,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1296,7 +1376,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertTargetGrpcProxyRequest ): client = TargetGrpcProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1329,7 +1410,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = TargetGrpcProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1372,7 +1454,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = TargetGrpcProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1393,10 +1476,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListTargetGrpcProxiesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListTargetGrpcProxiesRequest, + dict, + ], +) def test_list_rest(request_type): client = TargetGrpcProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1457,7 +1547,13 @@ def test_list_rest_required_fields(request_type=compute.ListTargetGrpcProxiesReq ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1466,7 +1562,8 @@ def test_list_rest_required_fields(request_type=compute.ListTargetGrpcProxiesReq assert jsonified_request["project"] == "project_value" client = TargetGrpcProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1507,7 +1604,15 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set(("project",)) ) @@ -1555,7 +1660,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.TargetGrpcProxyList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1565,7 +1676,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListTargetGrpcProxiesRequest ): client = TargetGrpcProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1586,7 +1698,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = TargetGrpcProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1598,7 +1711,9 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1624,20 +1739,23 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = TargetGrpcProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list( - compute.ListTargetGrpcProxiesRequest(), project="project_value", + compute.ListTargetGrpcProxiesRequest(), + project="project_value", ) def test_list_rest_pager(transport: str = "rest"): client = TargetGrpcProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1654,12 +1772,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.TargetGrpcProxyList(items=[], next_page_token="def",), compute.TargetGrpcProxyList( - items=[compute.TargetGrpcProxy(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.TargetGrpcProxyList( - items=[compute.TargetGrpcProxy(), compute.TargetGrpcProxy(),], + items=[ + compute.TargetGrpcProxy(), + ], + next_page_token="ghi", + ), + compute.TargetGrpcProxyList( + items=[ + compute.TargetGrpcProxy(), + compute.TargetGrpcProxy(), + ], ), ) # Two responses for two calls @@ -1686,10 +1813,17 @@ def test_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.PatchTargetGrpcProxyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.PatchTargetGrpcProxyRequest, + dict, + ], +) def test_patch_unary_rest(request_type): client = TargetGrpcProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1811,7 +1945,8 @@ def test_patch_unary_rest_required_fields( assert jsonified_request["targetGrpcProxy"] == "target_grpc_proxy_value" client = TargetGrpcProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1854,7 +1989,13 @@ def test_patch_unary_rest_unset_required_fields(): unset_fields = transport.patch._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("project", "targetGrpcProxy", "targetGrpcProxyResource",)) + & set( + ( + "project", + "targetGrpcProxy", + "targetGrpcProxyResource", + ) + ) ) @@ -1899,7 +2040,13 @@ def test_patch_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.patch_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1909,7 +2056,8 @@ def test_patch_unary_rest_bad_request( transport: str = "rest", request_type=compute.PatchTargetGrpcProxyRequest ): client = TargetGrpcProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1942,7 +2090,8 @@ def test_patch_unary_rest_bad_request( def test_patch_unary_rest_flattened(): client = TargetGrpcProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1986,7 +2135,8 @@ def test_patch_unary_rest_flattened(): def test_patch_unary_rest_flattened_error(transport: str = "rest"): client = TargetGrpcProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2015,7 +2165,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = TargetGrpcProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2035,7 +2186,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = TargetGrpcProxiesClient(client_options=options, transport=transport,) + client = TargetGrpcProxiesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2051,7 +2205,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = TargetGrpcProxiesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2065,7 +2220,10 @@ def test_transport_instance(): @pytest.mark.parametrize( - "transport_class", [transports.TargetGrpcProxiesRestTransport,] + "transport_class", + [ + transports.TargetGrpcProxiesRestTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -2121,7 +2279,8 @@ def test_target_grpc_proxies_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.TargetGrpcProxiesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2171,7 +2330,12 @@ def test_target_grpc_proxies_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_target_grpc_proxies_host_no_port(transport_name): client = TargetGrpcProxiesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2187,7 +2351,12 @@ def test_target_grpc_proxies_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_target_grpc_proxies_host_with_port(transport_name): client = TargetGrpcProxiesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2225,7 +2394,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = TargetGrpcProxiesClient.common_folder_path(folder) assert expected == actual @@ -2243,7 +2414,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = TargetGrpcProxiesClient.common_organization_path(organization) assert expected == actual @@ -2261,7 +2434,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = TargetGrpcProxiesClient.common_project_path(project) assert expected == actual @@ -2281,7 +2456,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = TargetGrpcProxiesClient.common_location_path(project, location) assert expected == actual @@ -2306,7 +2482,8 @@ def test_client_with_default_client_info(): transports.TargetGrpcProxiesTransport, "_prep_wrapped_messages" ) as prep: client = TargetGrpcProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2315,7 +2492,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = TargetGrpcProxiesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2355,7 +2533,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(TargetGrpcProxiesClient, transports.TargetGrpcProxiesRestTransport),], + [ + (TargetGrpcProxiesClient, transports.TargetGrpcProxiesRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_target_http_proxies.py b/tests/unit/gapic/compute_v1/test_target_http_proxies.py index 47a0c5130..22e08567c 100644 --- a/tests/unit/gapic/compute_v1/test_target_http_proxies.py +++ b/tests/unit/gapic/compute_v1/test_target_http_proxies.py @@ -90,7 +90,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(TargetHttpProxiesClient, "rest"),] + "client_class,transport_name", + [ + (TargetHttpProxiesClient, "rest"), + ], ) def test_target_http_proxies_client_from_service_account_info( client_class, transport_name @@ -114,7 +117,9 @@ def test_target_http_proxies_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.TargetHttpProxiesRestTransport, "rest"),], + [ + (transports.TargetHttpProxiesRestTransport, "rest"), + ], ) def test_target_http_proxies_client_service_account_always_use_jwt( transport_class, transport_name @@ -135,7 +140,10 @@ def test_target_http_proxies_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(TargetHttpProxiesClient, "rest"),] + "client_class,transport_name", + [ + (TargetHttpProxiesClient, "rest"), + ], ) def test_target_http_proxies_client_from_service_account_file( client_class, transport_name @@ -177,7 +185,9 @@ def test_target_http_proxies_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(TargetHttpProxiesClient, transports.TargetHttpProxiesRestTransport, "rest"),], + [ + (TargetHttpProxiesClient, transports.TargetHttpProxiesRestTransport, "rest"), + ], ) @mock.patch.object( TargetHttpProxiesClient, @@ -470,13 +480,17 @@ def test_target_http_proxies_client_get_mtls_endpoint_and_cert_source(client_cla @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(TargetHttpProxiesClient, transports.TargetHttpProxiesRestTransport, "rest"),], + [ + (TargetHttpProxiesClient, transports.TargetHttpProxiesRestTransport, "rest"), + ], ) def test_target_http_proxies_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -525,11 +539,16 @@ def test_target_http_proxies_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.AggregatedListTargetHttpProxiesRequest, dict,] + "request_type", + [ + compute.AggregatedListTargetHttpProxiesRequest, + dict, + ], ) def test_aggregated_list_rest(request_type): client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -610,7 +629,8 @@ def test_aggregated_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -711,7 +731,11 @@ def test_aggregated_list_rest_interceptors(null_interceptor): post.return_value = compute.TargetHttpProxyAggregatedList client.aggregated_list( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -722,7 +746,8 @@ def test_aggregated_list_rest_bad_request( transport: str = "rest", request_type=compute.AggregatedListTargetHttpProxiesRequest ): client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -743,7 +768,8 @@ def test_aggregated_list_rest_bad_request( def test_aggregated_list_rest_flattened(): client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -755,7 +781,9 @@ def test_aggregated_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -781,20 +809,23 @@ def test_aggregated_list_rest_flattened(): def test_aggregated_list_rest_flattened_error(transport: str = "rest"): client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.aggregated_list( - compute.AggregatedListTargetHttpProxiesRequest(), project="project_value", + compute.AggregatedListTargetHttpProxiesRequest(), + project="project_value", ) def test_aggregated_list_rest_pager(transport: str = "rest"): client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -811,9 +842,14 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): }, next_page_token="abc", ), - compute.TargetHttpProxyAggregatedList(items={}, next_page_token="def",), compute.TargetHttpProxyAggregatedList( - items={"g": compute.TargetHttpProxiesScopedList(),}, + items={}, + next_page_token="def", + ), + compute.TargetHttpProxyAggregatedList( + items={ + "g": compute.TargetHttpProxiesScopedList(), + }, next_page_token="ghi", ), compute.TargetHttpProxyAggregatedList( @@ -861,10 +897,17 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.DeleteTargetHttpProxyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteTargetHttpProxyRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -974,7 +1017,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["targetHttpProxy"] == "target_http_proxy_value" client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1015,7 +1059,13 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "targetHttpProxy",)) + set(("requestId",)) + & set( + ( + "project", + "targetHttpProxy", + ) + ) ) @@ -1061,7 +1111,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1072,7 +1126,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteTargetHttpProxyRequest ): client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1093,7 +1148,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1106,7 +1162,8 @@ def test_delete_unary_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", target_http_proxy="target_http_proxy_value", + project="project_value", + target_http_proxy="target_http_proxy_value", ) mock_args.update(sample_request) @@ -1133,7 +1190,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1152,10 +1210,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetTargetHttpProxyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetTargetHttpProxyRequest, + dict, + ], +) def test_get_rest(request_type): client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1237,7 +1302,8 @@ def test_get_rest_required_fields(request_type=compute.GetTargetHttpProxyRequest assert jsonified_request["targetHttpProxy"] == "target_http_proxy_value" client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1277,7 +1343,15 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("project", "targetHttpProxy",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "project", + "targetHttpProxy", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1323,7 +1397,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.TargetHttpProxy - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1333,7 +1413,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetTargetHttpProxyRequest ): client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1354,7 +1435,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1367,7 +1449,8 @@ def test_get_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", target_http_proxy="target_http_proxy_value", + project="project_value", + target_http_proxy="target_http_proxy_value", ) mock_args.update(sample_request) @@ -1394,7 +1477,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1413,10 +1497,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertTargetHttpProxyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertTargetHttpProxyRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1534,7 +1625,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1576,7 +1668,13 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "targetHttpProxyResource",)) + set(("requestId",)) + & set( + ( + "project", + "targetHttpProxyResource", + ) + ) ) @@ -1622,7 +1720,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1633,7 +1735,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertTargetHttpProxyRequest ): client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1666,7 +1769,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1709,7 +1813,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1730,10 +1835,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListTargetHttpProxiesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListTargetHttpProxiesRequest, + dict, + ], +) def test_list_rest(request_type): client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1794,7 +1906,13 @@ def test_list_rest_required_fields(request_type=compute.ListTargetHttpProxiesReq ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1803,7 +1921,8 @@ def test_list_rest_required_fields(request_type=compute.ListTargetHttpProxiesReq assert jsonified_request["project"] == "project_value" client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1844,7 +1963,15 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set(("project",)) ) @@ -1892,7 +2019,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.TargetHttpProxyList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1902,7 +2035,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListTargetHttpProxiesRequest ): client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1923,7 +2057,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1935,7 +2070,9 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1961,20 +2098,23 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list( - compute.ListTargetHttpProxiesRequest(), project="project_value", + compute.ListTargetHttpProxiesRequest(), + project="project_value", ) def test_list_rest_pager(transport: str = "rest"): client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1991,12 +2131,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.TargetHttpProxyList(items=[], next_page_token="def",), compute.TargetHttpProxyList( - items=[compute.TargetHttpProxy(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.TargetHttpProxyList( - items=[compute.TargetHttpProxy(), compute.TargetHttpProxy(),], + items=[ + compute.TargetHttpProxy(), + ], + next_page_token="ghi", + ), + compute.TargetHttpProxyList( + items=[ + compute.TargetHttpProxy(), + compute.TargetHttpProxy(), + ], ), ) # Two responses for two calls @@ -2023,10 +2172,17 @@ def test_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.PatchTargetHttpProxyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.PatchTargetHttpProxyRequest, + dict, + ], +) def test_patch_unary_rest(request_type): client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2148,7 +2304,8 @@ def test_patch_unary_rest_required_fields( assert jsonified_request["targetHttpProxy"] == "target_http_proxy_value" client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2191,7 +2348,13 @@ def test_patch_unary_rest_unset_required_fields(): unset_fields = transport.patch._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("project", "targetHttpProxy", "targetHttpProxyResource",)) + & set( + ( + "project", + "targetHttpProxy", + "targetHttpProxyResource", + ) + ) ) @@ -2236,7 +2399,13 @@ def test_patch_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.patch_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2246,7 +2415,8 @@ def test_patch_unary_rest_bad_request( transport: str = "rest", request_type=compute.PatchTargetHttpProxyRequest ): client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2279,7 +2449,8 @@ def test_patch_unary_rest_bad_request( def test_patch_unary_rest_flattened(): client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2323,7 +2494,8 @@ def test_patch_unary_rest_flattened(): def test_patch_unary_rest_flattened_error(transport: str = "rest"): client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2346,11 +2518,16 @@ def test_patch_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SetUrlMapTargetHttpProxyRequest, dict,] + "request_type", + [ + compute.SetUrlMapTargetHttpProxyRequest, + dict, + ], ) def test_set_url_map_unary_rest(request_type): client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2461,7 +2638,8 @@ def test_set_url_map_unary_rest_required_fields( assert jsonified_request["targetHttpProxy"] == "target_http_proxy_value" client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2504,7 +2682,13 @@ def test_set_url_map_unary_rest_unset_required_fields(): unset_fields = transport.set_url_map._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("project", "targetHttpProxy", "urlMapReferenceResource",)) + & set( + ( + "project", + "targetHttpProxy", + "urlMapReferenceResource", + ) + ) ) @@ -2550,7 +2734,11 @@ def test_set_url_map_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_url_map_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2561,7 +2749,8 @@ def test_set_url_map_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetUrlMapTargetHttpProxyRequest ): client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2583,7 +2772,8 @@ def test_set_url_map_unary_rest_bad_request( def test_set_url_map_unary_rest_flattened(): client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2625,7 +2815,8 @@ def test_set_url_map_unary_rest_flattened(): def test_set_url_map_unary_rest_flattened_error(transport: str = "rest"): client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2652,7 +2843,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2672,7 +2864,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = TargetHttpProxiesClient(client_options=options, transport=transport,) + client = TargetHttpProxiesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2688,7 +2883,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = TargetHttpProxiesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2702,7 +2898,10 @@ def test_transport_instance(): @pytest.mark.parametrize( - "transport_class", [transports.TargetHttpProxiesRestTransport,] + "transport_class", + [ + transports.TargetHttpProxiesRestTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -2760,7 +2959,8 @@ def test_target_http_proxies_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.TargetHttpProxiesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2810,7 +3010,12 @@ def test_target_http_proxies_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_target_http_proxies_host_no_port(transport_name): client = TargetHttpProxiesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2826,7 +3031,12 @@ def test_target_http_proxies_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_target_http_proxies_host_with_port(transport_name): client = TargetHttpProxiesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2864,7 +3074,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = TargetHttpProxiesClient.common_folder_path(folder) assert expected == actual @@ -2882,7 +3094,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = TargetHttpProxiesClient.common_organization_path(organization) assert expected == actual @@ -2900,7 +3114,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = TargetHttpProxiesClient.common_project_path(project) assert expected == actual @@ -2920,7 +3136,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = TargetHttpProxiesClient.common_location_path(project, location) assert expected == actual @@ -2945,7 +3162,8 @@ def test_client_with_default_client_info(): transports.TargetHttpProxiesTransport, "_prep_wrapped_messages" ) as prep: client = TargetHttpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2954,7 +3172,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = TargetHttpProxiesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2994,7 +3213,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(TargetHttpProxiesClient, transports.TargetHttpProxiesRestTransport),], + [ + (TargetHttpProxiesClient, transports.TargetHttpProxiesRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_target_https_proxies.py b/tests/unit/gapic/compute_v1/test_target_https_proxies.py index c277a5818..3cd2742bb 100644 --- a/tests/unit/gapic/compute_v1/test_target_https_proxies.py +++ b/tests/unit/gapic/compute_v1/test_target_https_proxies.py @@ -92,7 +92,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(TargetHttpsProxiesClient, "rest"),] + "client_class,transport_name", + [ + (TargetHttpsProxiesClient, "rest"), + ], ) def test_target_https_proxies_client_from_service_account_info( client_class, transport_name @@ -116,7 +119,9 @@ def test_target_https_proxies_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.TargetHttpsProxiesRestTransport, "rest"),], + [ + (transports.TargetHttpsProxiesRestTransport, "rest"), + ], ) def test_target_https_proxies_client_service_account_always_use_jwt( transport_class, transport_name @@ -137,7 +142,10 @@ def test_target_https_proxies_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(TargetHttpsProxiesClient, "rest"),] + "client_class,transport_name", + [ + (TargetHttpsProxiesClient, "rest"), + ], ) def test_target_https_proxies_client_from_service_account_file( client_class, transport_name @@ -179,7 +187,9 @@ def test_target_https_proxies_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(TargetHttpsProxiesClient, transports.TargetHttpsProxiesRestTransport, "rest"),], + [ + (TargetHttpsProxiesClient, transports.TargetHttpsProxiesRestTransport, "rest"), + ], ) @mock.patch.object( TargetHttpsProxiesClient, @@ -472,13 +482,17 @@ def test_target_https_proxies_client_get_mtls_endpoint_and_cert_source(client_cl @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(TargetHttpsProxiesClient, transports.TargetHttpsProxiesRestTransport, "rest"),], + [ + (TargetHttpsProxiesClient, transports.TargetHttpsProxiesRestTransport, "rest"), + ], ) def test_target_https_proxies_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -527,11 +541,16 @@ def test_target_https_proxies_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.AggregatedListTargetHttpsProxiesRequest, dict,] + "request_type", + [ + compute.AggregatedListTargetHttpsProxiesRequest, + dict, + ], ) def test_aggregated_list_rest(request_type): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -612,7 +631,8 @@ def test_aggregated_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -713,7 +733,11 @@ def test_aggregated_list_rest_interceptors(null_interceptor): post.return_value = compute.TargetHttpsProxyAggregatedList client.aggregated_list( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -725,7 +749,8 @@ def test_aggregated_list_rest_bad_request( request_type=compute.AggregatedListTargetHttpsProxiesRequest, ): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -746,7 +771,8 @@ def test_aggregated_list_rest_bad_request( def test_aggregated_list_rest_flattened(): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -758,7 +784,9 @@ def test_aggregated_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -784,20 +812,23 @@ def test_aggregated_list_rest_flattened(): def test_aggregated_list_rest_flattened_error(transport: str = "rest"): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.aggregated_list( - compute.AggregatedListTargetHttpsProxiesRequest(), project="project_value", + compute.AggregatedListTargetHttpsProxiesRequest(), + project="project_value", ) def test_aggregated_list_rest_pager(transport: str = "rest"): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -814,9 +845,14 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): }, next_page_token="abc", ), - compute.TargetHttpsProxyAggregatedList(items={}, next_page_token="def",), compute.TargetHttpsProxyAggregatedList( - items={"g": compute.TargetHttpsProxiesScopedList(),}, + items={}, + next_page_token="def", + ), + compute.TargetHttpsProxyAggregatedList( + items={ + "g": compute.TargetHttpsProxiesScopedList(), + }, next_page_token="ghi", ), compute.TargetHttpsProxyAggregatedList( @@ -864,10 +900,17 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.DeleteTargetHttpsProxyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteTargetHttpsProxyRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -977,7 +1020,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["targetHttpsProxy"] == "target_https_proxy_value" client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1018,7 +1062,13 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "targetHttpsProxy",)) + set(("requestId",)) + & set( + ( + "project", + "targetHttpsProxy", + ) + ) ) @@ -1064,7 +1114,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1075,7 +1129,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteTargetHttpsProxyRequest ): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1096,7 +1151,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1109,7 +1165,8 @@ def test_delete_unary_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", target_https_proxy="target_https_proxy_value", + project="project_value", + target_https_proxy="target_https_proxy_value", ) mock_args.update(sample_request) @@ -1136,7 +1193,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1155,10 +1213,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetTargetHttpsProxyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetTargetHttpsProxyRequest, + dict, + ], +) def test_get_rest(request_type): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1250,7 +1315,8 @@ def test_get_rest_required_fields(request_type=compute.GetTargetHttpsProxyReques assert jsonified_request["targetHttpsProxy"] == "target_https_proxy_value" client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1290,7 +1356,15 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("project", "targetHttpsProxy",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "project", + "targetHttpsProxy", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1336,7 +1410,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.TargetHttpsProxy - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1346,7 +1426,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetTargetHttpsProxyRequest ): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1367,7 +1448,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1380,7 +1462,8 @@ def test_get_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", target_https_proxy="target_https_proxy_value", + project="project_value", + target_https_proxy="target_https_proxy_value", ) mock_args.update(sample_request) @@ -1407,7 +1490,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1426,10 +1510,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertTargetHttpsProxyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertTargetHttpsProxyRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1552,7 +1643,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1594,7 +1686,13 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "targetHttpsProxyResource",)) + set(("requestId",)) + & set( + ( + "project", + "targetHttpsProxyResource", + ) + ) ) @@ -1640,7 +1738,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1651,7 +1753,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertTargetHttpsProxyRequest ): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1689,7 +1792,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1732,7 +1836,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1753,10 +1858,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListTargetHttpsProxiesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListTargetHttpsProxiesRequest, + dict, + ], +) def test_list_rest(request_type): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1817,7 +1929,13 @@ def test_list_rest_required_fields(request_type=compute.ListTargetHttpsProxiesRe ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1826,7 +1944,8 @@ def test_list_rest_required_fields(request_type=compute.ListTargetHttpsProxiesRe assert jsonified_request["project"] == "project_value" client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1867,7 +1986,15 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set(("project",)) ) @@ -1915,7 +2042,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.TargetHttpsProxyList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1925,7 +2058,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListTargetHttpsProxiesRequest ): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1946,7 +2080,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1958,7 +2093,9 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1984,20 +2121,23 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list( - compute.ListTargetHttpsProxiesRequest(), project="project_value", + compute.ListTargetHttpsProxiesRequest(), + project="project_value", ) def test_list_rest_pager(transport: str = "rest"): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2014,12 +2154,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.TargetHttpsProxyList(items=[], next_page_token="def",), compute.TargetHttpsProxyList( - items=[compute.TargetHttpsProxy(),], next_page_token="ghi", + items=[], + next_page_token="def", + ), + compute.TargetHttpsProxyList( + items=[ + compute.TargetHttpsProxy(), + ], + next_page_token="ghi", ), compute.TargetHttpsProxyList( - items=[compute.TargetHttpsProxy(), compute.TargetHttpsProxy(),], + items=[ + compute.TargetHttpsProxy(), + compute.TargetHttpsProxy(), + ], ), ) # Two responses for two calls @@ -2046,10 +2195,17 @@ def test_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.PatchTargetHttpsProxyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.PatchTargetHttpsProxyRequest, + dict, + ], +) def test_patch_unary_rest(request_type): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2176,7 +2332,8 @@ def test_patch_unary_rest_required_fields( assert jsonified_request["targetHttpsProxy"] == "target_https_proxy_value" client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2219,7 +2376,13 @@ def test_patch_unary_rest_unset_required_fields(): unset_fields = transport.patch._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("project", "targetHttpsProxy", "targetHttpsProxyResource",)) + & set( + ( + "project", + "targetHttpsProxy", + "targetHttpsProxyResource", + ) + ) ) @@ -2264,7 +2427,13 @@ def test_patch_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.patch_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2274,7 +2443,8 @@ def test_patch_unary_rest_bad_request( transport: str = "rest", request_type=compute.PatchTargetHttpsProxyRequest ): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2312,7 +2482,8 @@ def test_patch_unary_rest_bad_request( def test_patch_unary_rest_flattened(): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2356,7 +2527,8 @@ def test_patch_unary_rest_flattened(): def test_patch_unary_rest_flattened_error(transport: str = "rest"): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2379,11 +2551,16 @@ def test_patch_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SetQuicOverrideTargetHttpsProxyRequest, dict,] + "request_type", + [ + compute.SetQuicOverrideTargetHttpsProxyRequest, + dict, + ], ) def test_set_quic_override_unary_rest(request_type): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2496,7 +2673,8 @@ def test_set_quic_override_unary_rest_required_fields( assert jsonified_request["targetHttpsProxy"] == "target_https_proxy_value" client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2591,7 +2769,11 @@ def test_set_quic_override_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_quic_override_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2602,7 +2784,8 @@ def test_set_quic_override_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetQuicOverrideTargetHttpsProxyRequest ): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2626,7 +2809,8 @@ def test_set_quic_override_unary_rest_bad_request( def test_set_quic_override_unary_rest_flattened(): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2670,7 +2854,8 @@ def test_set_quic_override_unary_rest_flattened(): def test_set_quic_override_unary_rest_flattened_error(transport: str = "rest"): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2693,11 +2878,16 @@ def test_set_quic_override_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SetSslCertificatesTargetHttpsProxyRequest, dict,] + "request_type", + [ + compute.SetSslCertificatesTargetHttpsProxyRequest, + dict, + ], ) def test_set_ssl_certificates_unary_rest(request_type): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2810,7 +3000,8 @@ def test_set_ssl_certificates_unary_rest_required_fields( assert jsonified_request["targetHttpsProxy"] == "target_https_proxy_value" client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2905,7 +3096,11 @@ def test_set_ssl_certificates_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_ssl_certificates_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2917,7 +3112,8 @@ def test_set_ssl_certificates_unary_rest_bad_request( request_type=compute.SetSslCertificatesTargetHttpsProxyRequest, ): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2941,7 +3137,8 @@ def test_set_ssl_certificates_unary_rest_bad_request( def test_set_ssl_certificates_unary_rest_flattened(): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2985,7 +3182,8 @@ def test_set_ssl_certificates_unary_rest_flattened(): def test_set_ssl_certificates_unary_rest_flattened_error(transport: str = "rest"): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3008,11 +3206,16 @@ def test_set_ssl_certificates_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SetSslPolicyTargetHttpsProxyRequest, dict,] + "request_type", + [ + compute.SetSslPolicyTargetHttpsProxyRequest, + dict, + ], ) def test_set_ssl_policy_unary_rest(request_type): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3123,7 +3326,8 @@ def test_set_ssl_policy_unary_rest_required_fields( assert jsonified_request["targetHttpsProxy"] == "target_https_proxy_value" client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3166,7 +3370,13 @@ def test_set_ssl_policy_unary_rest_unset_required_fields(): unset_fields = transport.set_ssl_policy._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("project", "sslPolicyReferenceResource", "targetHttpsProxy",)) + & set( + ( + "project", + "sslPolicyReferenceResource", + "targetHttpsProxy", + ) + ) ) @@ -3212,7 +3422,11 @@ def test_set_ssl_policy_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_ssl_policy_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3223,7 +3437,8 @@ def test_set_ssl_policy_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetSslPolicyTargetHttpsProxyRequest ): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3245,7 +3460,8 @@ def test_set_ssl_policy_unary_rest_bad_request( def test_set_ssl_policy_unary_rest_flattened(): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3289,7 +3505,8 @@ def test_set_ssl_policy_unary_rest_flattened(): def test_set_ssl_policy_unary_rest_flattened_error(transport: str = "rest"): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3312,11 +3529,16 @@ def test_set_ssl_policy_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SetUrlMapTargetHttpsProxyRequest, dict,] + "request_type", + [ + compute.SetUrlMapTargetHttpsProxyRequest, + dict, + ], ) def test_set_url_map_unary_rest(request_type): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3427,7 +3649,8 @@ def test_set_url_map_unary_rest_required_fields( assert jsonified_request["targetHttpsProxy"] == "target_https_proxy_value" client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3470,7 +3693,13 @@ def test_set_url_map_unary_rest_unset_required_fields(): unset_fields = transport.set_url_map._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("project", "targetHttpsProxy", "urlMapReferenceResource",)) + & set( + ( + "project", + "targetHttpsProxy", + "urlMapReferenceResource", + ) + ) ) @@ -3516,7 +3745,11 @@ def test_set_url_map_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_url_map_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3527,7 +3760,8 @@ def test_set_url_map_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetUrlMapTargetHttpsProxyRequest ): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3549,7 +3783,8 @@ def test_set_url_map_unary_rest_bad_request( def test_set_url_map_unary_rest_flattened(): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3591,7 +3826,8 @@ def test_set_url_map_unary_rest_flattened(): def test_set_url_map_unary_rest_flattened_error(transport: str = "rest"): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3618,7 +3854,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -3638,7 +3875,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = TargetHttpsProxiesClient(client_options=options, transport=transport,) + client = TargetHttpsProxiesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -3654,7 +3894,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = TargetHttpsProxiesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -3668,7 +3909,10 @@ def test_transport_instance(): @pytest.mark.parametrize( - "transport_class", [transports.TargetHttpsProxiesRestTransport,] + "transport_class", + [ + transports.TargetHttpsProxiesRestTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -3729,7 +3973,8 @@ def test_target_https_proxies_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.TargetHttpsProxiesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -3779,7 +4024,12 @@ def test_target_https_proxies_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_target_https_proxies_host_no_port(transport_name): client = TargetHttpsProxiesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3795,7 +4045,12 @@ def test_target_https_proxies_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_target_https_proxies_host_with_port(transport_name): client = TargetHttpsProxiesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3833,7 +4088,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = TargetHttpsProxiesClient.common_folder_path(folder) assert expected == actual @@ -3851,7 +4108,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = TargetHttpsProxiesClient.common_organization_path(organization) assert expected == actual @@ -3869,7 +4128,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = TargetHttpsProxiesClient.common_project_path(project) assert expected == actual @@ -3889,7 +4150,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = TargetHttpsProxiesClient.common_location_path(project, location) assert expected == actual @@ -3914,7 +4176,8 @@ def test_client_with_default_client_info(): transports.TargetHttpsProxiesTransport, "_prep_wrapped_messages" ) as prep: client = TargetHttpsProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3923,7 +4186,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = TargetHttpsProxiesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3963,7 +4227,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(TargetHttpsProxiesClient, transports.TargetHttpsProxiesRestTransport),], + [ + (TargetHttpsProxiesClient, transports.TargetHttpsProxiesRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_target_instances.py b/tests/unit/gapic/compute_v1/test_target_instances.py index fa0b8ae12..fa4aad661 100644 --- a/tests/unit/gapic/compute_v1/test_target_instances.py +++ b/tests/unit/gapic/compute_v1/test_target_instances.py @@ -89,7 +89,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(TargetInstancesClient, "rest"),] + "client_class,transport_name", + [ + (TargetInstancesClient, "rest"), + ], ) def test_target_instances_client_from_service_account_info( client_class, transport_name @@ -113,7 +116,9 @@ def test_target_instances_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.TargetInstancesRestTransport, "rest"),], + [ + (transports.TargetInstancesRestTransport, "rest"), + ], ) def test_target_instances_client_service_account_always_use_jwt( transport_class, transport_name @@ -134,7 +139,10 @@ def test_target_instances_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(TargetInstancesClient, "rest"),] + "client_class,transport_name", + [ + (TargetInstancesClient, "rest"), + ], ) def test_target_instances_client_from_service_account_file( client_class, transport_name @@ -176,7 +184,9 @@ def test_target_instances_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(TargetInstancesClient, transports.TargetInstancesRestTransport, "rest"),], + [ + (TargetInstancesClient, transports.TargetInstancesRestTransport, "rest"), + ], ) @mock.patch.object( TargetInstancesClient, @@ -469,13 +479,17 @@ def test_target_instances_client_get_mtls_endpoint_and_cert_source(client_class) @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(TargetInstancesClient, transports.TargetInstancesRestTransport, "rest"),], + [ + (TargetInstancesClient, transports.TargetInstancesRestTransport, "rest"), + ], ) def test_target_instances_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -493,7 +507,9 @@ def test_target_instances_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(TargetInstancesClient, transports.TargetInstancesRestTransport, "rest", None),], + [ + (TargetInstancesClient, transports.TargetInstancesRestTransport, "rest", None), + ], ) def test_target_instances_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -517,11 +533,16 @@ def test_target_instances_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.AggregatedListTargetInstancesRequest, dict,] + "request_type", + [ + compute.AggregatedListTargetInstancesRequest, + dict, + ], ) def test_aggregated_list_rest(request_type): client = TargetInstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -602,7 +623,8 @@ def test_aggregated_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = TargetInstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -703,7 +725,11 @@ def test_aggregated_list_rest_interceptors(null_interceptor): post.return_value = compute.TargetInstanceAggregatedList client.aggregated_list( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -714,7 +740,8 @@ def test_aggregated_list_rest_bad_request( transport: str = "rest", request_type=compute.AggregatedListTargetInstancesRequest ): client = TargetInstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -735,7 +762,8 @@ def test_aggregated_list_rest_bad_request( def test_aggregated_list_rest_flattened(): client = TargetInstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -747,7 +775,9 @@ def test_aggregated_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -773,20 +803,23 @@ def test_aggregated_list_rest_flattened(): def test_aggregated_list_rest_flattened_error(transport: str = "rest"): client = TargetInstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.aggregated_list( - compute.AggregatedListTargetInstancesRequest(), project="project_value", + compute.AggregatedListTargetInstancesRequest(), + project="project_value", ) def test_aggregated_list_rest_pager(transport: str = "rest"): client = TargetInstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -803,9 +836,14 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): }, next_page_token="abc", ), - compute.TargetInstanceAggregatedList(items={}, next_page_token="def",), compute.TargetInstanceAggregatedList( - items={"g": compute.TargetInstancesScopedList(),}, + items={}, + next_page_token="def", + ), + compute.TargetInstanceAggregatedList( + items={ + "g": compute.TargetInstancesScopedList(), + }, next_page_token="ghi", ), compute.TargetInstanceAggregatedList( @@ -853,10 +891,17 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.DeleteTargetInstanceRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteTargetInstanceRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = TargetInstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -974,7 +1019,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = TargetInstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1015,7 +1061,14 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "targetInstance", "zone",)) + set(("requestId",)) + & set( + ( + "project", + "targetInstance", + "zone", + ) + ) ) @@ -1061,7 +1114,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1072,7 +1129,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteTargetInstanceRequest ): client = TargetInstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1097,7 +1155,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = TargetInstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1143,7 +1202,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = TargetInstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1163,10 +1223,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetTargetInstanceRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetTargetInstanceRequest, + dict, + ], +) def test_get_rest(request_type): client = TargetInstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1256,7 +1323,8 @@ def test_get_rest_required_fields(request_type=compute.GetTargetInstanceRequest) assert jsonified_request["zone"] == "zone_value" client = TargetInstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1296,7 +1364,16 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("project", "targetInstance", "zone",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "project", + "targetInstance", + "zone", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1342,7 +1419,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.TargetInstance - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1352,7 +1435,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetTargetInstanceRequest ): client = TargetInstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1377,7 +1461,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = TargetInstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1423,7 +1508,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = TargetInstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1443,10 +1529,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertTargetInstanceRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertTargetInstanceRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = TargetInstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1568,7 +1661,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["zone"] == "zone_value" client = TargetInstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1610,7 +1704,14 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "targetInstanceResource", "zone",)) + set(("requestId",)) + & set( + ( + "project", + "targetInstanceResource", + "zone", + ) + ) ) @@ -1656,7 +1757,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1667,7 +1772,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertTargetInstanceRequest ): client = TargetInstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1700,7 +1806,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = TargetInstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1744,7 +1851,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = TargetInstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1766,10 +1874,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListTargetInstancesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListTargetInstancesRequest, + dict, + ], +) def test_list_rest(request_type): client = TargetInstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1832,7 +1947,13 @@ def test_list_rest_required_fields(request_type=compute.ListTargetInstancesReque ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1843,7 +1964,8 @@ def test_list_rest_required_fields(request_type=compute.ListTargetInstancesReque assert jsonified_request["zone"] == "zone_value" client = TargetInstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1884,8 +2006,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "zone",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "zone", + ) + ) ) @@ -1932,7 +2067,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.TargetInstanceList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1942,7 +2083,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListTargetInstancesRequest ): client = TargetInstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1963,7 +2105,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = TargetInstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1975,7 +2118,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "zone": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", zone="zone_value",) + mock_args = dict( + project="project_value", + zone="zone_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2001,7 +2147,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = TargetInstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2016,7 +2163,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = TargetInstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2033,12 +2181,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.TargetInstanceList(items=[], next_page_token="def",), compute.TargetInstanceList( - items=[compute.TargetInstance(),], next_page_token="ghi", + items=[], + next_page_token="def", + ), + compute.TargetInstanceList( + items=[ + compute.TargetInstance(), + ], + next_page_token="ghi", ), compute.TargetInstanceList( - items=[compute.TargetInstance(), compute.TargetInstance(),], + items=[ + compute.TargetInstance(), + compute.TargetInstance(), + ], ), ) # Two responses for two calls @@ -2072,7 +2229,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = TargetInstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2092,7 +2250,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = TargetInstancesClient(client_options=options, transport=transport,) + client = TargetInstancesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2108,7 +2269,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = TargetInstancesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2121,7 +2283,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.TargetInstancesRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.TargetInstancesRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -2176,7 +2343,8 @@ def test_target_instances_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.TargetInstancesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2226,7 +2394,12 @@ def test_target_instances_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_target_instances_host_no_port(transport_name): client = TargetInstancesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2242,7 +2415,12 @@ def test_target_instances_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_target_instances_host_with_port(transport_name): client = TargetInstancesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2280,7 +2458,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = TargetInstancesClient.common_folder_path(folder) assert expected == actual @@ -2298,7 +2478,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = TargetInstancesClient.common_organization_path(organization) assert expected == actual @@ -2316,7 +2498,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = TargetInstancesClient.common_project_path(project) assert expected == actual @@ -2336,7 +2520,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = TargetInstancesClient.common_location_path(project, location) assert expected == actual @@ -2361,7 +2546,8 @@ def test_client_with_default_client_info(): transports.TargetInstancesTransport, "_prep_wrapped_messages" ) as prep: client = TargetInstancesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2370,7 +2556,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = TargetInstancesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2410,7 +2597,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(TargetInstancesClient, transports.TargetInstancesRestTransport),], + [ + (TargetInstancesClient, transports.TargetInstancesRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_target_pools.py b/tests/unit/gapic/compute_v1/test_target_pools.py index a94e54154..d26db5679 100644 --- a/tests/unit/gapic/compute_v1/test_target_pools.py +++ b/tests/unit/gapic/compute_v1/test_target_pools.py @@ -85,7 +85,12 @@ def test__get_default_mtls_endpoint(): assert TargetPoolsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class,transport_name", [(TargetPoolsClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (TargetPoolsClient, "rest"), + ], +) def test_target_pools_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -105,7 +110,10 @@ def test_target_pools_client_from_service_account_info(client_class, transport_n @pytest.mark.parametrize( - "transport_class,transport_name", [(transports.TargetPoolsRestTransport, "rest"),] + "transport_class,transport_name", + [ + (transports.TargetPoolsRestTransport, "rest"), + ], ) def test_target_pools_client_service_account_always_use_jwt( transport_class, transport_name @@ -125,7 +133,12 @@ def test_target_pools_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class,transport_name", [(TargetPoolsClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (TargetPoolsClient, "rest"), + ], +) def test_target_pools_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -164,7 +177,9 @@ def test_target_pools_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(TargetPoolsClient, transports.TargetPoolsRestTransport, "rest"),], + [ + (TargetPoolsClient, transports.TargetPoolsRestTransport, "rest"), + ], ) @mock.patch.object( TargetPoolsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(TargetPoolsClient) @@ -441,13 +456,17 @@ def test_target_pools_client_get_mtls_endpoint_and_cert_source(client_class): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(TargetPoolsClient, transports.TargetPoolsRestTransport, "rest"),], + [ + (TargetPoolsClient, transports.TargetPoolsRestTransport, "rest"), + ], ) def test_target_pools_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -465,7 +484,9 @@ def test_target_pools_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(TargetPoolsClient, transports.TargetPoolsRestTransport, "rest", None),], + [ + (TargetPoolsClient, transports.TargetPoolsRestTransport, "rest", None), + ], ) def test_target_pools_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -489,11 +510,16 @@ def test_target_pools_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.AddHealthCheckTargetPoolRequest, dict,] + "request_type", + [ + compute.AddHealthCheckTargetPoolRequest, + dict, + ], ) def test_add_health_check_unary_rest(request_type): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -610,7 +636,8 @@ def test_add_health_check_unary_rest_required_fields( assert jsonified_request["targetPool"] == "target_pool_value" client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -706,7 +733,11 @@ def test_add_health_check_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.add_health_check_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -717,7 +748,8 @@ def test_add_health_check_unary_rest_bad_request( transport: str = "rest", request_type=compute.AddHealthCheckTargetPoolRequest ): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -741,7 +773,8 @@ def test_add_health_check_unary_rest_bad_request( def test_add_health_check_unary_rest_flattened(): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -792,7 +825,8 @@ def test_add_health_check_unary_rest_flattened(): def test_add_health_check_unary_rest_flattened_error(transport: str = "rest"): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -817,10 +851,17 @@ def test_add_health_check_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.AddInstanceTargetPoolRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.AddInstanceTargetPoolRequest, + dict, + ], +) def test_add_instance_unary_rest(request_type): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -937,7 +978,8 @@ def test_add_instance_unary_rest_required_fields( assert jsonified_request["targetPool"] == "target_pool_value" client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1033,7 +1075,11 @@ def test_add_instance_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.add_instance_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1044,7 +1090,8 @@ def test_add_instance_unary_rest_bad_request( transport: str = "rest", request_type=compute.AddInstanceTargetPoolRequest ): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1068,7 +1115,8 @@ def test_add_instance_unary_rest_bad_request( def test_add_instance_unary_rest_flattened(): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1117,7 +1165,8 @@ def test_add_instance_unary_rest_flattened(): def test_add_instance_unary_rest_flattened_error(transport: str = "rest"): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1141,11 +1190,16 @@ def test_add_instance_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.AggregatedListTargetPoolsRequest, dict,] + "request_type", + [ + compute.AggregatedListTargetPoolsRequest, + dict, + ], ) def test_aggregated_list_rest(request_type): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1226,7 +1280,8 @@ def test_aggregated_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1325,7 +1380,11 @@ def test_aggregated_list_rest_interceptors(null_interceptor): post.return_value = compute.TargetPoolAggregatedList client.aggregated_list( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1336,7 +1395,8 @@ def test_aggregated_list_rest_bad_request( transport: str = "rest", request_type=compute.AggregatedListTargetPoolsRequest ): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1357,7 +1417,8 @@ def test_aggregated_list_rest_bad_request( def test_aggregated_list_rest_flattened(): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1369,7 +1430,9 @@ def test_aggregated_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1395,20 +1458,23 @@ def test_aggregated_list_rest_flattened(): def test_aggregated_list_rest_flattened_error(transport: str = "rest"): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.aggregated_list( - compute.AggregatedListTargetPoolsRequest(), project="project_value", + compute.AggregatedListTargetPoolsRequest(), + project="project_value", ) def test_aggregated_list_rest_pager(transport: str = "rest"): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1425,9 +1491,15 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): }, next_page_token="abc", ), - compute.TargetPoolAggregatedList(items={}, next_page_token="def",), compute.TargetPoolAggregatedList( - items={"g": compute.TargetPoolsScopedList(),}, next_page_token="ghi", + items={}, + next_page_token="def", + ), + compute.TargetPoolAggregatedList( + items={ + "g": compute.TargetPoolsScopedList(), + }, + next_page_token="ghi", ), compute.TargetPoolAggregatedList( items={ @@ -1472,10 +1544,17 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.DeleteTargetPoolRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteTargetPoolRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1589,7 +1668,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["targetPool"] == "target_pool_value" client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1630,7 +1710,14 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "region", "targetPool",)) + set(("requestId",)) + & set( + ( + "project", + "region", + "targetPool", + ) + ) ) @@ -1676,7 +1763,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1687,7 +1778,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteTargetPoolRequest ): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1708,7 +1800,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1754,7 +1847,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1774,10 +1868,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetTargetPoolRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetTargetPoolRequest, + dict, + ], +) def test_get_rest(request_type): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1867,7 +1968,8 @@ def test_get_rest_required_fields(request_type=compute.GetTargetPoolRequest): assert jsonified_request["targetPool"] == "target_pool_value" client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1907,7 +2009,16 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("project", "region", "targetPool",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "project", + "region", + "targetPool", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1951,7 +2062,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.TargetPool - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1961,7 +2078,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetTargetPoolRequest ): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1982,7 +2100,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2028,7 +2147,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2048,10 +2168,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetHealthTargetPoolRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetHealthTargetPoolRequest, + dict, + ], +) def test_get_health_rest(request_type): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2062,7 +2189,9 @@ def test_get_health_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = compute.TargetPoolInstanceHealth(kind="kind_value",) + return_value = compute.TargetPoolInstanceHealth( + kind="kind_value", + ) # Wrap the value into a proper Response obj response_value = Response() @@ -2120,7 +2249,8 @@ def test_get_health_rest_required_fields( assert jsonified_request["targetPool"] == "target_pool_value" client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2162,7 +2292,15 @@ def test_get_health_rest_unset_required_fields(): unset_fields = transport.get_health._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("instanceReferenceResource", "project", "region", "targetPool",)) + set(()) + & set( + ( + "instanceReferenceResource", + "project", + "region", + "targetPool", + ) + ) ) @@ -2209,7 +2347,13 @@ def test_get_health_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.TargetPoolInstanceHealth - client.get_health(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get_health( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2219,7 +2363,8 @@ def test_get_health_rest_bad_request( transport: str = "rest", request_type=compute.GetHealthTargetPoolRequest ): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2241,7 +2386,8 @@ def test_get_health_rest_bad_request( def test_get_health_rest_flattened(): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2290,7 +2436,8 @@ def test_get_health_rest_flattened(): def test_get_health_rest_flattened_error(transport: str = "rest"): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2313,10 +2460,17 @@ def test_get_health_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertTargetPoolRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertTargetPoolRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2440,7 +2594,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2482,7 +2637,14 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "region", "targetPoolResource",)) + set(("requestId",)) + & set( + ( + "project", + "region", + "targetPoolResource", + ) + ) ) @@ -2528,7 +2690,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2539,7 +2705,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertTargetPoolRequest ): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2574,7 +2741,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2616,7 +2784,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2636,10 +2805,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListTargetPoolsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListTargetPoolsRequest, + dict, + ], +) def test_list_rest(request_type): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2702,7 +2878,13 @@ def test_list_rest_required_fields(request_type=compute.ListTargetPoolsRequest): ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -2713,7 +2895,8 @@ def test_list_rest_required_fields(request_type=compute.ListTargetPoolsRequest): assert jsonified_request["region"] == "region_value" client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2754,8 +2937,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "region",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "region", + ) + ) ) @@ -2802,7 +2998,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.TargetPoolList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2812,7 +3014,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListTargetPoolsRequest ): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2833,7 +3036,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2845,7 +3049,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "region": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", region="region_value",) + mock_args = dict( + project="project_value", + region="region_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2871,7 +3078,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2886,7 +3094,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2903,12 +3112,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.TargetPoolList(items=[], next_page_token="def",), compute.TargetPoolList( - items=[compute.TargetPool(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.TargetPoolList( - items=[compute.TargetPool(), compute.TargetPool(),], + items=[ + compute.TargetPool(), + ], + next_page_token="ghi", + ), + compute.TargetPoolList( + items=[ + compute.TargetPool(), + compute.TargetPool(), + ], ), ) # Two responses for two calls @@ -2936,11 +3154,16 @@ def test_list_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.RemoveHealthCheckTargetPoolRequest, dict,] + "request_type", + [ + compute.RemoveHealthCheckTargetPoolRequest, + dict, + ], ) def test_remove_health_check_unary_rest(request_type): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3057,7 +3280,8 @@ def test_remove_health_check_unary_rest_required_fields( assert jsonified_request["targetPool"] == "target_pool_value" client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3153,7 +3377,11 @@ def test_remove_health_check_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.remove_health_check_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3164,7 +3392,8 @@ def test_remove_health_check_unary_rest_bad_request( transport: str = "rest", request_type=compute.RemoveHealthCheckTargetPoolRequest ): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3188,7 +3417,8 @@ def test_remove_health_check_unary_rest_bad_request( def test_remove_health_check_unary_rest_flattened(): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3239,7 +3469,8 @@ def test_remove_health_check_unary_rest_flattened(): def test_remove_health_check_unary_rest_flattened_error(transport: str = "rest"): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3265,11 +3496,16 @@ def test_remove_health_check_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.RemoveInstanceTargetPoolRequest, dict,] + "request_type", + [ + compute.RemoveInstanceTargetPoolRequest, + dict, + ], ) def test_remove_instance_unary_rest(request_type): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3386,7 +3622,8 @@ def test_remove_instance_unary_rest_required_fields( assert jsonified_request["targetPool"] == "target_pool_value" client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3482,7 +3719,11 @@ def test_remove_instance_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.remove_instance_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3493,7 +3734,8 @@ def test_remove_instance_unary_rest_bad_request( transport: str = "rest", request_type=compute.RemoveInstanceTargetPoolRequest ): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3517,7 +3759,8 @@ def test_remove_instance_unary_rest_bad_request( def test_remove_instance_unary_rest_flattened(): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3566,7 +3809,8 @@ def test_remove_instance_unary_rest_flattened(): def test_remove_instance_unary_rest_flattened_error(transport: str = "rest"): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3589,10 +3833,17 @@ def test_remove_instance_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.SetBackupTargetPoolRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.SetBackupTargetPoolRequest, + dict, + ], +) def test_set_backup_unary_rest(request_type): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3695,7 +3946,12 @@ def test_set_backup_unary_rest_required_fields( credentials=ga_credentials.AnonymousCredentials() ).set_backup._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("failover_ratio", "request_id",)) + assert not set(unset_fields) - set( + ( + "failover_ratio", + "request_id", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -3707,7 +3963,8 @@ def test_set_backup_unary_rest_required_fields( assert jsonified_request["targetPool"] == "target_pool_value" client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3749,8 +4006,20 @@ def test_set_backup_unary_rest_unset_required_fields(): unset_fields = transport.set_backup._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("failoverRatio", "requestId",)) - & set(("project", "region", "targetPool", "targetReferenceResource",)) + set( + ( + "failoverRatio", + "requestId", + ) + ) + & set( + ( + "project", + "region", + "targetPool", + "targetReferenceResource", + ) + ) ) @@ -3796,7 +4065,11 @@ def test_set_backup_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_backup_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3807,7 +4080,8 @@ def test_set_backup_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetBackupTargetPoolRequest ): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3829,7 +4103,8 @@ def test_set_backup_unary_rest_bad_request( def test_set_backup_unary_rest_flattened(): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3876,7 +4151,8 @@ def test_set_backup_unary_rest_flattened(): def test_set_backup_unary_rest_flattened_error(transport: str = "rest"): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3904,7 +4180,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -3924,7 +4201,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = TargetPoolsClient(client_options=options, transport=transport,) + client = TargetPoolsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -3940,7 +4220,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = TargetPoolsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -3953,7 +4234,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.TargetPoolsRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.TargetPoolsRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -4014,7 +4300,8 @@ def test_target_pools_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.TargetPoolsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -4064,7 +4351,12 @@ def test_target_pools_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_target_pools_host_no_port(transport_name): client = TargetPoolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4080,7 +4372,12 @@ def test_target_pools_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_target_pools_host_with_port(transport_name): client = TargetPoolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4118,7 +4415,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = TargetPoolsClient.common_folder_path(folder) assert expected == actual @@ -4136,7 +4435,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = TargetPoolsClient.common_organization_path(organization) assert expected == actual @@ -4154,7 +4455,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = TargetPoolsClient.common_project_path(project) assert expected == actual @@ -4174,7 +4477,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = TargetPoolsClient.common_location_path(project, location) assert expected == actual @@ -4199,7 +4503,8 @@ def test_client_with_default_client_info(): transports.TargetPoolsTransport, "_prep_wrapped_messages" ) as prep: client = TargetPoolsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4208,7 +4513,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = TargetPoolsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4248,7 +4554,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(TargetPoolsClient, transports.TargetPoolsRestTransport),], + [ + (TargetPoolsClient, transports.TargetPoolsRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_target_ssl_proxies.py b/tests/unit/gapic/compute_v1/test_target_ssl_proxies.py index db9c23782..c88ef862a 100644 --- a/tests/unit/gapic/compute_v1/test_target_ssl_proxies.py +++ b/tests/unit/gapic/compute_v1/test_target_ssl_proxies.py @@ -90,7 +90,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(TargetSslProxiesClient, "rest"),] + "client_class,transport_name", + [ + (TargetSslProxiesClient, "rest"), + ], ) def test_target_ssl_proxies_client_from_service_account_info( client_class, transport_name @@ -114,7 +117,9 @@ def test_target_ssl_proxies_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.TargetSslProxiesRestTransport, "rest"),], + [ + (transports.TargetSslProxiesRestTransport, "rest"), + ], ) def test_target_ssl_proxies_client_service_account_always_use_jwt( transport_class, transport_name @@ -135,7 +140,10 @@ def test_target_ssl_proxies_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(TargetSslProxiesClient, "rest"),] + "client_class,transport_name", + [ + (TargetSslProxiesClient, "rest"), + ], ) def test_target_ssl_proxies_client_from_service_account_file( client_class, transport_name @@ -177,7 +185,9 @@ def test_target_ssl_proxies_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(TargetSslProxiesClient, transports.TargetSslProxiesRestTransport, "rest"),], + [ + (TargetSslProxiesClient, transports.TargetSslProxiesRestTransport, "rest"), + ], ) @mock.patch.object( TargetSslProxiesClient, @@ -470,13 +480,17 @@ def test_target_ssl_proxies_client_get_mtls_endpoint_and_cert_source(client_clas @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(TargetSslProxiesClient, transports.TargetSslProxiesRestTransport, "rest"),], + [ + (TargetSslProxiesClient, transports.TargetSslProxiesRestTransport, "rest"), + ], ) def test_target_ssl_proxies_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -494,7 +508,14 @@ def test_target_ssl_proxies_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(TargetSslProxiesClient, transports.TargetSslProxiesRestTransport, "rest", None),], + [ + ( + TargetSslProxiesClient, + transports.TargetSslProxiesRestTransport, + "rest", + None, + ), + ], ) def test_target_ssl_proxies_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -517,10 +538,17 @@ def test_target_ssl_proxies_client_client_options_credentials_file( ) -@pytest.mark.parametrize("request_type", [compute.DeleteTargetSslProxyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteTargetSslProxyRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -630,7 +658,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["targetSslProxy"] == "target_ssl_proxy_value" client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -671,7 +700,13 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "targetSslProxy",)) + set(("requestId",)) + & set( + ( + "project", + "targetSslProxy", + ) + ) ) @@ -717,7 +752,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -728,7 +767,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteTargetSslProxyRequest ): client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -749,7 +789,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -762,7 +803,8 @@ def test_delete_unary_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", target_ssl_proxy="target_ssl_proxy_value", + project="project_value", + target_ssl_proxy="target_ssl_proxy_value", ) mock_args.update(sample_request) @@ -789,7 +831,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -808,10 +851,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetTargetSslProxyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetTargetSslProxyRequest, + dict, + ], +) def test_get_rest(request_type): client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -893,7 +943,8 @@ def test_get_rest_required_fields(request_type=compute.GetTargetSslProxyRequest) assert jsonified_request["targetSslProxy"] == "target_ssl_proxy_value" client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -933,7 +984,15 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("project", "targetSslProxy",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "project", + "targetSslProxy", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -979,7 +1038,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.TargetSslProxy - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -989,7 +1054,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetTargetSslProxyRequest ): client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1010,7 +1076,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1023,7 +1090,8 @@ def test_get_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", target_ssl_proxy="target_ssl_proxy_value", + project="project_value", + target_ssl_proxy="target_ssl_proxy_value", ) mock_args.update(sample_request) @@ -1050,7 +1118,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1069,10 +1138,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertTargetSslProxyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertTargetSslProxyRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1190,7 +1266,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1232,7 +1309,13 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "targetSslProxyResource",)) + set(("requestId",)) + & set( + ( + "project", + "targetSslProxyResource", + ) + ) ) @@ -1278,7 +1361,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1289,7 +1376,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertTargetSslProxyRequest ): client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1322,7 +1410,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1365,7 +1454,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1386,10 +1476,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListTargetSslProxiesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListTargetSslProxiesRequest, + dict, + ], +) def test_list_rest(request_type): client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1450,7 +1547,13 @@ def test_list_rest_required_fields(request_type=compute.ListTargetSslProxiesRequ ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1459,7 +1562,8 @@ def test_list_rest_required_fields(request_type=compute.ListTargetSslProxiesRequ assert jsonified_request["project"] == "project_value" client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1500,7 +1604,15 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set(("project",)) ) @@ -1548,7 +1660,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.TargetSslProxyList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1558,7 +1676,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListTargetSslProxiesRequest ): client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1579,7 +1698,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1591,7 +1711,9 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1617,20 +1739,23 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list( - compute.ListTargetSslProxiesRequest(), project="project_value", + compute.ListTargetSslProxiesRequest(), + project="project_value", ) def test_list_rest_pager(transport: str = "rest"): client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1647,12 +1772,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.TargetSslProxyList(items=[], next_page_token="def",), compute.TargetSslProxyList( - items=[compute.TargetSslProxy(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.TargetSslProxyList( - items=[compute.TargetSslProxy(), compute.TargetSslProxy(),], + items=[ + compute.TargetSslProxy(), + ], + next_page_token="ghi", + ), + compute.TargetSslProxyList( + items=[ + compute.TargetSslProxy(), + compute.TargetSslProxy(), + ], ), ) # Two responses for two calls @@ -1680,11 +1814,16 @@ def test_list_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.SetBackendServiceTargetSslProxyRequest, dict,] + "request_type", + [ + compute.SetBackendServiceTargetSslProxyRequest, + dict, + ], ) def test_set_backend_service_unary_rest(request_type): client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1797,7 +1936,8 @@ def test_set_backend_service_unary_rest_required_fields( assert jsonified_request["targetSslProxy"] == "target_ssl_proxy_value" client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1892,7 +2032,11 @@ def test_set_backend_service_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_backend_service_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1903,7 +2047,8 @@ def test_set_backend_service_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetBackendServiceTargetSslProxyRequest ): client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1927,7 +2072,8 @@ def test_set_backend_service_unary_rest_bad_request( def test_set_backend_service_unary_rest_flattened(): client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1971,7 +2117,8 @@ def test_set_backend_service_unary_rest_flattened(): def test_set_backend_service_unary_rest_flattened_error(transport: str = "rest"): client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1994,11 +2141,16 @@ def test_set_backend_service_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SetProxyHeaderTargetSslProxyRequest, dict,] + "request_type", + [ + compute.SetProxyHeaderTargetSslProxyRequest, + dict, + ], ) def test_set_proxy_header_unary_rest(request_type): client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2111,7 +2263,8 @@ def test_set_proxy_header_unary_rest_required_fields( assert jsonified_request["targetSslProxy"] == "target_ssl_proxy_value" client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2206,7 +2359,11 @@ def test_set_proxy_header_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_proxy_header_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2217,7 +2374,8 @@ def test_set_proxy_header_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetProxyHeaderTargetSslProxyRequest ): client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2241,7 +2399,8 @@ def test_set_proxy_header_unary_rest_bad_request( def test_set_proxy_header_unary_rest_flattened(): client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2285,7 +2444,8 @@ def test_set_proxy_header_unary_rest_flattened(): def test_set_proxy_header_unary_rest_flattened_error(transport: str = "rest"): client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2308,11 +2468,16 @@ def test_set_proxy_header_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SetSslCertificatesTargetSslProxyRequest, dict,] + "request_type", + [ + compute.SetSslCertificatesTargetSslProxyRequest, + dict, + ], ) def test_set_ssl_certificates_unary_rest(request_type): client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2425,7 +2590,8 @@ def test_set_ssl_certificates_unary_rest_required_fields( assert jsonified_request["targetSslProxy"] == "target_ssl_proxy_value" client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2520,7 +2686,11 @@ def test_set_ssl_certificates_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_ssl_certificates_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2532,7 +2702,8 @@ def test_set_ssl_certificates_unary_rest_bad_request( request_type=compute.SetSslCertificatesTargetSslProxyRequest, ): client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2556,7 +2727,8 @@ def test_set_ssl_certificates_unary_rest_bad_request( def test_set_ssl_certificates_unary_rest_flattened(): client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2600,7 +2772,8 @@ def test_set_ssl_certificates_unary_rest_flattened(): def test_set_ssl_certificates_unary_rest_flattened_error(transport: str = "rest"): client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2623,11 +2796,16 @@ def test_set_ssl_certificates_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SetSslPolicyTargetSslProxyRequest, dict,] + "request_type", + [ + compute.SetSslPolicyTargetSslProxyRequest, + dict, + ], ) def test_set_ssl_policy_unary_rest(request_type): client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2738,7 +2916,8 @@ def test_set_ssl_policy_unary_rest_required_fields( assert jsonified_request["targetSslProxy"] == "target_ssl_proxy_value" client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2781,7 +2960,13 @@ def test_set_ssl_policy_unary_rest_unset_required_fields(): unset_fields = transport.set_ssl_policy._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("project", "sslPolicyReferenceResource", "targetSslProxy",)) + & set( + ( + "project", + "sslPolicyReferenceResource", + "targetSslProxy", + ) + ) ) @@ -2827,7 +3012,11 @@ def test_set_ssl_policy_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_ssl_policy_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2838,7 +3027,8 @@ def test_set_ssl_policy_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetSslPolicyTargetSslProxyRequest ): client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2860,7 +3050,8 @@ def test_set_ssl_policy_unary_rest_bad_request( def test_set_ssl_policy_unary_rest_flattened(): client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2904,7 +3095,8 @@ def test_set_ssl_policy_unary_rest_flattened(): def test_set_ssl_policy_unary_rest_flattened_error(transport: str = "rest"): client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2933,7 +3125,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2953,7 +3146,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = TargetSslProxiesClient(client_options=options, transport=transport,) + client = TargetSslProxiesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2969,7 +3165,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = TargetSslProxiesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2982,7 +3179,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.TargetSslProxiesRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.TargetSslProxiesRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -3040,7 +3242,8 @@ def test_target_ssl_proxies_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.TargetSslProxiesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -3090,7 +3293,12 @@ def test_target_ssl_proxies_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_target_ssl_proxies_host_no_port(transport_name): client = TargetSslProxiesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3106,7 +3314,12 @@ def test_target_ssl_proxies_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_target_ssl_proxies_host_with_port(transport_name): client = TargetSslProxiesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3144,7 +3357,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = TargetSslProxiesClient.common_folder_path(folder) assert expected == actual @@ -3162,7 +3377,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = TargetSslProxiesClient.common_organization_path(organization) assert expected == actual @@ -3180,7 +3397,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = TargetSslProxiesClient.common_project_path(project) assert expected == actual @@ -3200,7 +3419,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = TargetSslProxiesClient.common_location_path(project, location) assert expected == actual @@ -3225,7 +3445,8 @@ def test_client_with_default_client_info(): transports.TargetSslProxiesTransport, "_prep_wrapped_messages" ) as prep: client = TargetSslProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3234,7 +3455,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = TargetSslProxiesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3274,7 +3496,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(TargetSslProxiesClient, transports.TargetSslProxiesRestTransport),], + [ + (TargetSslProxiesClient, transports.TargetSslProxiesRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_target_tcp_proxies.py b/tests/unit/gapic/compute_v1/test_target_tcp_proxies.py index bdd3f67ea..c96331c07 100644 --- a/tests/unit/gapic/compute_v1/test_target_tcp_proxies.py +++ b/tests/unit/gapic/compute_v1/test_target_tcp_proxies.py @@ -90,7 +90,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(TargetTcpProxiesClient, "rest"),] + "client_class,transport_name", + [ + (TargetTcpProxiesClient, "rest"), + ], ) def test_target_tcp_proxies_client_from_service_account_info( client_class, transport_name @@ -114,7 +117,9 @@ def test_target_tcp_proxies_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.TargetTcpProxiesRestTransport, "rest"),], + [ + (transports.TargetTcpProxiesRestTransport, "rest"), + ], ) def test_target_tcp_proxies_client_service_account_always_use_jwt( transport_class, transport_name @@ -135,7 +140,10 @@ def test_target_tcp_proxies_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(TargetTcpProxiesClient, "rest"),] + "client_class,transport_name", + [ + (TargetTcpProxiesClient, "rest"), + ], ) def test_target_tcp_proxies_client_from_service_account_file( client_class, transport_name @@ -177,7 +185,9 @@ def test_target_tcp_proxies_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(TargetTcpProxiesClient, transports.TargetTcpProxiesRestTransport, "rest"),], + [ + (TargetTcpProxiesClient, transports.TargetTcpProxiesRestTransport, "rest"), + ], ) @mock.patch.object( TargetTcpProxiesClient, @@ -470,13 +480,17 @@ def test_target_tcp_proxies_client_get_mtls_endpoint_and_cert_source(client_clas @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(TargetTcpProxiesClient, transports.TargetTcpProxiesRestTransport, "rest"),], + [ + (TargetTcpProxiesClient, transports.TargetTcpProxiesRestTransport, "rest"), + ], ) def test_target_tcp_proxies_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -494,7 +508,14 @@ def test_target_tcp_proxies_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(TargetTcpProxiesClient, transports.TargetTcpProxiesRestTransport, "rest", None),], + [ + ( + TargetTcpProxiesClient, + transports.TargetTcpProxiesRestTransport, + "rest", + None, + ), + ], ) def test_target_tcp_proxies_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -517,10 +538,17 @@ def test_target_tcp_proxies_client_client_options_credentials_file( ) -@pytest.mark.parametrize("request_type", [compute.DeleteTargetTcpProxyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteTargetTcpProxyRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = TargetTcpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -630,7 +658,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["targetTcpProxy"] == "target_tcp_proxy_value" client = TargetTcpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -671,7 +700,13 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "targetTcpProxy",)) + set(("requestId",)) + & set( + ( + "project", + "targetTcpProxy", + ) + ) ) @@ -717,7 +752,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -728,7 +767,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteTargetTcpProxyRequest ): client = TargetTcpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -749,7 +789,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = TargetTcpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -762,7 +803,8 @@ def test_delete_unary_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", target_tcp_proxy="target_tcp_proxy_value", + project="project_value", + target_tcp_proxy="target_tcp_proxy_value", ) mock_args.update(sample_request) @@ -789,7 +831,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = TargetTcpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -808,10 +851,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetTargetTcpProxyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetTargetTcpProxyRequest, + dict, + ], +) def test_get_rest(request_type): client = TargetTcpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -891,7 +941,8 @@ def test_get_rest_required_fields(request_type=compute.GetTargetTcpProxyRequest) assert jsonified_request["targetTcpProxy"] == "target_tcp_proxy_value" client = TargetTcpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -931,7 +982,15 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("project", "targetTcpProxy",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "project", + "targetTcpProxy", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -977,7 +1036,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.TargetTcpProxy - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -987,7 +1052,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetTargetTcpProxyRequest ): client = TargetTcpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1008,7 +1074,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = TargetTcpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1021,7 +1088,8 @@ def test_get_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", target_tcp_proxy="target_tcp_proxy_value", + project="project_value", + target_tcp_proxy="target_tcp_proxy_value", ) mock_args.update(sample_request) @@ -1048,7 +1116,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = TargetTcpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1067,10 +1136,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertTargetTcpProxyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertTargetTcpProxyRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = TargetTcpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1187,7 +1263,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["project"] == "project_value" client = TargetTcpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1229,7 +1306,13 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "targetTcpProxyResource",)) + set(("requestId",)) + & set( + ( + "project", + "targetTcpProxyResource", + ) + ) ) @@ -1275,7 +1358,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1286,7 +1373,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertTargetTcpProxyRequest ): client = TargetTcpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1318,7 +1406,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = TargetTcpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1361,7 +1450,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = TargetTcpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1382,10 +1472,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListTargetTcpProxiesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListTargetTcpProxiesRequest, + dict, + ], +) def test_list_rest(request_type): client = TargetTcpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1446,7 +1543,13 @@ def test_list_rest_required_fields(request_type=compute.ListTargetTcpProxiesRequ ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1455,7 +1558,8 @@ def test_list_rest_required_fields(request_type=compute.ListTargetTcpProxiesRequ assert jsonified_request["project"] == "project_value" client = TargetTcpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1496,7 +1600,15 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set(("project",)) ) @@ -1544,7 +1656,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.TargetTcpProxyList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1554,7 +1672,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListTargetTcpProxiesRequest ): client = TargetTcpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1575,7 +1694,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = TargetTcpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1587,7 +1707,9 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1613,20 +1735,23 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = TargetTcpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list( - compute.ListTargetTcpProxiesRequest(), project="project_value", + compute.ListTargetTcpProxiesRequest(), + project="project_value", ) def test_list_rest_pager(transport: str = "rest"): client = TargetTcpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1643,12 +1768,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.TargetTcpProxyList(items=[], next_page_token="def",), compute.TargetTcpProxyList( - items=[compute.TargetTcpProxy(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.TargetTcpProxyList( - items=[compute.TargetTcpProxy(), compute.TargetTcpProxy(),], + items=[ + compute.TargetTcpProxy(), + ], + next_page_token="ghi", + ), + compute.TargetTcpProxyList( + items=[ + compute.TargetTcpProxy(), + compute.TargetTcpProxy(), + ], ), ) # Two responses for two calls @@ -1676,11 +1810,16 @@ def test_list_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( - "request_type", [compute.SetBackendServiceTargetTcpProxyRequest, dict,] + "request_type", + [ + compute.SetBackendServiceTargetTcpProxyRequest, + dict, + ], ) def test_set_backend_service_unary_rest(request_type): client = TargetTcpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1793,7 +1932,8 @@ def test_set_backend_service_unary_rest_required_fields( assert jsonified_request["targetTcpProxy"] == "target_tcp_proxy_value" client = TargetTcpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1888,7 +2028,11 @@ def test_set_backend_service_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_backend_service_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1899,7 +2043,8 @@ def test_set_backend_service_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetBackendServiceTargetTcpProxyRequest ): client = TargetTcpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1923,7 +2068,8 @@ def test_set_backend_service_unary_rest_bad_request( def test_set_backend_service_unary_rest_flattened(): client = TargetTcpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1967,7 +2113,8 @@ def test_set_backend_service_unary_rest_flattened(): def test_set_backend_service_unary_rest_flattened_error(transport: str = "rest"): client = TargetTcpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1990,11 +2137,16 @@ def test_set_backend_service_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.SetProxyHeaderTargetTcpProxyRequest, dict,] + "request_type", + [ + compute.SetProxyHeaderTargetTcpProxyRequest, + dict, + ], ) def test_set_proxy_header_unary_rest(request_type): client = TargetTcpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2107,7 +2259,8 @@ def test_set_proxy_header_unary_rest_required_fields( assert jsonified_request["targetTcpProxy"] == "target_tcp_proxy_value" client = TargetTcpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2202,7 +2355,11 @@ def test_set_proxy_header_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_proxy_header_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2213,7 +2370,8 @@ def test_set_proxy_header_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetProxyHeaderTargetTcpProxyRequest ): client = TargetTcpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2237,7 +2395,8 @@ def test_set_proxy_header_unary_rest_bad_request( def test_set_proxy_header_unary_rest_flattened(): client = TargetTcpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2281,7 +2440,8 @@ def test_set_proxy_header_unary_rest_flattened(): def test_set_proxy_header_unary_rest_flattened_error(transport: str = "rest"): client = TargetTcpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2310,7 +2470,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = TargetTcpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2330,7 +2491,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = TargetTcpProxiesClient(client_options=options, transport=transport,) + client = TargetTcpProxiesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2346,7 +2510,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = TargetTcpProxiesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2359,7 +2524,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.TargetTcpProxiesRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.TargetTcpProxiesRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -2415,7 +2585,8 @@ def test_target_tcp_proxies_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.TargetTcpProxiesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2465,7 +2636,12 @@ def test_target_tcp_proxies_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_target_tcp_proxies_host_no_port(transport_name): client = TargetTcpProxiesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2481,7 +2657,12 @@ def test_target_tcp_proxies_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_target_tcp_proxies_host_with_port(transport_name): client = TargetTcpProxiesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2519,7 +2700,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = TargetTcpProxiesClient.common_folder_path(folder) assert expected == actual @@ -2537,7 +2720,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = TargetTcpProxiesClient.common_organization_path(organization) assert expected == actual @@ -2555,7 +2740,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = TargetTcpProxiesClient.common_project_path(project) assert expected == actual @@ -2575,7 +2762,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = TargetTcpProxiesClient.common_location_path(project, location) assert expected == actual @@ -2600,7 +2788,8 @@ def test_client_with_default_client_info(): transports.TargetTcpProxiesTransport, "_prep_wrapped_messages" ) as prep: client = TargetTcpProxiesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2609,7 +2798,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = TargetTcpProxiesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2649,7 +2839,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(TargetTcpProxiesClient, transports.TargetTcpProxiesRestTransport),], + [ + (TargetTcpProxiesClient, transports.TargetTcpProxiesRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_target_vpn_gateways.py b/tests/unit/gapic/compute_v1/test_target_vpn_gateways.py index 3b0999da3..fac7af0e4 100644 --- a/tests/unit/gapic/compute_v1/test_target_vpn_gateways.py +++ b/tests/unit/gapic/compute_v1/test_target_vpn_gateways.py @@ -90,7 +90,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(TargetVpnGatewaysClient, "rest"),] + "client_class,transport_name", + [ + (TargetVpnGatewaysClient, "rest"), + ], ) def test_target_vpn_gateways_client_from_service_account_info( client_class, transport_name @@ -114,7 +117,9 @@ def test_target_vpn_gateways_client_from_service_account_info( @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.TargetVpnGatewaysRestTransport, "rest"),], + [ + (transports.TargetVpnGatewaysRestTransport, "rest"), + ], ) def test_target_vpn_gateways_client_service_account_always_use_jwt( transport_class, transport_name @@ -135,7 +140,10 @@ def test_target_vpn_gateways_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(TargetVpnGatewaysClient, "rest"),] + "client_class,transport_name", + [ + (TargetVpnGatewaysClient, "rest"), + ], ) def test_target_vpn_gateways_client_from_service_account_file( client_class, transport_name @@ -177,7 +185,9 @@ def test_target_vpn_gateways_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(TargetVpnGatewaysClient, transports.TargetVpnGatewaysRestTransport, "rest"),], + [ + (TargetVpnGatewaysClient, transports.TargetVpnGatewaysRestTransport, "rest"), + ], ) @mock.patch.object( TargetVpnGatewaysClient, @@ -470,13 +480,17 @@ def test_target_vpn_gateways_client_get_mtls_endpoint_and_cert_source(client_cla @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(TargetVpnGatewaysClient, transports.TargetVpnGatewaysRestTransport, "rest"),], + [ + (TargetVpnGatewaysClient, transports.TargetVpnGatewaysRestTransport, "rest"), + ], ) def test_target_vpn_gateways_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -525,11 +539,16 @@ def test_target_vpn_gateways_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.AggregatedListTargetVpnGatewaysRequest, dict,] + "request_type", + [ + compute.AggregatedListTargetVpnGatewaysRequest, + dict, + ], ) def test_aggregated_list_rest(request_type): client = TargetVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -610,7 +629,8 @@ def test_aggregated_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = TargetVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -711,7 +731,11 @@ def test_aggregated_list_rest_interceptors(null_interceptor): post.return_value = compute.TargetVpnGatewayAggregatedList client.aggregated_list( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -722,7 +746,8 @@ def test_aggregated_list_rest_bad_request( transport: str = "rest", request_type=compute.AggregatedListTargetVpnGatewaysRequest ): client = TargetVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -743,7 +768,8 @@ def test_aggregated_list_rest_bad_request( def test_aggregated_list_rest_flattened(): client = TargetVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -755,7 +781,9 @@ def test_aggregated_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -781,20 +809,23 @@ def test_aggregated_list_rest_flattened(): def test_aggregated_list_rest_flattened_error(transport: str = "rest"): client = TargetVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.aggregated_list( - compute.AggregatedListTargetVpnGatewaysRequest(), project="project_value", + compute.AggregatedListTargetVpnGatewaysRequest(), + project="project_value", ) def test_aggregated_list_rest_pager(transport: str = "rest"): client = TargetVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -811,9 +842,14 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): }, next_page_token="abc", ), - compute.TargetVpnGatewayAggregatedList(items={}, next_page_token="def",), compute.TargetVpnGatewayAggregatedList( - items={"g": compute.TargetVpnGatewaysScopedList(),}, + items={}, + next_page_token="def", + ), + compute.TargetVpnGatewayAggregatedList( + items={ + "g": compute.TargetVpnGatewaysScopedList(), + }, next_page_token="ghi", ), compute.TargetVpnGatewayAggregatedList( @@ -861,10 +897,17 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.DeleteTargetVpnGatewayRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteTargetVpnGatewayRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = TargetVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -982,7 +1025,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["targetVpnGateway"] == "target_vpn_gateway_value" client = TargetVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1023,7 +1067,14 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "region", "targetVpnGateway",)) + set(("requestId",)) + & set( + ( + "project", + "region", + "targetVpnGateway", + ) + ) ) @@ -1069,7 +1120,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1080,7 +1135,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteTargetVpnGatewayRequest ): client = TargetVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1105,7 +1161,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = TargetVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1151,7 +1208,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = TargetVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1171,10 +1229,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetTargetVpnGatewayRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetTargetVpnGatewayRequest, + dict, + ], +) def test_get_rest(request_type): client = TargetVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1266,7 +1331,8 @@ def test_get_rest_required_fields(request_type=compute.GetTargetVpnGatewayReques assert jsonified_request["targetVpnGateway"] == "target_vpn_gateway_value" client = TargetVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1307,7 +1373,14 @@ def test_get_rest_unset_required_fields(): unset_fields = transport.get._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("project", "region", "targetVpnGateway",)) + set(()) + & set( + ( + "project", + "region", + "targetVpnGateway", + ) + ) ) @@ -1354,7 +1427,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.TargetVpnGateway - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1364,7 +1443,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetTargetVpnGatewayRequest ): client = TargetVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1389,7 +1469,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = TargetVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1435,7 +1516,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = TargetVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1455,10 +1537,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertTargetVpnGatewayRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertTargetVpnGatewayRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = TargetVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1581,7 +1670,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = TargetVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1623,7 +1713,14 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "region", "targetVpnGatewayResource",)) + set(("requestId",)) + & set( + ( + "project", + "region", + "targetVpnGatewayResource", + ) + ) ) @@ -1669,7 +1766,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1680,7 +1781,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertTargetVpnGatewayRequest ): client = TargetVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1714,7 +1816,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = TargetVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1758,7 +1861,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = TargetVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1780,10 +1884,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListTargetVpnGatewaysRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListTargetVpnGatewaysRequest, + dict, + ], +) def test_list_rest(request_type): client = TargetVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1846,7 +1957,13 @@ def test_list_rest_required_fields(request_type=compute.ListTargetVpnGatewaysReq ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1857,7 +1974,8 @@ def test_list_rest_required_fields(request_type=compute.ListTargetVpnGatewaysReq assert jsonified_request["region"] == "region_value" client = TargetVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1898,8 +2016,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "region",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "region", + ) + ) ) @@ -1946,7 +2077,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.TargetVpnGatewayList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1956,7 +2093,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListTargetVpnGatewaysRequest ): client = TargetVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1977,7 +2115,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = TargetVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1989,7 +2128,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "region": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", region="region_value",) + mock_args = dict( + project="project_value", + region="region_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2015,7 +2157,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = TargetVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2030,7 +2173,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = TargetVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2047,12 +2191,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.TargetVpnGatewayList(items=[], next_page_token="def",), compute.TargetVpnGatewayList( - items=[compute.TargetVpnGateway(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.TargetVpnGatewayList( - items=[compute.TargetVpnGateway(), compute.TargetVpnGateway(),], + items=[ + compute.TargetVpnGateway(), + ], + next_page_token="ghi", + ), + compute.TargetVpnGatewayList( + items=[ + compute.TargetVpnGateway(), + compute.TargetVpnGateway(), + ], ), ) # Two responses for two calls @@ -2086,7 +2239,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = TargetVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2106,7 +2260,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = TargetVpnGatewaysClient(client_options=options, transport=transport,) + client = TargetVpnGatewaysClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2122,7 +2279,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = TargetVpnGatewaysClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2136,7 +2294,10 @@ def test_transport_instance(): @pytest.mark.parametrize( - "transport_class", [transports.TargetVpnGatewaysRestTransport,] + "transport_class", + [ + transports.TargetVpnGatewaysRestTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -2192,7 +2353,8 @@ def test_target_vpn_gateways_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.TargetVpnGatewaysTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2242,7 +2404,12 @@ def test_target_vpn_gateways_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_target_vpn_gateways_host_no_port(transport_name): client = TargetVpnGatewaysClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2258,7 +2425,12 @@ def test_target_vpn_gateways_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_target_vpn_gateways_host_with_port(transport_name): client = TargetVpnGatewaysClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2296,7 +2468,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = TargetVpnGatewaysClient.common_folder_path(folder) assert expected == actual @@ -2314,7 +2488,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = TargetVpnGatewaysClient.common_organization_path(organization) assert expected == actual @@ -2332,7 +2508,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = TargetVpnGatewaysClient.common_project_path(project) assert expected == actual @@ -2352,7 +2530,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = TargetVpnGatewaysClient.common_location_path(project, location) assert expected == actual @@ -2377,7 +2556,8 @@ def test_client_with_default_client_info(): transports.TargetVpnGatewaysTransport, "_prep_wrapped_messages" ) as prep: client = TargetVpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2386,7 +2566,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = TargetVpnGatewaysClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2426,7 +2607,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(TargetVpnGatewaysClient, transports.TargetVpnGatewaysRestTransport),], + [ + (TargetVpnGatewaysClient, transports.TargetVpnGatewaysRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_url_maps.py b/tests/unit/gapic/compute_v1/test_url_maps.py index 38c0bfc21..6f3f18c21 100644 --- a/tests/unit/gapic/compute_v1/test_url_maps.py +++ b/tests/unit/gapic/compute_v1/test_url_maps.py @@ -82,7 +82,12 @@ def test__get_default_mtls_endpoint(): assert UrlMapsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class,transport_name", [(UrlMapsClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (UrlMapsClient, "rest"), + ], +) def test_url_maps_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -102,7 +107,10 @@ def test_url_maps_client_from_service_account_info(client_class, transport_name) @pytest.mark.parametrize( - "transport_class,transport_name", [(transports.UrlMapsRestTransport, "rest"),] + "transport_class,transport_name", + [ + (transports.UrlMapsRestTransport, "rest"), + ], ) def test_url_maps_client_service_account_always_use_jwt( transport_class, transport_name @@ -122,7 +130,12 @@ def test_url_maps_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class,transport_name", [(UrlMapsClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (UrlMapsClient, "rest"), + ], +) def test_url_maps_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -161,7 +174,9 @@ def test_url_maps_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(UrlMapsClient, transports.UrlMapsRestTransport, "rest"),], + [ + (UrlMapsClient, transports.UrlMapsRestTransport, "rest"), + ], ) @mock.patch.object( UrlMapsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(UrlMapsClient) @@ -436,13 +451,17 @@ def test_url_maps_client_get_mtls_endpoint_and_cert_source(client_class): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(UrlMapsClient, transports.UrlMapsRestTransport, "rest"),], + [ + (UrlMapsClient, transports.UrlMapsRestTransport, "rest"), + ], ) def test_url_maps_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -460,7 +479,9 @@ def test_url_maps_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(UrlMapsClient, transports.UrlMapsRestTransport, "rest", None),], + [ + (UrlMapsClient, transports.UrlMapsRestTransport, "rest", None), + ], ) def test_url_maps_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -483,10 +504,17 @@ def test_url_maps_client_client_options_credentials_file( ) -@pytest.mark.parametrize("request_type", [compute.AggregatedListUrlMapsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.AggregatedListUrlMapsRequest, + dict, + ], +) def test_aggregated_list_rest(request_type): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -567,7 +595,8 @@ def test_aggregated_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -664,7 +693,11 @@ def test_aggregated_list_rest_interceptors(null_interceptor): post.return_value = compute.UrlMapsAggregatedList client.aggregated_list( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -675,7 +708,8 @@ def test_aggregated_list_rest_bad_request( transport: str = "rest", request_type=compute.AggregatedListUrlMapsRequest ): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -696,7 +730,8 @@ def test_aggregated_list_rest_bad_request( def test_aggregated_list_rest_flattened(): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -708,7 +743,9 @@ def test_aggregated_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -734,20 +771,23 @@ def test_aggregated_list_rest_flattened(): def test_aggregated_list_rest_flattened_error(transport: str = "rest"): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.aggregated_list( - compute.AggregatedListUrlMapsRequest(), project="project_value", + compute.AggregatedListUrlMapsRequest(), + project="project_value", ) def test_aggregated_list_rest_pager(transport: str = "rest"): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -764,9 +804,15 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): }, next_page_token="abc", ), - compute.UrlMapsAggregatedList(items={}, next_page_token="def",), compute.UrlMapsAggregatedList( - items={"g": compute.UrlMapsScopedList(),}, next_page_token="ghi", + items={}, + next_page_token="def", + ), + compute.UrlMapsAggregatedList( + items={ + "g": compute.UrlMapsScopedList(), + }, + next_page_token="ghi", ), compute.UrlMapsAggregatedList( items={ @@ -808,10 +854,17 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.DeleteUrlMapRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteUrlMapRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -919,7 +972,8 @@ def test_delete_unary_rest_required_fields(request_type=compute.DeleteUrlMapRequ assert jsonified_request["urlMap"] == "url_map_value" client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -959,7 +1013,15 @@ def test_delete_unary_rest_unset_required_fields(): ) unset_fields = transport.delete._get_unset_required_fields({}) - assert set(unset_fields) == (set(("requestId",)) & set(("project", "urlMap",))) + assert set(unset_fields) == ( + set(("requestId",)) + & set( + ( + "project", + "urlMap", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1002,7 +1064,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1013,7 +1079,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteUrlMapRequest ): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1034,7 +1101,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1046,7 +1114,10 @@ def test_delete_unary_rest_flattened(): sample_request = {"project": "sample1", "url_map": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", url_map="url_map_value",) + mock_args = dict( + project="project_value", + url_map="url_map_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1072,7 +1143,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1091,10 +1163,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetUrlMapRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetUrlMapRequest, + dict, + ], +) def test_get_rest(request_type): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1174,7 +1253,8 @@ def test_get_rest_required_fields(request_type=compute.GetUrlMapRequest): assert jsonified_request["urlMap"] == "url_map_value" client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1214,7 +1294,15 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("project", "urlMap",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "project", + "urlMap", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1256,7 +1344,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.UrlMap - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1266,7 +1360,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetUrlMapRequest ): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1287,7 +1382,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1299,7 +1395,10 @@ def test_get_rest_flattened(): sample_request = {"project": "sample1", "url_map": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", url_map="url_map_value",) + mock_args = dict( + project="project_value", + url_map="url_map_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1325,7 +1424,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1344,10 +1444,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertUrlMapRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertUrlMapRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1620,7 +1727,8 @@ def test_insert_unary_rest_required_fields(request_type=compute.InsertUrlMapRequ assert jsonified_request["project"] == "project_value" client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1662,7 +1770,13 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "urlMapResource",)) + set(("requestId",)) + & set( + ( + "project", + "urlMapResource", + ) + ) ) @@ -1706,7 +1820,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1717,7 +1835,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertUrlMapRequest ): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1907,7 +2026,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1949,7 +2069,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1970,10 +2091,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InvalidateCacheUrlMapRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InvalidateCacheUrlMapRequest, + dict, + ], +) def test_invalidate_cache_unary_rest(request_type): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2087,7 +2215,8 @@ def test_invalidate_cache_unary_rest_required_fields( assert jsonified_request["urlMap"] == "url_map_value" client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2130,7 +2259,13 @@ def test_invalidate_cache_unary_rest_unset_required_fields(): unset_fields = transport.invalidate_cache._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("cacheInvalidationRuleResource", "project", "urlMap",)) + & set( + ( + "cacheInvalidationRuleResource", + "project", + "urlMap", + ) + ) ) @@ -2174,7 +2309,11 @@ def test_invalidate_cache_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.invalidate_cache_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2185,7 +2324,8 @@ def test_invalidate_cache_unary_rest_bad_request( transport: str = "rest", request_type=compute.InvalidateCacheUrlMapRequest ): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2210,7 +2350,8 @@ def test_invalidate_cache_unary_rest_bad_request( def test_invalidate_cache_unary_rest_flattened(): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2254,7 +2395,8 @@ def test_invalidate_cache_unary_rest_flattened(): def test_invalidate_cache_unary_rest_flattened_error(transport: str = "rest"): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2276,10 +2418,17 @@ def test_invalidate_cache_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListUrlMapsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListUrlMapsRequest, + dict, + ], +) def test_list_rest(request_type): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2340,7 +2489,13 @@ def test_list_rest_required_fields(request_type=compute.ListUrlMapsRequest): ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -2349,7 +2504,8 @@ def test_list_rest_required_fields(request_type=compute.ListUrlMapsRequest): assert jsonified_request["project"] == "project_value" client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2390,7 +2546,15 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set(("project",)) ) @@ -2434,7 +2598,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.UrlMapList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2444,7 +2614,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListUrlMapsRequest ): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2465,7 +2636,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2477,7 +2649,9 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2502,20 +2676,23 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list( - compute.ListUrlMapsRequest(), project="project_value", + compute.ListUrlMapsRequest(), + project="project_value", ) def test_list_rest_pager(transport: str = "rest"): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2525,12 +2702,29 @@ def test_list_rest_pager(transport: str = "rest"): # Set the response as a series of pages response = ( compute.UrlMapList( - items=[compute.UrlMap(), compute.UrlMap(), compute.UrlMap(),], + items=[ + compute.UrlMap(), + compute.UrlMap(), + compute.UrlMap(), + ], next_page_token="abc", ), - compute.UrlMapList(items=[], next_page_token="def",), - compute.UrlMapList(items=[compute.UrlMap(),], next_page_token="ghi",), - compute.UrlMapList(items=[compute.UrlMap(), compute.UrlMap(),],), + compute.UrlMapList( + items=[], + next_page_token="def", + ), + compute.UrlMapList( + items=[ + compute.UrlMap(), + ], + next_page_token="ghi", + ), + compute.UrlMapList( + items=[ + compute.UrlMap(), + compute.UrlMap(), + ], + ), ) # Two responses for two calls response = response + response @@ -2556,10 +2750,17 @@ def test_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.PatchUrlMapRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.PatchUrlMapRequest, + dict, + ], +) def test_patch_unary_rest(request_type): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2836,7 +3037,8 @@ def test_patch_unary_rest_required_fields(request_type=compute.PatchUrlMapReques assert jsonified_request["urlMap"] == "url_map_value" client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2878,7 +3080,14 @@ def test_patch_unary_rest_unset_required_fields(): unset_fields = transport.patch._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "urlMap", "urlMapResource",)) + set(("requestId",)) + & set( + ( + "project", + "urlMap", + "urlMapResource", + ) + ) ) @@ -2921,7 +3130,13 @@ def test_patch_unary_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.patch_unary(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2931,7 +3146,8 @@ def test_patch_unary_rest_bad_request( transport: str = "rest", request_type=compute.PatchUrlMapRequest ): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3121,7 +3337,8 @@ def test_patch_unary_rest_bad_request( def test_patch_unary_rest_flattened(): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3165,7 +3382,8 @@ def test_patch_unary_rest_flattened(): def test_patch_unary_rest_flattened_error(transport: str = "rest"): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3187,10 +3405,17 @@ def test_patch_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.UpdateUrlMapRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.UpdateUrlMapRequest, + dict, + ], +) def test_update_unary_rest(request_type): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -3467,7 +3692,8 @@ def test_update_unary_rest_required_fields(request_type=compute.UpdateUrlMapRequ assert jsonified_request["urlMap"] == "url_map_value" client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -3509,7 +3735,14 @@ def test_update_unary_rest_unset_required_fields(): unset_fields = transport.update._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "urlMap", "urlMapResource",)) + set(("requestId",)) + & set( + ( + "project", + "urlMap", + "urlMapResource", + ) + ) ) @@ -3553,7 +3786,11 @@ def test_update_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.update_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -3564,7 +3801,8 @@ def test_update_unary_rest_bad_request( transport: str = "rest", request_type=compute.UpdateUrlMapRequest ): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -3754,7 +3992,8 @@ def test_update_unary_rest_bad_request( def test_update_unary_rest_flattened(): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -3798,7 +4037,8 @@ def test_update_unary_rest_flattened(): def test_update_unary_rest_flattened_error(transport: str = "rest"): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -3820,10 +4060,17 @@ def test_update_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ValidateUrlMapRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ValidateUrlMapRequest, + dict, + ], +) def test_validate_rest(request_type): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -4058,7 +4305,8 @@ def test_validate_rest_required_fields(request_type=compute.ValidateUrlMapReques assert jsonified_request["urlMap"] == "url_map_value" client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -4100,7 +4348,14 @@ def test_validate_rest_unset_required_fields(): unset_fields = transport.validate._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) & set(("project", "urlMap", "urlMapsValidateRequestResource",)) + set(()) + & set( + ( + "project", + "urlMap", + "urlMapsValidateRequestResource", + ) + ) ) @@ -4145,7 +4400,13 @@ def test_validate_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.UrlMapsValidateResponse - client.validate(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.validate( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -4155,7 +4416,8 @@ def test_validate_rest_bad_request( transport: str = "rest", request_type=compute.ValidateUrlMapRequest ): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -4350,7 +4612,8 @@ def test_validate_rest_bad_request( def test_validate_rest_flattened(): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -4394,7 +4657,8 @@ def test_validate_rest_flattened(): def test_validate_rest_flattened_error(transport: str = "rest"): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -4423,7 +4687,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -4443,7 +4708,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = UrlMapsClient(client_options=options, transport=transport,) + client = UrlMapsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -4459,7 +4727,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = UrlMapsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -4472,7 +4741,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.UrlMapsRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.UrlMapsRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -4531,7 +4805,8 @@ def test_url_maps_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.UrlMapsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -4581,7 +4856,12 @@ def test_url_maps_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_url_maps_host_no_port(transport_name): client = UrlMapsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4597,7 +4877,12 @@ def test_url_maps_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_url_maps_host_with_port(transport_name): client = UrlMapsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4635,7 +4920,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = UrlMapsClient.common_folder_path(folder) assert expected == actual @@ -4653,7 +4940,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = UrlMapsClient.common_organization_path(organization) assert expected == actual @@ -4671,7 +4960,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = UrlMapsClient.common_project_path(project) assert expected == actual @@ -4691,7 +4982,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = UrlMapsClient.common_location_path(project, location) assert expected == actual @@ -4716,7 +5008,8 @@ def test_client_with_default_client_info(): transports.UrlMapsTransport, "_prep_wrapped_messages" ) as prep: client = UrlMapsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4725,7 +5018,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = UrlMapsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4764,7 +5058,10 @@ def test_client_ctx(): @pytest.mark.parametrize( - "client_class,transport_class", [(UrlMapsClient, transports.UrlMapsRestTransport),] + "client_class,transport_class", + [ + (UrlMapsClient, transports.UrlMapsRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_vpn_gateways.py b/tests/unit/gapic/compute_v1/test_vpn_gateways.py index 2691cc348..6faf8e21b 100644 --- a/tests/unit/gapic/compute_v1/test_vpn_gateways.py +++ b/tests/unit/gapic/compute_v1/test_vpn_gateways.py @@ -85,7 +85,12 @@ def test__get_default_mtls_endpoint(): assert VpnGatewaysClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class,transport_name", [(VpnGatewaysClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (VpnGatewaysClient, "rest"), + ], +) def test_vpn_gateways_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -105,7 +110,10 @@ def test_vpn_gateways_client_from_service_account_info(client_class, transport_n @pytest.mark.parametrize( - "transport_class,transport_name", [(transports.VpnGatewaysRestTransport, "rest"),] + "transport_class,transport_name", + [ + (transports.VpnGatewaysRestTransport, "rest"), + ], ) def test_vpn_gateways_client_service_account_always_use_jwt( transport_class, transport_name @@ -125,7 +133,12 @@ def test_vpn_gateways_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class,transport_name", [(VpnGatewaysClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (VpnGatewaysClient, "rest"), + ], +) def test_vpn_gateways_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -164,7 +177,9 @@ def test_vpn_gateways_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(VpnGatewaysClient, transports.VpnGatewaysRestTransport, "rest"),], + [ + (VpnGatewaysClient, transports.VpnGatewaysRestTransport, "rest"), + ], ) @mock.patch.object( VpnGatewaysClient, "DEFAULT_ENDPOINT", modify_default_endpoint(VpnGatewaysClient) @@ -441,13 +456,17 @@ def test_vpn_gateways_client_get_mtls_endpoint_and_cert_source(client_class): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(VpnGatewaysClient, transports.VpnGatewaysRestTransport, "rest"),], + [ + (VpnGatewaysClient, transports.VpnGatewaysRestTransport, "rest"), + ], ) def test_vpn_gateways_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -465,7 +484,9 @@ def test_vpn_gateways_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(VpnGatewaysClient, transports.VpnGatewaysRestTransport, "rest", None),], + [ + (VpnGatewaysClient, transports.VpnGatewaysRestTransport, "rest", None), + ], ) def test_vpn_gateways_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -489,11 +510,16 @@ def test_vpn_gateways_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.AggregatedListVpnGatewaysRequest, dict,] + "request_type", + [ + compute.AggregatedListVpnGatewaysRequest, + dict, + ], ) def test_aggregated_list_rest(request_type): client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -574,7 +600,8 @@ def test_aggregated_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -673,7 +700,11 @@ def test_aggregated_list_rest_interceptors(null_interceptor): post.return_value = compute.VpnGatewayAggregatedList client.aggregated_list( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -684,7 +715,8 @@ def test_aggregated_list_rest_bad_request( transport: str = "rest", request_type=compute.AggregatedListVpnGatewaysRequest ): client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -705,7 +737,8 @@ def test_aggregated_list_rest_bad_request( def test_aggregated_list_rest_flattened(): client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -717,7 +750,9 @@ def test_aggregated_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -743,20 +778,23 @@ def test_aggregated_list_rest_flattened(): def test_aggregated_list_rest_flattened_error(transport: str = "rest"): client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.aggregated_list( - compute.AggregatedListVpnGatewaysRequest(), project="project_value", + compute.AggregatedListVpnGatewaysRequest(), + project="project_value", ) def test_aggregated_list_rest_pager(transport: str = "rest"): client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -773,9 +811,15 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): }, next_page_token="abc", ), - compute.VpnGatewayAggregatedList(items={}, next_page_token="def",), compute.VpnGatewayAggregatedList( - items={"g": compute.VpnGatewaysScopedList(),}, next_page_token="ghi", + items={}, + next_page_token="def", + ), + compute.VpnGatewayAggregatedList( + items={ + "g": compute.VpnGatewaysScopedList(), + }, + next_page_token="ghi", ), compute.VpnGatewayAggregatedList( items={ @@ -820,10 +864,17 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.DeleteVpnGatewayRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteVpnGatewayRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -937,7 +988,8 @@ def test_delete_unary_rest_required_fields( assert jsonified_request["vpnGateway"] == "vpn_gateway_value" client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -978,7 +1030,14 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "region", "vpnGateway",)) + set(("requestId",)) + & set( + ( + "project", + "region", + "vpnGateway", + ) + ) ) @@ -1024,7 +1083,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1035,7 +1098,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteVpnGatewayRequest ): client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1056,7 +1120,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1102,7 +1167,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1122,10 +1188,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetVpnGatewayRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetVpnGatewayRequest, + dict, + ], +) def test_get_rest(request_type): client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1211,7 +1284,8 @@ def test_get_rest_required_fields(request_type=compute.GetVpnGatewayRequest): assert jsonified_request["vpnGateway"] == "vpn_gateway_value" client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1251,7 +1325,16 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("project", "region", "vpnGateway",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "project", + "region", + "vpnGateway", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1295,7 +1378,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.VpnGateway - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1305,7 +1394,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetVpnGatewayRequest ): client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1326,7 +1416,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1372,7 +1463,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1392,10 +1484,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetStatusVpnGatewayRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetStatusVpnGatewayRequest, + dict, + ], +) def test_get_status_rest(request_type): client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1462,7 +1561,8 @@ def test_get_status_rest_required_fields( assert jsonified_request["vpnGateway"] == "vpn_gateway_value" client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1504,7 +1604,16 @@ def test_get_status_rest_unset_required_fields(): ) unset_fields = transport.get_status._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("project", "region", "vpnGateway",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "project", + "region", + "vpnGateway", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1550,7 +1659,13 @@ def test_get_status_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.VpnGatewaysGetStatusResponse - client.get_status(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get_status( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1560,7 +1675,8 @@ def test_get_status_rest_bad_request( transport: str = "rest", request_type=compute.GetStatusVpnGatewayRequest ): client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1581,7 +1697,8 @@ def test_get_status_rest_bad_request( def test_get_status_rest_flattened(): client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1627,7 +1744,8 @@ def test_get_status_rest_flattened(): def test_get_status_rest_flattened_error(transport: str = "rest"): client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1647,10 +1765,17 @@ def test_get_status_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertVpnGatewayRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertVpnGatewayRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1780,7 +1905,8 @@ def test_insert_unary_rest_required_fields( assert jsonified_request["region"] == "region_value" client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1822,7 +1948,14 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "region", "vpnGatewayResource",)) + set(("requestId",)) + & set( + ( + "project", + "region", + "vpnGatewayResource", + ) + ) ) @@ -1868,7 +2001,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1879,7 +2016,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertVpnGatewayRequest ): client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1920,7 +2058,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1964,7 +2103,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1986,10 +2126,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListVpnGatewaysRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListVpnGatewaysRequest, + dict, + ], +) def test_list_rest(request_type): client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2052,7 +2199,13 @@ def test_list_rest_required_fields(request_type=compute.ListVpnGatewaysRequest): ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -2063,7 +2216,8 @@ def test_list_rest_required_fields(request_type=compute.ListVpnGatewaysRequest): assert jsonified_request["region"] == "region_value" client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2104,8 +2258,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "region",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "region", + ) + ) ) @@ -2152,7 +2319,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.VpnGatewayList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -2162,7 +2335,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListVpnGatewaysRequest ): client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2183,7 +2357,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2195,7 +2370,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "region": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", region="region_value",) + mock_args = dict( + project="project_value", + region="region_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2221,7 +2399,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2236,7 +2415,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2253,12 +2433,21 @@ def test_list_rest_pager(transport: str = "rest"): ], next_page_token="abc", ), - compute.VpnGatewayList(items=[], next_page_token="def",), compute.VpnGatewayList( - items=[compute.VpnGateway(),], next_page_token="ghi", + items=[], + next_page_token="def", ), compute.VpnGatewayList( - items=[compute.VpnGateway(), compute.VpnGateway(),], + items=[ + compute.VpnGateway(), + ], + next_page_token="ghi", + ), + compute.VpnGatewayList( + items=[ + compute.VpnGateway(), + compute.VpnGateway(), + ], ), ) # Two responses for two calls @@ -2285,10 +2474,17 @@ def test_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.SetLabelsVpnGatewayRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.SetLabelsVpnGatewayRequest, + dict, + ], +) def test_set_labels_unary_rest(request_type): client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2406,7 +2602,8 @@ def test_set_labels_unary_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2449,7 +2646,14 @@ def test_set_labels_unary_rest_unset_required_fields(): unset_fields = transport.set_labels._get_unset_required_fields({}) assert set(unset_fields) == ( set(("requestId",)) - & set(("project", "region", "regionSetLabelsRequestResource", "resource",)) + & set( + ( + "project", + "region", + "regionSetLabelsRequestResource", + "resource", + ) + ) ) @@ -2495,7 +2699,11 @@ def test_set_labels_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.set_labels_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2506,7 +2714,8 @@ def test_set_labels_unary_rest_bad_request( transport: str = "rest", request_type=compute.SetLabelsVpnGatewayRequest ): client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2531,7 +2740,8 @@ def test_set_labels_unary_rest_bad_request( def test_set_labels_unary_rest_flattened(): client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2580,7 +2790,8 @@ def test_set_labels_unary_rest_flattened(): def test_set_labels_unary_rest_flattened_error(transport: str = "rest"): client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2604,11 +2815,16 @@ def test_set_labels_unary_rest_error(): @pytest.mark.parametrize( - "request_type", [compute.TestIamPermissionsVpnGatewayRequest, dict,] + "request_type", + [ + compute.TestIamPermissionsVpnGatewayRequest, + dict, + ], ) def test_test_iam_permissions_rest(request_type): client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -2681,7 +2897,8 @@ def test_test_iam_permissions_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -2724,7 +2941,14 @@ def test_test_iam_permissions_rest_unset_required_fields(): unset_fields = transport.test_iam_permissions._get_unset_required_fields({}) assert set(unset_fields) == ( set(()) - & set(("project", "region", "resource", "testPermissionsRequestResource",)) + & set( + ( + "project", + "region", + "resource", + "testPermissionsRequestResource", + ) + ) ) @@ -2772,7 +2996,11 @@ def test_test_iam_permissions_rest_interceptors(null_interceptor): post.return_value = compute.TestPermissionsResponse client.test_iam_permissions( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -2783,7 +3011,8 @@ def test_test_iam_permissions_rest_bad_request( transport: str = "rest", request_type=compute.TestIamPermissionsVpnGatewayRequest ): client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -2807,7 +3036,8 @@ def test_test_iam_permissions_rest_bad_request( def test_test_iam_permissions_rest_flattened(): client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -2856,7 +3086,8 @@ def test_test_iam_permissions_rest_flattened(): def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2886,7 +3117,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2906,7 +3138,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = VpnGatewaysClient(client_options=options, transport=transport,) + client = VpnGatewaysClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2922,7 +3157,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = VpnGatewaysClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2935,7 +3171,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.VpnGatewaysRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.VpnGatewaysRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -2993,7 +3234,8 @@ def test_vpn_gateways_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.VpnGatewaysTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -3043,7 +3285,12 @@ def test_vpn_gateways_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_vpn_gateways_host_no_port(transport_name): client = VpnGatewaysClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3059,7 +3306,12 @@ def test_vpn_gateways_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_vpn_gateways_host_with_port(transport_name): client = VpnGatewaysClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3097,7 +3349,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = VpnGatewaysClient.common_folder_path(folder) assert expected == actual @@ -3115,7 +3369,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = VpnGatewaysClient.common_organization_path(organization) assert expected == actual @@ -3133,7 +3389,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = VpnGatewaysClient.common_project_path(project) assert expected == actual @@ -3153,7 +3411,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = VpnGatewaysClient.common_location_path(project, location) assert expected == actual @@ -3178,7 +3437,8 @@ def test_client_with_default_client_info(): transports.VpnGatewaysTransport, "_prep_wrapped_messages" ) as prep: client = VpnGatewaysClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3187,7 +3447,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = VpnGatewaysClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3227,7 +3488,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(VpnGatewaysClient, transports.VpnGatewaysRestTransport),], + [ + (VpnGatewaysClient, transports.VpnGatewaysRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_vpn_tunnels.py b/tests/unit/gapic/compute_v1/test_vpn_tunnels.py index 15c41eae2..391d087a6 100644 --- a/tests/unit/gapic/compute_v1/test_vpn_tunnels.py +++ b/tests/unit/gapic/compute_v1/test_vpn_tunnels.py @@ -85,7 +85,12 @@ def test__get_default_mtls_endpoint(): assert VpnTunnelsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class,transport_name", [(VpnTunnelsClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (VpnTunnelsClient, "rest"), + ], +) def test_vpn_tunnels_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -105,7 +110,10 @@ def test_vpn_tunnels_client_from_service_account_info(client_class, transport_na @pytest.mark.parametrize( - "transport_class,transport_name", [(transports.VpnTunnelsRestTransport, "rest"),] + "transport_class,transport_name", + [ + (transports.VpnTunnelsRestTransport, "rest"), + ], ) def test_vpn_tunnels_client_service_account_always_use_jwt( transport_class, transport_name @@ -125,7 +133,12 @@ def test_vpn_tunnels_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class,transport_name", [(VpnTunnelsClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (VpnTunnelsClient, "rest"), + ], +) def test_vpn_tunnels_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -164,7 +177,9 @@ def test_vpn_tunnels_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(VpnTunnelsClient, transports.VpnTunnelsRestTransport, "rest"),], + [ + (VpnTunnelsClient, transports.VpnTunnelsRestTransport, "rest"), + ], ) @mock.patch.object( VpnTunnelsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(VpnTunnelsClient) @@ -441,13 +456,17 @@ def test_vpn_tunnels_client_get_mtls_endpoint_and_cert_source(client_class): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(VpnTunnelsClient, transports.VpnTunnelsRestTransport, "rest"),], + [ + (VpnTunnelsClient, transports.VpnTunnelsRestTransport, "rest"), + ], ) def test_vpn_tunnels_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -465,7 +484,9 @@ def test_vpn_tunnels_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(VpnTunnelsClient, transports.VpnTunnelsRestTransport, "rest", None),], + [ + (VpnTunnelsClient, transports.VpnTunnelsRestTransport, "rest", None), + ], ) def test_vpn_tunnels_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -489,11 +510,16 @@ def test_vpn_tunnels_client_client_options_credentials_file( @pytest.mark.parametrize( - "request_type", [compute.AggregatedListVpnTunnelsRequest, dict,] + "request_type", + [ + compute.AggregatedListVpnTunnelsRequest, + dict, + ], ) def test_aggregated_list_rest(request_type): client = VpnTunnelsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -574,7 +600,8 @@ def test_aggregated_list_rest_required_fields( assert jsonified_request["project"] == "project_value" client = VpnTunnelsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -673,7 +700,11 @@ def test_aggregated_list_rest_interceptors(null_interceptor): post.return_value = compute.VpnTunnelAggregatedList client.aggregated_list( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -684,7 +715,8 @@ def test_aggregated_list_rest_bad_request( transport: str = "rest", request_type=compute.AggregatedListVpnTunnelsRequest ): client = VpnTunnelsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -705,7 +737,8 @@ def test_aggregated_list_rest_bad_request( def test_aggregated_list_rest_flattened(): client = VpnTunnelsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -717,7 +750,9 @@ def test_aggregated_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -743,20 +778,23 @@ def test_aggregated_list_rest_flattened(): def test_aggregated_list_rest_flattened_error(transport: str = "rest"): client = VpnTunnelsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.aggregated_list( - compute.AggregatedListVpnTunnelsRequest(), project="project_value", + compute.AggregatedListVpnTunnelsRequest(), + project="project_value", ) def test_aggregated_list_rest_pager(transport: str = "rest"): client = VpnTunnelsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -773,9 +811,15 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): }, next_page_token="abc", ), - compute.VpnTunnelAggregatedList(items={}, next_page_token="def",), compute.VpnTunnelAggregatedList( - items={"g": compute.VpnTunnelsScopedList(),}, next_page_token="ghi", + items={}, + next_page_token="def", + ), + compute.VpnTunnelAggregatedList( + items={ + "g": compute.VpnTunnelsScopedList(), + }, + next_page_token="ghi", ), compute.VpnTunnelAggregatedList( items={ @@ -817,10 +861,17 @@ def test_aggregated_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.DeleteVpnTunnelRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteVpnTunnelRequest, + dict, + ], +) def test_delete_unary_rest(request_type): client = VpnTunnelsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -932,7 +983,8 @@ def test_delete_unary_rest_required_fields(request_type=compute.DeleteVpnTunnelR assert jsonified_request["vpnTunnel"] == "vpn_tunnel_value" client = VpnTunnelsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -973,7 +1025,14 @@ def test_delete_unary_rest_unset_required_fields(): unset_fields = transport.delete._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "region", "vpnTunnel",)) + set(("requestId",)) + & set( + ( + "project", + "region", + "vpnTunnel", + ) + ) ) @@ -1019,7 +1078,11 @@ def test_delete_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.delete_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1030,7 +1093,8 @@ def test_delete_unary_rest_bad_request( transport: str = "rest", request_type=compute.DeleteVpnTunnelRequest ): client = VpnTunnelsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1051,7 +1115,8 @@ def test_delete_unary_rest_bad_request( def test_delete_unary_rest_flattened(): client = VpnTunnelsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1097,7 +1162,8 @@ def test_delete_unary_rest_flattened(): def test_delete_unary_rest_flattened_error(transport: str = "rest"): client = VpnTunnelsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1117,10 +1183,17 @@ def test_delete_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetVpnTunnelRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetVpnTunnelRequest, + dict, + ], +) def test_get_rest(request_type): client = VpnTunnelsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1230,7 +1303,8 @@ def test_get_rest_required_fields(request_type=compute.GetVpnTunnelRequest): assert jsonified_request["vpnTunnel"] == "vpn_tunnel_value" client = VpnTunnelsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1270,7 +1344,16 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("project", "region", "vpnTunnel",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "project", + "region", + "vpnTunnel", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1314,7 +1397,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.VpnTunnel - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1324,7 +1413,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetVpnTunnelRequest ): client = VpnTunnelsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1345,7 +1435,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = VpnTunnelsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1391,7 +1482,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = VpnTunnelsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1411,10 +1503,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.InsertVpnTunnelRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertVpnTunnelRequest, + dict, + ], +) def test_insert_unary_rest(request_type): client = VpnTunnelsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1552,7 +1651,8 @@ def test_insert_unary_rest_required_fields(request_type=compute.InsertVpnTunnelR assert jsonified_request["region"] == "region_value" client = VpnTunnelsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1594,7 +1694,14 @@ def test_insert_unary_rest_unset_required_fields(): unset_fields = transport.insert._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("requestId",)) & set(("project", "region", "vpnTunnelResource",)) + set(("requestId",)) + & set( + ( + "project", + "region", + "vpnTunnelResource", + ) + ) ) @@ -1640,7 +1747,11 @@ def test_insert_unary_rest_interceptors(null_interceptor): post.return_value = compute.Operation client.insert_unary( - request, metadata=[("key", "val"), ("cephalopod", "squid"),] + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) pre.assert_called_once() @@ -1651,7 +1762,8 @@ def test_insert_unary_rest_bad_request( transport: str = "rest", request_type=compute.InsertVpnTunnelRequest ): client = VpnTunnelsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1702,7 +1814,8 @@ def test_insert_unary_rest_bad_request( def test_insert_unary_rest_flattened(): client = VpnTunnelsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1746,7 +1859,8 @@ def test_insert_unary_rest_flattened(): def test_insert_unary_rest_flattened_error(transport: str = "rest"): client = VpnTunnelsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1768,10 +1882,17 @@ def test_insert_unary_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListVpnTunnelsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListVpnTunnelsRequest, + dict, + ], +) def test_list_rest(request_type): client = VpnTunnelsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1834,7 +1955,13 @@ def test_list_rest_required_fields(request_type=compute.ListVpnTunnelsRequest): ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1845,7 +1972,8 @@ def test_list_rest_required_fields(request_type=compute.ListVpnTunnelsRequest): assert jsonified_request["region"] == "region_value" client = VpnTunnelsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1886,8 +2014,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "region",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "region", + ) + ) ) @@ -1934,7 +2075,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.VpnTunnelList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1944,7 +2091,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListVpnTunnelsRequest ): client = VpnTunnelsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1965,7 +2113,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = VpnTunnelsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1977,7 +2126,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "region": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", region="region_value",) + mock_args = dict( + project="project_value", + region="region_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -2003,7 +2155,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = VpnTunnelsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -2018,7 +2171,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = VpnTunnelsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -2028,12 +2182,29 @@ def test_list_rest_pager(transport: str = "rest"): # Set the response as a series of pages response = ( compute.VpnTunnelList( - items=[compute.VpnTunnel(), compute.VpnTunnel(), compute.VpnTunnel(),], + items=[ + compute.VpnTunnel(), + compute.VpnTunnel(), + compute.VpnTunnel(), + ], next_page_token="abc", ), - compute.VpnTunnelList(items=[], next_page_token="def",), - compute.VpnTunnelList(items=[compute.VpnTunnel(),], next_page_token="ghi",), - compute.VpnTunnelList(items=[compute.VpnTunnel(), compute.VpnTunnel(),],), + compute.VpnTunnelList( + items=[], + next_page_token="def", + ), + compute.VpnTunnelList( + items=[ + compute.VpnTunnel(), + ], + next_page_token="ghi", + ), + compute.VpnTunnelList( + items=[ + compute.VpnTunnel(), + compute.VpnTunnel(), + ], + ), ) # Two responses for two calls response = response + response @@ -2066,7 +2237,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = VpnTunnelsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2086,7 +2258,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = VpnTunnelsClient(client_options=options, transport=transport,) + client = VpnTunnelsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2102,7 +2277,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = VpnTunnelsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2115,7 +2291,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.VpnTunnelsRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.VpnTunnelsRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -2170,7 +2351,8 @@ def test_vpn_tunnels_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.VpnTunnelsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2220,7 +2402,12 @@ def test_vpn_tunnels_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_vpn_tunnels_host_no_port(transport_name): client = VpnTunnelsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2236,7 +2423,12 @@ def test_vpn_tunnels_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_vpn_tunnels_host_with_port(transport_name): client = VpnTunnelsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2274,7 +2466,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = VpnTunnelsClient.common_folder_path(folder) assert expected == actual @@ -2292,7 +2486,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = VpnTunnelsClient.common_organization_path(organization) assert expected == actual @@ -2310,7 +2506,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = VpnTunnelsClient.common_project_path(project) assert expected == actual @@ -2330,7 +2528,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = VpnTunnelsClient.common_location_path(project, location) assert expected == actual @@ -2355,7 +2554,8 @@ def test_client_with_default_client_info(): transports.VpnTunnelsTransport, "_prep_wrapped_messages" ) as prep: client = VpnTunnelsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2364,7 +2564,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = VpnTunnelsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2404,7 +2605,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(VpnTunnelsClient, transports.VpnTunnelsRestTransport),], + [ + (VpnTunnelsClient, transports.VpnTunnelsRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_zone_operations.py b/tests/unit/gapic/compute_v1/test_zone_operations.py index 79969685e..4098ac1c0 100644 --- a/tests/unit/gapic/compute_v1/test_zone_operations.py +++ b/tests/unit/gapic/compute_v1/test_zone_operations.py @@ -89,7 +89,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class,transport_name", [(ZoneOperationsClient, "rest"),] + "client_class,transport_name", + [ + (ZoneOperationsClient, "rest"), + ], ) def test_zone_operations_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() @@ -111,7 +114,9 @@ def test_zone_operations_client_from_service_account_info(client_class, transpor @pytest.mark.parametrize( "transport_class,transport_name", - [(transports.ZoneOperationsRestTransport, "rest"),], + [ + (transports.ZoneOperationsRestTransport, "rest"), + ], ) def test_zone_operations_client_service_account_always_use_jwt( transport_class, transport_name @@ -132,7 +137,10 @@ def test_zone_operations_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class,transport_name", [(ZoneOperationsClient, "rest"),] + "client_class,transport_name", + [ + (ZoneOperationsClient, "rest"), + ], ) def test_zone_operations_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() @@ -172,7 +180,9 @@ def test_zone_operations_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(ZoneOperationsClient, transports.ZoneOperationsRestTransport, "rest"),], + [ + (ZoneOperationsClient, transports.ZoneOperationsRestTransport, "rest"), + ], ) @mock.patch.object( ZoneOperationsClient, @@ -455,13 +465,17 @@ def test_zone_operations_client_get_mtls_endpoint_and_cert_source(client_class): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(ZoneOperationsClient, transports.ZoneOperationsRestTransport, "rest"),], + [ + (ZoneOperationsClient, transports.ZoneOperationsRestTransport, "rest"), + ], ) def test_zone_operations_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -479,7 +493,9 @@ def test_zone_operations_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(ZoneOperationsClient, transports.ZoneOperationsRestTransport, "rest", None),], + [ + (ZoneOperationsClient, transports.ZoneOperationsRestTransport, "rest", None), + ], ) def test_zone_operations_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -502,10 +518,17 @@ def test_zone_operations_client_client_options_credentials_file( ) -@pytest.mark.parametrize("request_type", [compute.DeleteZoneOperationRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteZoneOperationRequest, + dict, + ], +) def test_delete_rest(request_type): client = ZoneOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -570,7 +593,8 @@ def test_delete_rest_required_fields(request_type=compute.DeleteZoneOperationReq assert jsonified_request["zone"] == "zone_value" client = ZoneOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -612,7 +636,16 @@ def test_delete_rest_unset_required_fields(): ) unset_fields = transport.delete._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("operation", "project", "zone",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "operation", + "project", + "zone", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -658,7 +691,13 @@ def test_delete_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.DeleteZoneOperationResponse - client.delete(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.delete( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -668,7 +707,8 @@ def test_delete_rest_bad_request( transport: str = "rest", request_type=compute.DeleteZoneOperationRequest ): client = ZoneOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -689,7 +729,8 @@ def test_delete_rest_bad_request( def test_delete_rest_flattened(): client = ZoneOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -706,7 +747,9 @@ def test_delete_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", zone="zone_value", operation="operation_value", + project="project_value", + zone="zone_value", + operation="operation_value", ) mock_args.update(sample_request) @@ -733,7 +776,8 @@ def test_delete_rest_flattened(): def test_delete_rest_flattened_error(transport: str = "rest"): client = ZoneOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -753,10 +797,17 @@ def test_delete_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.GetZoneOperationRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetZoneOperationRequest, + dict, + ], +) def test_get_rest(request_type): client = ZoneOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -866,7 +917,8 @@ def test_get_rest_required_fields(request_type=compute.GetZoneOperationRequest): assert jsonified_request["zone"] == "zone_value" client = ZoneOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -906,7 +958,16 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("operation", "project", "zone",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "operation", + "project", + "zone", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -950,7 +1011,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -960,7 +1027,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetZoneOperationRequest ): client = ZoneOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -981,7 +1049,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = ZoneOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -998,7 +1067,9 @@ def test_get_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", zone="zone_value", operation="operation_value", + project="project_value", + zone="zone_value", + operation="operation_value", ) mock_args.update(sample_request) @@ -1025,7 +1096,8 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = ZoneOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1045,10 +1117,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListZoneOperationsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListZoneOperationsRequest, + dict, + ], +) def test_list_rest(request_type): client = ZoneOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1111,7 +1190,13 @@ def test_list_rest_required_fields(request_type=compute.ListZoneOperationsReques ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -1122,7 +1207,8 @@ def test_list_rest_required_fields(request_type=compute.ListZoneOperationsReques assert jsonified_request["zone"] == "zone_value" client = ZoneOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1163,8 +1249,21 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) - & set(("project", "zone",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "zone", + ) + ) ) @@ -1211,7 +1310,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.OperationList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1221,7 +1326,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListZoneOperationsRequest ): client = ZoneOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1242,7 +1348,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = ZoneOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1254,7 +1361,10 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1", "zone": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", zone="zone_value",) + mock_args = dict( + project="project_value", + zone="zone_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -1280,7 +1390,8 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = ZoneOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1295,7 +1406,8 @@ def test_list_rest_flattened_error(transport: str = "rest"): def test_list_rest_pager(transport: str = "rest"): client = ZoneOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -1305,12 +1417,29 @@ def test_list_rest_pager(transport: str = "rest"): # Set the response as a series of pages response = ( compute.OperationList( - items=[compute.Operation(), compute.Operation(), compute.Operation(),], + items=[ + compute.Operation(), + compute.Operation(), + compute.Operation(), + ], next_page_token="abc", ), - compute.OperationList(items=[], next_page_token="def",), - compute.OperationList(items=[compute.Operation(),], next_page_token="ghi",), - compute.OperationList(items=[compute.Operation(), compute.Operation(),],), + compute.OperationList( + items=[], + next_page_token="def", + ), + compute.OperationList( + items=[ + compute.Operation(), + ], + next_page_token="ghi", + ), + compute.OperationList( + items=[ + compute.Operation(), + compute.Operation(), + ], + ), ) # Two responses for two calls response = response + response @@ -1336,10 +1465,17 @@ def test_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [compute.WaitZoneOperationRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.WaitZoneOperationRequest, + dict, + ], +) def test_wait_rest(request_type): client = ZoneOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -1449,7 +1585,8 @@ def test_wait_rest_required_fields(request_type=compute.WaitZoneOperationRequest assert jsonified_request["zone"] == "zone_value" client = ZoneOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -1489,7 +1626,16 @@ def test_wait_rest_unset_required_fields(): ) unset_fields = transport.wait._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("operation", "project", "zone",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "operation", + "project", + "zone", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -1533,7 +1679,13 @@ def test_wait_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Operation - client.wait(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.wait( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -1543,7 +1695,8 @@ def test_wait_rest_bad_request( transport: str = "rest", request_type=compute.WaitZoneOperationRequest ): client = ZoneOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -1564,7 +1717,8 @@ def test_wait_rest_bad_request( def test_wait_rest_flattened(): client = ZoneOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -1581,7 +1735,9 @@ def test_wait_rest_flattened(): # get truthy value for each flattened field mock_args = dict( - project="project_value", zone="zone_value", operation="operation_value", + project="project_value", + zone="zone_value", + operation="operation_value", ) mock_args.update(sample_request) @@ -1608,7 +1764,8 @@ def test_wait_rest_flattened(): def test_wait_rest_flattened_error(transport: str = "rest"): client = ZoneOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened @@ -1635,7 +1792,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ZoneOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1655,7 +1813,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = ZoneOperationsClient(client_options=options, transport=transport,) + client = ZoneOperationsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1671,7 +1832,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ZoneOperationsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1684,7 +1846,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.ZoneOperationsRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.ZoneOperationsRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -1738,7 +1905,8 @@ def test_zone_operations_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ZoneOperationsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1788,7 +1956,12 @@ def test_zone_operations_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_zone_operations_host_no_port(transport_name): client = ZoneOperationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1804,7 +1977,12 @@ def test_zone_operations_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_zone_operations_host_with_port(transport_name): client = ZoneOperationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1842,7 +2020,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = ZoneOperationsClient.common_folder_path(folder) assert expected == actual @@ -1860,7 +2040,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = ZoneOperationsClient.common_organization_path(organization) assert expected == actual @@ -1878,7 +2060,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = ZoneOperationsClient.common_project_path(project) assert expected == actual @@ -1898,7 +2082,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = ZoneOperationsClient.common_location_path(project, location) assert expected == actual @@ -1923,7 +2108,8 @@ def test_client_with_default_client_info(): transports.ZoneOperationsTransport, "_prep_wrapped_messages" ) as prep: client = ZoneOperationsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1932,7 +2118,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ZoneOperationsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1972,7 +2159,9 @@ def test_client_ctx(): @pytest.mark.parametrize( "client_class,transport_class", - [(ZoneOperationsClient, transports.ZoneOperationsRestTransport),], + [ + (ZoneOperationsClient, transports.ZoneOperationsRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( diff --git a/tests/unit/gapic/compute_v1/test_zones.py b/tests/unit/gapic/compute_v1/test_zones.py index 79eb2fca2..77c2c7a4a 100644 --- a/tests/unit/gapic/compute_v1/test_zones.py +++ b/tests/unit/gapic/compute_v1/test_zones.py @@ -82,7 +82,12 @@ def test__get_default_mtls_endpoint(): assert ZonesClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class,transport_name", [(ZonesClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (ZonesClient, "rest"), + ], +) def test_zones_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -102,7 +107,10 @@ def test_zones_client_from_service_account_info(client_class, transport_name): @pytest.mark.parametrize( - "transport_class,transport_name", [(transports.ZonesRestTransport, "rest"),] + "transport_class,transport_name", + [ + (transports.ZonesRestTransport, "rest"), + ], ) def test_zones_client_service_account_always_use_jwt(transport_class, transport_name): with mock.patch.object( @@ -120,7 +128,12 @@ def test_zones_client_service_account_always_use_jwt(transport_class, transport_ use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class,transport_name", [(ZonesClient, "rest"),]) +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (ZonesClient, "rest"), + ], +) def test_zones_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -159,7 +172,9 @@ def test_zones_client_get_transport_class(): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(ZonesClient, transports.ZonesRestTransport, "rest"),], + [ + (ZonesClient, transports.ZonesRestTransport, "rest"), + ], ) @mock.patch.object( ZonesClient, "DEFAULT_ENDPOINT", modify_default_endpoint(ZonesClient) @@ -434,13 +449,17 @@ def test_zones_client_get_mtls_endpoint_and_cert_source(client_class): @pytest.mark.parametrize( "client_class,transport_class,transport_name", - [(ZonesClient, transports.ZonesRestTransport, "rest"),], + [ + (ZonesClient, transports.ZonesRestTransport, "rest"), + ], ) def test_zones_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -458,7 +477,9 @@ def test_zones_client_client_options_scopes( @pytest.mark.parametrize( "client_class,transport_class,transport_name,grpc_helpers", - [(ZonesClient, transports.ZonesRestTransport, "rest", None),], + [ + (ZonesClient, transports.ZonesRestTransport, "rest", None), + ], ) def test_zones_client_client_options_credentials_file( client_class, transport_class, transport_name, grpc_helpers @@ -481,10 +502,17 @@ def test_zones_client_client_options_credentials_file( ) -@pytest.mark.parametrize("request_type", [compute.GetZoneRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.GetZoneRequest, + dict, + ], +) def test_get_rest(request_type): client = ZonesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -566,7 +594,8 @@ def test_get_rest_required_fields(request_type=compute.GetZoneRequest): assert jsonified_request["zone"] == "zone_value" client = ZonesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -606,7 +635,15 @@ def test_get_rest_unset_required_fields(): ) unset_fields = transport.get._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("project", "zone",))) + assert set(unset_fields) == ( + set(()) + & set( + ( + "project", + "zone", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -648,7 +685,13 @@ def test_get_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.Zone - client.get(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -658,7 +701,8 @@ def test_get_rest_bad_request( transport: str = "rest", request_type=compute.GetZoneRequest ): client = ZonesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -679,7 +723,8 @@ def test_get_rest_bad_request( def test_get_rest_flattened(): client = ZonesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -691,7 +736,10 @@ def test_get_rest_flattened(): sample_request = {"project": "sample1", "zone": "sample2"} # get truthy value for each flattened field - mock_args = dict(project="project_value", zone="zone_value",) + mock_args = dict( + project="project_value", + zone="zone_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -716,14 +764,17 @@ def test_get_rest_flattened(): def test_get_rest_flattened_error(transport: str = "rest"): client = ZonesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get( - compute.GetZoneRequest(), project="project_value", zone="zone_value", + compute.GetZoneRequest(), + project="project_value", + zone="zone_value", ) @@ -733,10 +784,17 @@ def test_get_rest_error(): ) -@pytest.mark.parametrize("request_type", [compute.ListZonesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + compute.ListZonesRequest, + dict, + ], +) def test_list_rest(request_type): client = ZonesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # send a request that will satisfy transcoding @@ -797,7 +855,13 @@ def test_list_rest_required_fields(request_type=compute.ListZonesRequest): ).list._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( - ("filter", "max_results", "order_by", "page_token", "return_partial_success",) + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) ) jsonified_request.update(unset_fields) @@ -806,7 +870,8 @@ def test_list_rest_required_fields(request_type=compute.ListZonesRequest): assert jsonified_request["project"] == "project_value" client = ZonesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) request = request_type(request_init) @@ -847,7 +912,15 @@ def test_list_rest_unset_required_fields(): unset_fields = transport.list._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("filter", "maxResults", "orderBy", "pageToken", "returnPartialSuccess",)) + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) & set(("project",)) ) @@ -891,7 +964,13 @@ def test_list_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = compute.ZoneList - client.list(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) pre.assert_called_once() post.assert_called_once() @@ -901,7 +980,8 @@ def test_list_rest_bad_request( transport: str = "rest", request_type=compute.ListZonesRequest ): client = ZonesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # send a request that will satisfy transcoding @@ -922,7 +1002,8 @@ def test_list_rest_bad_request( def test_list_rest_flattened(): client = ZonesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest", + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", ) # Mock the http request call within the method and fake a response. @@ -934,7 +1015,9 @@ def test_list_rest_flattened(): sample_request = {"project": "sample1"} # get truthy value for each flattened field - mock_args = dict(project="project_value",) + mock_args = dict( + project="project_value", + ) mock_args.update(sample_request) # Wrap the value into a proper Response obj @@ -958,20 +1041,23 @@ def test_list_rest_flattened(): def test_list_rest_flattened_error(transport: str = "rest"): client = ZonesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list( - compute.ListZonesRequest(), project="project_value", + compute.ListZonesRequest(), + project="project_value", ) def test_list_rest_pager(transport: str = "rest"): client = ZonesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Mock the http request call within the method and fake a response. @@ -981,12 +1067,29 @@ def test_list_rest_pager(transport: str = "rest"): # Set the response as a series of pages response = ( compute.ZoneList( - items=[compute.Zone(), compute.Zone(), compute.Zone(),], + items=[ + compute.Zone(), + compute.Zone(), + compute.Zone(), + ], next_page_token="abc", ), - compute.ZoneList(items=[], next_page_token="def",), - compute.ZoneList(items=[compute.Zone(),], next_page_token="ghi",), - compute.ZoneList(items=[compute.Zone(), compute.Zone(),],), + compute.ZoneList( + items=[], + next_page_token="def", + ), + compute.ZoneList( + items=[ + compute.Zone(), + ], + next_page_token="ghi", + ), + compute.ZoneList( + items=[ + compute.Zone(), + compute.Zone(), + ], + ), ) # Two responses for two calls response = response + response @@ -1019,7 +1122,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ZonesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1039,7 +1143,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = ZonesClient(client_options=options, transport=transport,) + client = ZonesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1055,7 +1162,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ZonesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1068,7 +1176,12 @@ def test_transport_instance(): assert client.transport is transport -@pytest.mark.parametrize("transport_class", [transports.ZonesRestTransport,]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.ZonesRestTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: @@ -1120,7 +1233,8 @@ def test_zones_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ZonesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1172,7 +1286,12 @@ def test_zones_http_transport_client_cert_source_for_mtls(): mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_zones_host_no_port(transport_name): client = ZonesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1188,7 +1307,12 @@ def test_zones_host_no_port(transport_name): ) -@pytest.mark.parametrize("transport_name", ["rest",]) +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) def test_zones_host_with_port(transport_name): client = ZonesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1226,7 +1350,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = ZonesClient.common_folder_path(folder) assert expected == actual @@ -1244,7 +1370,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = ZonesClient.common_organization_path(organization) assert expected == actual @@ -1262,7 +1390,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = ZonesClient.common_project_path(project) assert expected == actual @@ -1282,7 +1412,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = ZonesClient.common_location_path(project, location) assert expected == actual @@ -1305,14 +1436,16 @@ def test_client_with_default_client_info(): with mock.patch.object(transports.ZonesTransport, "_prep_wrapped_messages") as prep: client = ZonesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) with mock.patch.object(transports.ZonesTransport, "_prep_wrapped_messages") as prep: transport_class = ZonesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1351,7 +1484,10 @@ def test_client_ctx(): @pytest.mark.parametrize( - "client_class,transport_class", [(ZonesClient, transports.ZonesRestTransport),] + "client_class,transport_class", + [ + (ZonesClient, transports.ZonesRestTransport), + ], ) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( From 79e73fa2be64908eddb276bab644a964cecfc671 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 1 Apr 2022 00:12:10 +0000 Subject: [PATCH 11/17] chore(python): update .pre-commit-config.yaml to use black==22.3.0 (#251) Source-Link: https://github.com/googleapis/synthtool/commit/7804ade3daae0d66649bee8df6c55484c6580b8d Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:eede5672562a32821444a8e803fb984a6f61f2237ea3de229d2de24453f4ae7d --- .flake8 | 2 +- .github/.OwlBot.lock.yaml | 3 ++- .pre-commit-config.yaml | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.flake8 b/.flake8 index 29227d4cf..2e4387498 100644 --- a/.flake8 +++ b/.flake8 @@ -16,7 +16,7 @@ # Generated by synthtool. DO NOT EDIT! [flake8] -ignore = E203, E266, E501, W503 +ignore = E203, E231, E266, E501, W503 exclude = # Exclude generated code. **/proto/** diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 87dd00611..22cc254af 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe + digest: sha256:eede5672562a32821444a8e803fb984a6f61f2237ea3de229d2de24453f4ae7d +# created: 2022-03-30T23:44:26.560599165Z diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 62eb5a77d..46d237160 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,7 +22,7 @@ repos: - id: end-of-file-fixer - id: check-yaml - repo: https://github.com/psf/black - rev: 19.10b0 + rev: 22.3.0 hooks: - id: black - repo: https://gitlab.com/pycqa/flake8 From 97f0af6688e6e8039388f6f462cb82dc574f84b7 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 1 Apr 2022 02:26:12 +0000 Subject: [PATCH 12/17] chore(python): Enable size-label bot (#252) Source-Link: https://github.com/googleapis/synthtool/commit/06e82790dd719a165ad32b8a06f8f6ec3e3cae0f Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:b3500c053313dc34e07b1632ba9e4e589f4f77036a7cf39e1fe8906811ae0fce --- .github/.OwlBot.lock.yaml | 4 ++-- .github/auto-label.yaml | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 .github/auto-label.yaml diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 22cc254af..58a0b153b 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:eede5672562a32821444a8e803fb984a6f61f2237ea3de229d2de24453f4ae7d -# created: 2022-03-30T23:44:26.560599165Z + digest: sha256:b3500c053313dc34e07b1632ba9e4e589f4f77036a7cf39e1fe8906811ae0fce +# created: 2022-04-01T01:42:03.609279246Z diff --git a/.github/auto-label.yaml b/.github/auto-label.yaml new file mode 100644 index 000000000..09c8d735b --- /dev/null +++ b/.github/auto-label.yaml @@ -0,0 +1,2 @@ +requestsize: + enabled: true From 53411c44af98c2413de205d88e62c2da276eb0e5 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 1 Apr 2022 19:34:31 +0000 Subject: [PATCH 13/17] chore(python): refactor unit / system test dependency install (#253) Source-Link: https://github.com/googleapis/synthtool/commit/993985f0fc4b37152e588f0549bcbdaf34666023 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:1894490910e891a385484514b22eb5133578897eb5b3c380e6d8ad475c6647cd --- .github/.OwlBot.lock.yaml | 4 +- noxfile.py | 105 ++++++++++++++++++++++++++++++-------- 2 files changed, 87 insertions(+), 22 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 58a0b153b..fa5762290 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:b3500c053313dc34e07b1632ba9e4e589f4f77036a7cf39e1fe8906811ae0fce -# created: 2022-04-01T01:42:03.609279246Z + digest: sha256:1894490910e891a385484514b22eb5133578897eb5b3c380e6d8ad475c6647cd +# created: 2022-04-01T15:48:07.524222836Z diff --git a/noxfile.py b/noxfile.py index 6f280fbbb..f03a84e5c 100644 --- a/noxfile.py +++ b/noxfile.py @@ -20,16 +20,40 @@ import os import pathlib import shutil +import warnings import nox - BLACK_VERSION = "black==22.3.0" BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" -SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] + UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"] +UNIT_TEST_STANDARD_DEPENDENCIES = [ + "mock", + "asyncmock", + "pytest", + "pytest-cov", + "pytest-asyncio", +] +UNIT_TEST_EXTERNAL_DEPENDENCIES = [] +UNIT_TEST_LOCAL_DEPENDENCIES = [] +UNIT_TEST_DEPENDENCIES = [] +UNIT_TEST_EXTRAS = [] +UNIT_TEST_EXTRAS_BY_PYTHON = {} + +SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] +SYSTEM_TEST_STANDARD_DEPENDENCIES = [ + "mock", + "pytest", + "google-cloud-testutils", +] +SYSTEM_TEST_EXTERNAL_DEPENDENCIES = [] +SYSTEM_TEST_LOCAL_DEPENDENCIES = [] +SYSTEM_TEST_DEPENDENCIES = [] +SYSTEM_TEST_EXTRAS = [] +SYSTEM_TEST_EXTRAS_BY_PYTHON = {} CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() @@ -81,23 +105,41 @@ def lint_setup_py(session): session.run("python", "setup.py", "check", "--restructuredtext", "--strict") +def install_unittest_dependencies(session, *constraints): + standard_deps = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_DEPENDENCIES + session.install(*standard_deps, *constraints) + + if UNIT_TEST_EXTERNAL_DEPENDENCIES: + warnings.warn( + "'unit_test_external_dependencies' is deprecated. Instead, please " + "use 'unit_test_dependencies' or 'unit_test_local_dependencies'.", + DeprecationWarning, + ) + session.install(*UNIT_TEST_EXTERNAL_DEPENDENCIES, *constraints) + + if UNIT_TEST_LOCAL_DEPENDENCIES: + session.install(*UNIT_TEST_LOCAL_DEPENDENCIES, *constraints) + + if UNIT_TEST_EXTRAS_BY_PYTHON: + extras = UNIT_TEST_EXTRAS_BY_PYTHON.get(session.python, []) + elif UNIT_TEST_EXTRAS: + extras = UNIT_TEST_EXTRAS + else: + extras = [] + + if extras: + session.install("-e", f".[{','.join(extras)}]", *constraints) + else: + session.install("-e", ".", *constraints) + + def default(session): # Install all test dependencies, then install this package in-place. constraints_path = str( CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" ) - session.install( - "mock", - "asyncmock", - "pytest", - "pytest-cov", - "pytest-asyncio", - "-c", - constraints_path, - ) - - session.install("-e", ".", "-c", constraints_path) + install_unittest_dependencies(session, "-c", constraints_path) # Run py.test against the unit tests. session.run( @@ -121,6 +163,35 @@ def unit(session): default(session) +def install_systemtest_dependencies(session, *constraints): + + # Use pre-release gRPC for system tests. + session.install("--pre", "grpcio") + + session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_EXTERNAL_DEPENDENCIES: + session.install(*SYSTEM_TEST_EXTERNAL_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_LOCAL_DEPENDENCIES: + session.install("-e", *SYSTEM_TEST_LOCAL_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_DEPENDENCIES: + session.install("-e", *SYSTEM_TEST_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_EXTRAS_BY_PYTHON: + extras = SYSTEM_TEST_EXTRAS_BY_PYTHON.get(session.python, []) + elif SYSTEM_TEST_EXTRAS: + extras = SYSTEM_TEST_EXTRAS + else: + extras = [] + + if extras: + session.install("-e", f".[{','.join(extras)}]", *constraints) + else: + session.install("-e", ".", *constraints) + + @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) def system(session): """Run the system test suite.""" @@ -143,13 +214,7 @@ def system(session): if not system_test_exists and not system_test_folder_exists: session.skip("System tests were not found") - # Use pre-release gRPC for system tests. - session.install("--pre", "grpcio") - - # Install all test dependencies, then install this package into the - # virtualenv's dist-packages. - session.install("mock", "pytest", "google-cloud-testutils", "-c", constraints_path) - session.install("-e", ".", "-c", constraints_path) + install_systemtest_dependencies(session, "-c", constraints_path) # Run py.test against the system tests. if system_test_exists: From 964b4b3177a63a0abc9e1f83800ad3db78f94cb2 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Tue, 5 Apr 2022 11:15:04 -0400 Subject: [PATCH 14/17] chore: allow releases on previous major versions (#254) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: allow releases on previous major versions * 🦉 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 --- .github/release-please.yml | 6 ++++++ owlbot.py | 2 ++ 2 files changed, 8 insertions(+) diff --git a/.github/release-please.yml b/.github/release-please.yml index 466597e5b..6def37a84 100644 --- a/.github/release-please.yml +++ b/.github/release-please.yml @@ -1,2 +1,8 @@ releaseType: python handleGHRelease: true +# NOTE: this section is generated by synthtool.languages.python +# See https://github.com/googleapis/synthtool/blob/master/synthtool/languages/python.py +branches: +- branch: v0 + handleGHRelease: true + releaseType: python diff --git a/owlbot.py b/owlbot.py index 8602567f4..f9d8ca61c 100644 --- a/owlbot.py +++ b/owlbot.py @@ -60,6 +60,8 @@ python.py_samples(skip_readmes=True) +python.configure_previous_major_version_branches() + # ---------------------------------------------------------------------------- # Run blacken session for all directories with a noxfile # ---------------------------------------------------------------------------- From 034ba65f2753b5f487d5c70948e1bc8e453fa7c5 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 6 Apr 2022 11:18:11 +0000 Subject: [PATCH 15/17] chore(python): add license header to auto-label.yaml (#255) Source-Link: https://github.com/googleapis/synthtool/commit/eb78c980b52c7c6746d2edb77d9cf7aaa99a2aab Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:8a5d3f6a2e43ed8293f34e06a2f56931d1e88a2694c3bb11b15df4eb256ad163 --- .github/.OwlBot.lock.yaml | 4 ++-- .github/auto-label.yaml | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index fa5762290..bc893c979 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:1894490910e891a385484514b22eb5133578897eb5b3c380e6d8ad475c6647cd -# created: 2022-04-01T15:48:07.524222836Z + digest: sha256:8a5d3f6a2e43ed8293f34e06a2f56931d1e88a2694c3bb11b15df4eb256ad163 +# created: 2022-04-06T10:30:21.687684602Z diff --git a/.github/auto-label.yaml b/.github/auto-label.yaml index 09c8d735b..41bff0b53 100644 --- a/.github/auto-label.yaml +++ b/.github/auto-label.yaml @@ -1,2 +1,15 @@ +# Copyright 2022 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. requestsize: enabled: true From 84604a1966dee9dfdb1359a871d9b741c0bf2eaf Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 7 Apr 2022 22:36:38 +0000 Subject: [PATCH 16/17] fix: fix type in docstring for map fields (#256) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 440107808 Source-Link: https://github.com/googleapis/googleapis/commit/258ddb27e2d1ff35096699244f0f621de8cc394c Source-Link: https://github.com/googleapis/googleapis-gen/commit/df0d09a2c36ff5baf98648eefe5029c173905d0b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZGYwZDA5YTJjMzZmZjViYWY5ODY0OGVlZmU1MDI5YzE3MzkwNWQwYiJ9 feat: update compute API to revision 20220322 (#710) Source-Link: https://github.com/googleapis/googleapis/commit/68ad73b682843a999107f30d18ac42d13593a31a Source-Link: https://github.com/googleapis/googleapis-gen/commit/a581672061b9481c0192de03bbfa3464e0233811 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYTU4MTY3MjA2MWI5NDgxYzAxOTJkZTAzYmJmYTM0NjRlMDIzMzgxMSJ9 --- compute-v1-py.tar.gz | 0 .../network_edge_security_services.rst | 10 + docs/compute_v1/network_firewall_policies.rst | 10 + .../region_network_firewall_policies.rst | 10 + docs/compute_v1/region_security_policies.rst | 10 + docs/compute_v1/services.rst | 4 + google/cloud/compute/__init__.py | 194 + google/cloud/compute_v1/__init__.py | 128 + google/cloud/compute_v1/gapic_metadata.json | 261 + .../compute_v1/services/instances/client.py | 2 +- .../__init__.py | 18 + .../network_edge_security_services/client.py | 933 +++ .../network_edge_security_services/pagers.py | 96 + .../transports/__init__.py | 34 + .../transports/base.py | 214 + .../transports/rest.py | 926 +++ .../network_firewall_policies/__init__.py | 18 + .../network_firewall_policies/client.py | 1960 +++++ .../network_firewall_policies/pagers.py | 89 + .../transports/__init__.py | 34 + .../transports/base.py | 367 + .../transports/rest.py | 2619 ++++++ .../__init__.py | 18 + .../client.py | 2246 ++++++ .../pagers.py | 89 + .../transports/__init__.py | 34 + .../transports/base.py | 386 + .../transports/rest.py | 2826 +++++++ .../region_security_policies/__init__.py | 18 + .../region_security_policies/client.py | 927 +++ .../region_security_policies/pagers.py | 89 + .../transports/__init__.py | 34 + .../transports/base.py | 208 + .../transports/rest.py | 903 +++ .../region_target_https_proxies/client.py | 113 + .../transports/base.py | 14 + .../transports/rest.py | 154 + .../services/security_policies/client.py | 82 + .../services/security_policies/pagers.py | 65 + .../security_policies/transports/base.py | 17 + .../security_policies/transports/rest.py | 140 + google/cloud/compute_v1/types/__init__.py | 116 + google/cloud/compute_v1/types/compute.py | 6979 ++++++++++++---- .../compute_v1/test_accelerator_types.py | 8 +- tests/unit/gapic/compute_v1/test_addresses.py | 8 +- .../unit/gapic/compute_v1/test_autoscalers.py | 8 +- .../gapic/compute_v1/test_backend_buckets.py | 8 +- .../gapic/compute_v1/test_backend_services.py | 50 +- .../unit/gapic/compute_v1/test_disk_types.py | 8 +- tests/unit/gapic/compute_v1/test_disks.py | 8 +- .../compute_v1/test_external_vpn_gateways.py | 8 +- .../compute_v1/test_firewall_policies.py | 40 +- tests/unit/gapic/compute_v1/test_firewalls.py | 8 +- .../gapic/compute_v1/test_forwarding_rules.py | 8 +- .../gapic/compute_v1/test_global_addresses.py | 8 +- .../test_global_forwarding_rules.py | 8 +- .../test_global_network_endpoint_groups.py | 8 +- .../compute_v1/test_global_operations.py | 8 +- .../test_global_organization_operations.py | 8 +- .../test_global_public_delegated_prefixes.py | 8 +- .../gapic/compute_v1/test_health_checks.py | 8 +- .../compute_v1/test_image_family_views.py | 8 +- tests/unit/gapic/compute_v1/test_images.py | 8 +- .../test_instance_group_managers.py | 8 +- .../gapic/compute_v1/test_instance_groups.py | 8 +- .../compute_v1/test_instance_templates.py | 10 +- tests/unit/gapic/compute_v1/test_instances.py | 20 +- .../test_interconnect_attachments.py | 8 +- .../compute_v1/test_interconnect_locations.py | 8 +- .../gapic/compute_v1/test_interconnects.py | 8 +- .../gapic/compute_v1/test_license_codes.py | 8 +- tests/unit/gapic/compute_v1/test_licenses.py | 8 +- .../gapic/compute_v1/test_machine_images.py | 10 +- .../gapic/compute_v1/test_machine_types.py | 8 +- .../test_network_edge_security_services.py | 2720 +++++++ .../test_network_endpoint_groups.py | 8 +- .../test_network_firewall_policies.py | 6465 +++++++++++++++ tests/unit/gapic/compute_v1/test_networks.py | 35 +- .../unit/gapic/compute_v1/test_node_groups.py | 8 +- .../gapic/compute_v1/test_node_templates.py | 8 +- .../unit/gapic/compute_v1/test_node_types.py | 8 +- .../compute_v1/test_packet_mirrorings.py | 8 +- tests/unit/gapic/compute_v1/test_projects.py | 8 +- .../test_public_advertised_prefixes.py | 8 +- .../test_public_delegated_prefixes.py | 8 +- .../compute_v1/test_region_autoscalers.py | 8 +- .../test_region_backend_services.py | 50 +- .../compute_v1/test_region_commitments.py | 12 +- .../compute_v1/test_region_disk_types.py | 8 +- .../gapic/compute_v1/test_region_disks.py | 8 +- .../test_region_health_check_services.py | 8 +- .../compute_v1/test_region_health_checks.py | 8 +- .../test_region_instance_group_managers.py | 8 +- .../compute_v1/test_region_instance_groups.py | 8 +- .../gapic/compute_v1/test_region_instances.py | 10 +- .../test_region_network_endpoint_groups.py | 8 +- .../test_region_network_firewall_policies.py | 7059 +++++++++++++++++ .../test_region_notification_endpoints.py | 8 +- .../compute_v1/test_region_operations.py | 8 +- .../test_region_security_policies.py | 2899 +++++++ .../test_region_ssl_certificates.py | 8 +- .../test_region_target_http_proxies.py | 8 +- .../test_region_target_https_proxies.py | 383 +- .../gapic/compute_v1/test_region_url_maps.py | 8 +- tests/unit/gapic/compute_v1/test_regions.py | 8 +- .../gapic/compute_v1/test_reservations.py | 12 +- .../compute_v1/test_resource_policies.py | 8 +- tests/unit/gapic/compute_v1/test_routers.py | 8 +- tests/unit/gapic/compute_v1/test_routes.py | 12 +- .../compute_v1/test_security_policies.py | 380 +- .../compute_v1/test_service_attachments.py | 8 +- tests/unit/gapic/compute_v1/test_snapshots.py | 8 +- .../gapic/compute_v1/test_ssl_certificates.py | 8 +- .../gapic/compute_v1/test_ssl_policies.py | 8 +- .../unit/gapic/compute_v1/test_subnetworks.py | 14 +- .../compute_v1/test_target_grpc_proxies.py | 8 +- .../compute_v1/test_target_http_proxies.py | 8 +- .../compute_v1/test_target_https_proxies.py | 8 +- .../gapic/compute_v1/test_target_instances.py | 8 +- .../gapic/compute_v1/test_target_pools.py | 8 +- .../compute_v1/test_target_ssl_proxies.py | 8 +- .../compute_v1/test_target_tcp_proxies.py | 8 +- .../compute_v1/test_target_vpn_gateways.py | 8 +- tests/unit/gapic/compute_v1/test_url_maps.py | 24 +- .../gapic/compute_v1/test_vpn_gateways.py | 8 +- .../unit/gapic/compute_v1/test_vpn_tunnels.py | 8 +- .../gapic/compute_v1/test_zone_operations.py | 8 +- tests/unit/gapic/compute_v1/test_zones.py | 8 +- 128 files changed, 42133 insertions(+), 1995 deletions(-) create mode 100644 compute-v1-py.tar.gz create mode 100644 docs/compute_v1/network_edge_security_services.rst create mode 100644 docs/compute_v1/network_firewall_policies.rst create mode 100644 docs/compute_v1/region_network_firewall_policies.rst create mode 100644 docs/compute_v1/region_security_policies.rst create mode 100644 google/cloud/compute_v1/services/network_edge_security_services/__init__.py create mode 100644 google/cloud/compute_v1/services/network_edge_security_services/client.py create mode 100644 google/cloud/compute_v1/services/network_edge_security_services/pagers.py create mode 100644 google/cloud/compute_v1/services/network_edge_security_services/transports/__init__.py create mode 100644 google/cloud/compute_v1/services/network_edge_security_services/transports/base.py create mode 100644 google/cloud/compute_v1/services/network_edge_security_services/transports/rest.py create mode 100644 google/cloud/compute_v1/services/network_firewall_policies/__init__.py create mode 100644 google/cloud/compute_v1/services/network_firewall_policies/client.py create mode 100644 google/cloud/compute_v1/services/network_firewall_policies/pagers.py create mode 100644 google/cloud/compute_v1/services/network_firewall_policies/transports/__init__.py create mode 100644 google/cloud/compute_v1/services/network_firewall_policies/transports/base.py create mode 100644 google/cloud/compute_v1/services/network_firewall_policies/transports/rest.py create mode 100644 google/cloud/compute_v1/services/region_network_firewall_policies/__init__.py create mode 100644 google/cloud/compute_v1/services/region_network_firewall_policies/client.py create mode 100644 google/cloud/compute_v1/services/region_network_firewall_policies/pagers.py create mode 100644 google/cloud/compute_v1/services/region_network_firewall_policies/transports/__init__.py create mode 100644 google/cloud/compute_v1/services/region_network_firewall_policies/transports/base.py create mode 100644 google/cloud/compute_v1/services/region_network_firewall_policies/transports/rest.py create mode 100644 google/cloud/compute_v1/services/region_security_policies/__init__.py create mode 100644 google/cloud/compute_v1/services/region_security_policies/client.py create mode 100644 google/cloud/compute_v1/services/region_security_policies/pagers.py create mode 100644 google/cloud/compute_v1/services/region_security_policies/transports/__init__.py create mode 100644 google/cloud/compute_v1/services/region_security_policies/transports/base.py create mode 100644 google/cloud/compute_v1/services/region_security_policies/transports/rest.py create mode 100644 tests/unit/gapic/compute_v1/test_network_edge_security_services.py create mode 100644 tests/unit/gapic/compute_v1/test_network_firewall_policies.py create mode 100644 tests/unit/gapic/compute_v1/test_region_network_firewall_policies.py create mode 100644 tests/unit/gapic/compute_v1/test_region_security_policies.py diff --git a/compute-v1-py.tar.gz b/compute-v1-py.tar.gz new file mode 100644 index 000000000..e69de29bb diff --git a/docs/compute_v1/network_edge_security_services.rst b/docs/compute_v1/network_edge_security_services.rst new file mode 100644 index 000000000..d0bb5841f --- /dev/null +++ b/docs/compute_v1/network_edge_security_services.rst @@ -0,0 +1,10 @@ +NetworkEdgeSecurityServices +--------------------------------------------- + +.. automodule:: google.cloud.compute_v1.services.network_edge_security_services + :members: + :inherited-members: + +.. automodule:: google.cloud.compute_v1.services.network_edge_security_services.pagers + :members: + :inherited-members: diff --git a/docs/compute_v1/network_firewall_policies.rst b/docs/compute_v1/network_firewall_policies.rst new file mode 100644 index 000000000..c3fddc831 --- /dev/null +++ b/docs/compute_v1/network_firewall_policies.rst @@ -0,0 +1,10 @@ +NetworkFirewallPolicies +----------------------------------------- + +.. automodule:: google.cloud.compute_v1.services.network_firewall_policies + :members: + :inherited-members: + +.. automodule:: google.cloud.compute_v1.services.network_firewall_policies.pagers + :members: + :inherited-members: diff --git a/docs/compute_v1/region_network_firewall_policies.rst b/docs/compute_v1/region_network_firewall_policies.rst new file mode 100644 index 000000000..4cfb4d6d5 --- /dev/null +++ b/docs/compute_v1/region_network_firewall_policies.rst @@ -0,0 +1,10 @@ +RegionNetworkFirewallPolicies +----------------------------------------------- + +.. automodule:: google.cloud.compute_v1.services.region_network_firewall_policies + :members: + :inherited-members: + +.. automodule:: google.cloud.compute_v1.services.region_network_firewall_policies.pagers + :members: + :inherited-members: diff --git a/docs/compute_v1/region_security_policies.rst b/docs/compute_v1/region_security_policies.rst new file mode 100644 index 000000000..5df2bfdce --- /dev/null +++ b/docs/compute_v1/region_security_policies.rst @@ -0,0 +1,10 @@ +RegionSecurityPolicies +---------------------------------------- + +.. automodule:: google.cloud.compute_v1.services.region_security_policies + :members: + :inherited-members: + +.. automodule:: google.cloud.compute_v1.services.region_security_policies.pagers + :members: + :inherited-members: diff --git a/docs/compute_v1/services.rst b/docs/compute_v1/services.rst index 8e2fb6de4..0e7da9842 100644 --- a/docs/compute_v1/services.rst +++ b/docs/compute_v1/services.rst @@ -34,7 +34,9 @@ Services for Google Cloud Compute v1 API licenses machine_images machine_types + network_edge_security_services network_endpoint_groups + network_firewall_policies networks node_groups node_templates @@ -54,9 +56,11 @@ Services for Google Cloud Compute v1 API region_instance_groups region_instances region_network_endpoint_groups + region_network_firewall_policies region_notification_endpoints region_operations regions + region_security_policies region_ssl_certificates region_target_http_proxies region_target_https_proxies diff --git a/google/cloud/compute/__init__.py b/google/cloud/compute/__init__.py index 8e342a080..00e8a1a5e 100644 --- a/google/cloud/compute/__init__.py +++ b/google/cloud/compute/__init__.py @@ -77,9 +77,15 @@ from google.cloud.compute_v1.services.licenses.client import LicensesClient from google.cloud.compute_v1.services.machine_images.client import MachineImagesClient from google.cloud.compute_v1.services.machine_types.client import MachineTypesClient +from google.cloud.compute_v1.services.network_edge_security_services.client import ( + NetworkEdgeSecurityServicesClient, +) from google.cloud.compute_v1.services.network_endpoint_groups.client import ( NetworkEndpointGroupsClient, ) +from google.cloud.compute_v1.services.network_firewall_policies.client import ( + NetworkFirewallPoliciesClient, +) from google.cloud.compute_v1.services.networks.client import NetworksClient from google.cloud.compute_v1.services.node_groups.client import NodeGroupsClient from google.cloud.compute_v1.services.node_templates.client import NodeTemplatesClient @@ -125,6 +131,9 @@ from google.cloud.compute_v1.services.region_network_endpoint_groups.client import ( RegionNetworkEndpointGroupsClient, ) +from google.cloud.compute_v1.services.region_network_firewall_policies.client import ( + RegionNetworkFirewallPoliciesClient, +) from google.cloud.compute_v1.services.region_notification_endpoints.client import ( RegionNotificationEndpointsClient, ) @@ -132,6 +141,9 @@ RegionOperationsClient, ) from google.cloud.compute_v1.services.regions.client import RegionsClient +from google.cloud.compute_v1.services.region_security_policies.client import ( + RegionSecurityPoliciesClient, +) from google.cloud.compute_v1.services.region_ssl_certificates.client import ( RegionSslCertificatesClient, ) @@ -203,6 +215,12 @@ from google.cloud.compute_v1.types.compute import AccessConfig from google.cloud.compute_v1.types.compute import AddAccessConfigInstanceRequest from google.cloud.compute_v1.types.compute import AddAssociationFirewallPolicyRequest +from google.cloud.compute_v1.types.compute import ( + AddAssociationNetworkFirewallPolicyRequest, +) +from google.cloud.compute_v1.types.compute import ( + AddAssociationRegionNetworkFirewallPolicyRequest, +) from google.cloud.compute_v1.types.compute import AddHealthCheckTargetPoolRequest from google.cloud.compute_v1.types.compute import AddInstancesInstanceGroupRequest from google.cloud.compute_v1.types.compute import AddInstanceTargetPoolRequest @@ -216,6 +234,10 @@ from google.cloud.compute_v1.types.compute import AddressesScopedList from google.cloud.compute_v1.types.compute import AddressList from google.cloud.compute_v1.types.compute import AddRuleFirewallPolicyRequest +from google.cloud.compute_v1.types.compute import AddRuleNetworkFirewallPolicyRequest +from google.cloud.compute_v1.types.compute import ( + AddRuleRegionNetworkFirewallPolicyRequest, +) from google.cloud.compute_v1.types.compute import AddRuleSecurityPolicyRequest from google.cloud.compute_v1.types.compute import AddSignedUrlKeyBackendBucketRequest from google.cloud.compute_v1.types.compute import AddSignedUrlKeyBackendServiceRequest @@ -238,6 +260,9 @@ AggregatedListInterconnectAttachmentsRequest, ) from google.cloud.compute_v1.types.compute import AggregatedListMachineTypesRequest +from google.cloud.compute_v1.types.compute import ( + AggregatedListNetworkEdgeSecurityServicesRequest, +) from google.cloud.compute_v1.types.compute import ( AggregatedListNetworkEndpointGroupsRequest, ) @@ -252,6 +277,7 @@ from google.cloud.compute_v1.types.compute import AggregatedListReservationsRequest from google.cloud.compute_v1.types.compute import AggregatedListResourcePoliciesRequest from google.cloud.compute_v1.types.compute import AggregatedListRoutersRequest +from google.cloud.compute_v1.types.compute import AggregatedListSecurityPoliciesRequest from google.cloud.compute_v1.types.compute import ( AggregatedListServiceAttachmentsRequest, ) @@ -334,6 +360,15 @@ from google.cloud.compute_v1.types.compute import BackendServiceGroupHealth from google.cloud.compute_v1.types.compute import BackendServiceIAP from google.cloud.compute_v1.types.compute import BackendServiceList +from google.cloud.compute_v1.types.compute import ( + BackendServiceLocalityLoadBalancingPolicyConfig, +) +from google.cloud.compute_v1.types.compute import ( + BackendServiceLocalityLoadBalancingPolicyConfigCustomPolicy, +) +from google.cloud.compute_v1.types.compute import ( + BackendServiceLocalityLoadBalancingPolicyConfigPolicy, +) from google.cloud.compute_v1.types.compute import BackendServiceLogConfig from google.cloud.compute_v1.types.compute import BackendServiceReference from google.cloud.compute_v1.types.compute import BackendServicesScopedList @@ -351,6 +386,10 @@ from google.cloud.compute_v1.types.compute import CacheKeyPolicy from google.cloud.compute_v1.types.compute import CircuitBreakers from google.cloud.compute_v1.types.compute import CloneRulesFirewallPolicyRequest +from google.cloud.compute_v1.types.compute import CloneRulesNetworkFirewallPolicyRequest +from google.cloud.compute_v1.types.compute import ( + CloneRulesRegionNetworkFirewallPolicyRequest, +) from google.cloud.compute_v1.types.compute import Commitment from google.cloud.compute_v1.types.compute import CommitmentAggregatedList from google.cloud.compute_v1.types.compute import CommitmentList @@ -416,7 +455,11 @@ from google.cloud.compute_v1.types.compute import DeleteInterconnectRequest from google.cloud.compute_v1.types.compute import DeleteLicenseRequest from google.cloud.compute_v1.types.compute import DeleteMachineImageRequest +from google.cloud.compute_v1.types.compute import ( + DeleteNetworkEdgeSecurityServiceRequest, +) from google.cloud.compute_v1.types.compute import DeleteNetworkEndpointGroupRequest +from google.cloud.compute_v1.types.compute import DeleteNetworkFirewallPolicyRequest from google.cloud.compute_v1.types.compute import DeleteNetworkRequest from google.cloud.compute_v1.types.compute import DeleteNodeGroupRequest from google.cloud.compute_v1.types.compute import DeleteNodesNodeGroupRequest @@ -441,11 +484,15 @@ from google.cloud.compute_v1.types.compute import ( DeleteRegionNetworkEndpointGroupRequest, ) +from google.cloud.compute_v1.types.compute import ( + DeleteRegionNetworkFirewallPolicyRequest, +) from google.cloud.compute_v1.types.compute import ( DeleteRegionNotificationEndpointRequest, ) from google.cloud.compute_v1.types.compute import DeleteRegionOperationRequest from google.cloud.compute_v1.types.compute import DeleteRegionOperationResponse +from google.cloud.compute_v1.types.compute import DeleteRegionSecurityPolicyRequest from google.cloud.compute_v1.types.compute import DeleteRegionSslCertificateRequest from google.cloud.compute_v1.types.compute import DeleteRegionTargetHttpProxyRequest from google.cloud.compute_v1.types.compute import DeleteRegionTargetHttpsProxyRequest @@ -530,6 +577,7 @@ from google.cloud.compute_v1.types.compute import FirewallPolicyRule from google.cloud.compute_v1.types.compute import FirewallPolicyRuleMatcher from google.cloud.compute_v1.types.compute import FirewallPolicyRuleMatcherLayer4Config +from google.cloud.compute_v1.types.compute import FirewallPolicyRuleSecureTag from google.cloud.compute_v1.types.compute import FixedOrPercent from google.cloud.compute_v1.types.compute import ForwardingRule from google.cloud.compute_v1.types.compute import ForwardingRuleAggregatedList @@ -542,6 +590,12 @@ from google.cloud.compute_v1.types.compute import GetAcceleratorTypeRequest from google.cloud.compute_v1.types.compute import GetAddressRequest from google.cloud.compute_v1.types.compute import GetAssociationFirewallPolicyRequest +from google.cloud.compute_v1.types.compute import ( + GetAssociationNetworkFirewallPolicyRequest, +) +from google.cloud.compute_v1.types.compute import ( + GetAssociationRegionNetworkFirewallPolicyRequest, +) from google.cloud.compute_v1.types.compute import GetAutoscalerRequest from google.cloud.compute_v1.types.compute import GetBackendBucketRequest from google.cloud.compute_v1.types.compute import GetBackendServiceRequest @@ -550,6 +604,9 @@ from google.cloud.compute_v1.types.compute import GetDiskTypeRequest from google.cloud.compute_v1.types.compute import GetEffectiveFirewallsInstanceRequest from google.cloud.compute_v1.types.compute import GetEffectiveFirewallsNetworkRequest +from google.cloud.compute_v1.types.compute import ( + GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest, +) from google.cloud.compute_v1.types.compute import GetExternalVpnGatewayRequest from google.cloud.compute_v1.types.compute import GetFirewallPolicyRequest from google.cloud.compute_v1.types.compute import GetFirewallRequest @@ -573,9 +630,15 @@ from google.cloud.compute_v1.types.compute import GetIamPolicyInstanceTemplateRequest from google.cloud.compute_v1.types.compute import GetIamPolicyLicenseRequest from google.cloud.compute_v1.types.compute import GetIamPolicyMachineImageRequest +from google.cloud.compute_v1.types.compute import ( + GetIamPolicyNetworkFirewallPolicyRequest, +) from google.cloud.compute_v1.types.compute import GetIamPolicyNodeGroupRequest from google.cloud.compute_v1.types.compute import GetIamPolicyNodeTemplateRequest from google.cloud.compute_v1.types.compute import GetIamPolicyRegionDiskRequest +from google.cloud.compute_v1.types.compute import ( + GetIamPolicyRegionNetworkFirewallPolicyRequest, +) from google.cloud.compute_v1.types.compute import GetIamPolicyReservationRequest from google.cloud.compute_v1.types.compute import GetIamPolicyResourcePolicyRequest from google.cloud.compute_v1.types.compute import GetIamPolicyServiceAttachmentRequest @@ -595,7 +658,9 @@ from google.cloud.compute_v1.types.compute import GetMachineImageRequest from google.cloud.compute_v1.types.compute import GetMachineTypeRequest from google.cloud.compute_v1.types.compute import GetNatMappingInfoRoutersRequest +from google.cloud.compute_v1.types.compute import GetNetworkEdgeSecurityServiceRequest from google.cloud.compute_v1.types.compute import GetNetworkEndpointGroupRequest +from google.cloud.compute_v1.types.compute import GetNetworkFirewallPolicyRequest from google.cloud.compute_v1.types.compute import GetNetworkRequest from google.cloud.compute_v1.types.compute import GetNodeGroupRequest from google.cloud.compute_v1.types.compute import GetNodeTemplateRequest @@ -614,9 +679,11 @@ from google.cloud.compute_v1.types.compute import GetRegionInstanceGroupManagerRequest from google.cloud.compute_v1.types.compute import GetRegionInstanceGroupRequest from google.cloud.compute_v1.types.compute import GetRegionNetworkEndpointGroupRequest +from google.cloud.compute_v1.types.compute import GetRegionNetworkFirewallPolicyRequest from google.cloud.compute_v1.types.compute import GetRegionNotificationEndpointRequest from google.cloud.compute_v1.types.compute import GetRegionOperationRequest from google.cloud.compute_v1.types.compute import GetRegionRequest +from google.cloud.compute_v1.types.compute import GetRegionSecurityPolicyRequest from google.cloud.compute_v1.types.compute import GetRegionSslCertificateRequest from google.cloud.compute_v1.types.compute import GetRegionTargetHttpProxyRequest from google.cloud.compute_v1.types.compute import GetRegionTargetHttpsProxyRequest @@ -627,6 +694,10 @@ from google.cloud.compute_v1.types.compute import GetRouterRequest from google.cloud.compute_v1.types.compute import GetRouterStatusRouterRequest from google.cloud.compute_v1.types.compute import GetRuleFirewallPolicyRequest +from google.cloud.compute_v1.types.compute import GetRuleNetworkFirewallPolicyRequest +from google.cloud.compute_v1.types.compute import ( + GetRuleRegionNetworkFirewallPolicyRequest, +) from google.cloud.compute_v1.types.compute import GetRuleSecurityPolicyRequest from google.cloud.compute_v1.types.compute import GetScreenshotInstanceRequest from google.cloud.compute_v1.types.compute import GetSecurityPolicyRequest @@ -727,7 +798,11 @@ from google.cloud.compute_v1.types.compute import InsertInterconnectRequest from google.cloud.compute_v1.types.compute import InsertLicenseRequest from google.cloud.compute_v1.types.compute import InsertMachineImageRequest +from google.cloud.compute_v1.types.compute import ( + InsertNetworkEdgeSecurityServiceRequest, +) from google.cloud.compute_v1.types.compute import InsertNetworkEndpointGroupRequest +from google.cloud.compute_v1.types.compute import InsertNetworkFirewallPolicyRequest from google.cloud.compute_v1.types.compute import InsertNetworkRequest from google.cloud.compute_v1.types.compute import InsertNodeGroupRequest from google.cloud.compute_v1.types.compute import InsertNodeTemplateRequest @@ -746,9 +821,13 @@ from google.cloud.compute_v1.types.compute import ( InsertRegionNetworkEndpointGroupRequest, ) +from google.cloud.compute_v1.types.compute import ( + InsertRegionNetworkFirewallPolicyRequest, +) from google.cloud.compute_v1.types.compute import ( InsertRegionNotificationEndpointRequest, ) +from google.cloud.compute_v1.types.compute import InsertRegionSecurityPolicyRequest from google.cloud.compute_v1.types.compute import InsertRegionSslCertificateRequest from google.cloud.compute_v1.types.compute import InsertRegionTargetHttpProxyRequest from google.cloud.compute_v1.types.compute import InsertRegionTargetHttpsProxyRequest @@ -850,6 +929,7 @@ InstanceManagedByIgmErrorManagedInstanceError, ) from google.cloud.compute_v1.types.compute import InstanceMoveRequest +from google.cloud.compute_v1.types.compute import InstanceParams from google.cloud.compute_v1.types.compute import InstanceProperties from google.cloud.compute_v1.types.compute import InstanceReference from google.cloud.compute_v1.types.compute import InstancesAddResourcePoliciesRequest @@ -956,6 +1036,7 @@ from google.cloud.compute_v1.types.compute import ( ListNetworkEndpointsNetworkEndpointGroupsRequest, ) +from google.cloud.compute_v1.types.compute import ListNetworkFirewallPoliciesRequest from google.cloud.compute_v1.types.compute import ListNetworksRequest from google.cloud.compute_v1.types.compute import ListNodeGroupsRequest from google.cloud.compute_v1.types.compute import ListNodesNodeGroupsRequest @@ -985,8 +1066,12 @@ from google.cloud.compute_v1.types.compute import ListRegionInstanceGroupManagersRequest from google.cloud.compute_v1.types.compute import ListRegionInstanceGroupsRequest from google.cloud.compute_v1.types.compute import ListRegionNetworkEndpointGroupsRequest +from google.cloud.compute_v1.types.compute import ( + ListRegionNetworkFirewallPoliciesRequest, +) from google.cloud.compute_v1.types.compute import ListRegionNotificationEndpointsRequest from google.cloud.compute_v1.types.compute import ListRegionOperationsRequest +from google.cloud.compute_v1.types.compute import ListRegionSecurityPoliciesRequest from google.cloud.compute_v1.types.compute import ListRegionsRequest from google.cloud.compute_v1.types.compute import ListRegionSslCertificatesRequest from google.cloud.compute_v1.types.compute import ListRegionTargetHttpProxiesRequest @@ -1043,6 +1128,11 @@ from google.cloud.compute_v1.types.compute import MoveInstanceProjectRequest from google.cloud.compute_v1.types.compute import NamedPort from google.cloud.compute_v1.types.compute import Network +from google.cloud.compute_v1.types.compute import NetworkEdgeSecurityService +from google.cloud.compute_v1.types.compute import ( + NetworkEdgeSecurityServiceAggregatedList, +) +from google.cloud.compute_v1.types.compute import NetworkEdgeSecurityServicesScopedList from google.cloud.compute_v1.types.compute import NetworkEndpoint from google.cloud.compute_v1.types.compute import NetworkEndpointGroup from google.cloud.compute_v1.types.compute import NetworkEndpointGroupAggregatedList @@ -1134,6 +1224,8 @@ from google.cloud.compute_v1.types.compute import PatchInstanceGroupManagerRequest from google.cloud.compute_v1.types.compute import PatchInterconnectAttachmentRequest from google.cloud.compute_v1.types.compute import PatchInterconnectRequest +from google.cloud.compute_v1.types.compute import PatchNetworkEdgeSecurityServiceRequest +from google.cloud.compute_v1.types.compute import PatchNetworkFirewallPolicyRequest from google.cloud.compute_v1.types.compute import PatchNetworkRequest from google.cloud.compute_v1.types.compute import PatchNodeGroupRequest from google.cloud.compute_v1.types.compute import PatchPacketMirroringRequest @@ -1150,9 +1242,18 @@ from google.cloud.compute_v1.types.compute import PatchRegionHealthCheckRequest from google.cloud.compute_v1.types.compute import PatchRegionHealthCheckServiceRequest from google.cloud.compute_v1.types.compute import PatchRegionInstanceGroupManagerRequest +from google.cloud.compute_v1.types.compute import ( + PatchRegionNetworkFirewallPolicyRequest, +) +from google.cloud.compute_v1.types.compute import PatchRegionSecurityPolicyRequest +from google.cloud.compute_v1.types.compute import PatchRegionTargetHttpsProxyRequest from google.cloud.compute_v1.types.compute import PatchRegionUrlMapRequest from google.cloud.compute_v1.types.compute import PatchRouterRequest from google.cloud.compute_v1.types.compute import PatchRuleFirewallPolicyRequest +from google.cloud.compute_v1.types.compute import PatchRuleNetworkFirewallPolicyRequest +from google.cloud.compute_v1.types.compute import ( + PatchRuleRegionNetworkFirewallPolicyRequest, +) from google.cloud.compute_v1.types.compute import PatchRuleSecurityPolicyRequest from google.cloud.compute_v1.types.compute import PatchSecurityPolicyRequest from google.cloud.compute_v1.types.compute import PatchServiceAttachmentRequest @@ -1254,6 +1355,12 @@ RegionInstanceGroupsSetNamedPortsRequest, ) from google.cloud.compute_v1.types.compute import RegionList +from google.cloud.compute_v1.types.compute import ( + RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse, +) +from google.cloud.compute_v1.types.compute import ( + RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponseEffectiveFirewallPolicy, +) from google.cloud.compute_v1.types.compute import RegionSetLabelsRequest from google.cloud.compute_v1.types.compute import RegionSetPolicyRequest from google.cloud.compute_v1.types.compute import ( @@ -1261,6 +1368,12 @@ ) from google.cloud.compute_v1.types.compute import RegionUrlMapsValidateRequest from google.cloud.compute_v1.types.compute import RemoveAssociationFirewallPolicyRequest +from google.cloud.compute_v1.types.compute import ( + RemoveAssociationNetworkFirewallPolicyRequest, +) +from google.cloud.compute_v1.types.compute import ( + RemoveAssociationRegionNetworkFirewallPolicyRequest, +) from google.cloud.compute_v1.types.compute import RemoveHealthCheckTargetPoolRequest from google.cloud.compute_v1.types.compute import RemoveInstancesInstanceGroupRequest from google.cloud.compute_v1.types.compute import RemoveInstanceTargetPoolRequest @@ -1271,6 +1384,10 @@ RemoveResourcePoliciesRegionDiskRequest, ) from google.cloud.compute_v1.types.compute import RemoveRuleFirewallPolicyRequest +from google.cloud.compute_v1.types.compute import RemoveRuleNetworkFirewallPolicyRequest +from google.cloud.compute_v1.types.compute import ( + RemoveRuleRegionNetworkFirewallPolicyRequest, +) from google.cloud.compute_v1.types.compute import RemoveRuleSecurityPolicyRequest from google.cloud.compute_v1.types.compute import RequestMirrorPolicy from google.cloud.compute_v1.types.compute import Reservation @@ -1348,9 +1465,11 @@ from google.cloud.compute_v1.types.compute import SchedulingNodeAffinity from google.cloud.compute_v1.types.compute import ScratchDisks from google.cloud.compute_v1.types.compute import Screenshot +from google.cloud.compute_v1.types.compute import SecurityPoliciesAggregatedList from google.cloud.compute_v1.types.compute import ( SecurityPoliciesListPreconfiguredExpressionSetsResponse, ) +from google.cloud.compute_v1.types.compute import SecurityPoliciesScopedList from google.cloud.compute_v1.types.compute import SecurityPoliciesWafConfig from google.cloud.compute_v1.types.compute import SecurityPolicy from google.cloud.compute_v1.types.compute import SecurityPolicyAdaptiveProtectionConfig @@ -1358,6 +1477,7 @@ SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfig, ) from google.cloud.compute_v1.types.compute import SecurityPolicyAdvancedOptionsConfig +from google.cloud.compute_v1.types.compute import SecurityPolicyDdosProtectionConfig from google.cloud.compute_v1.types.compute import SecurityPolicyList from google.cloud.compute_v1.types.compute import SecurityPolicyRecaptchaOptionsConfig from google.cloud.compute_v1.types.compute import SecurityPolicyReference @@ -1409,9 +1529,15 @@ from google.cloud.compute_v1.types.compute import SetIamPolicyInstanceTemplateRequest from google.cloud.compute_v1.types.compute import SetIamPolicyLicenseRequest from google.cloud.compute_v1.types.compute import SetIamPolicyMachineImageRequest +from google.cloud.compute_v1.types.compute import ( + SetIamPolicyNetworkFirewallPolicyRequest, +) from google.cloud.compute_v1.types.compute import SetIamPolicyNodeGroupRequest from google.cloud.compute_v1.types.compute import SetIamPolicyNodeTemplateRequest from google.cloud.compute_v1.types.compute import SetIamPolicyRegionDiskRequest +from google.cloud.compute_v1.types.compute import ( + SetIamPolicyRegionNetworkFirewallPolicyRequest, +) from google.cloud.compute_v1.types.compute import SetIamPolicyReservationRequest from google.cloud.compute_v1.types.compute import SetIamPolicyResourcePolicyRequest from google.cloud.compute_v1.types.compute import SetIamPolicyServiceAttachmentRequest @@ -1597,12 +1723,18 @@ from google.cloud.compute_v1.types.compute import ( TestIamPermissionsNetworkEndpointGroupRequest, ) +from google.cloud.compute_v1.types.compute import ( + TestIamPermissionsNetworkFirewallPolicyRequest, +) from google.cloud.compute_v1.types.compute import TestIamPermissionsNodeGroupRequest from google.cloud.compute_v1.types.compute import TestIamPermissionsNodeTemplateRequest from google.cloud.compute_v1.types.compute import ( TestIamPermissionsPacketMirroringRequest, ) from google.cloud.compute_v1.types.compute import TestIamPermissionsRegionDiskRequest +from google.cloud.compute_v1.types.compute import ( + TestIamPermissionsRegionNetworkFirewallPolicyRequest, +) from google.cloud.compute_v1.types.compute import TestIamPermissionsReservationRequest from google.cloud.compute_v1.types.compute import ( TestIamPermissionsResourcePolicyRequest, @@ -1728,7 +1860,9 @@ "LicensesClient", "MachineImagesClient", "MachineTypesClient", + "NetworkEdgeSecurityServicesClient", "NetworkEndpointGroupsClient", + "NetworkFirewallPoliciesClient", "NetworksClient", "NodeGroupsClient", "NodeTemplatesClient", @@ -1748,9 +1882,11 @@ "RegionInstanceGroupsClient", "RegionInstancesClient", "RegionNetworkEndpointGroupsClient", + "RegionNetworkFirewallPoliciesClient", "RegionNotificationEndpointsClient", "RegionOperationsClient", "RegionsClient", + "RegionSecurityPoliciesClient", "RegionSslCertificatesClient", "RegionTargetHttpProxiesClient", "RegionTargetHttpsProxiesClient", @@ -1789,6 +1925,8 @@ "AccessConfig", "AddAccessConfigInstanceRequest", "AddAssociationFirewallPolicyRequest", + "AddAssociationNetworkFirewallPolicyRequest", + "AddAssociationRegionNetworkFirewallPolicyRequest", "AddHealthCheckTargetPoolRequest", "AddInstancesInstanceGroupRequest", "AddInstanceTargetPoolRequest", @@ -1802,6 +1940,8 @@ "AddressesScopedList", "AddressList", "AddRuleFirewallPolicyRequest", + "AddRuleNetworkFirewallPolicyRequest", + "AddRuleRegionNetworkFirewallPolicyRequest", "AddRuleSecurityPolicyRequest", "AddSignedUrlKeyBackendBucketRequest", "AddSignedUrlKeyBackendServiceRequest", @@ -1820,6 +1960,7 @@ "AggregatedListInstancesRequest", "AggregatedListInterconnectAttachmentsRequest", "AggregatedListMachineTypesRequest", + "AggregatedListNetworkEdgeSecurityServicesRequest", "AggregatedListNetworkEndpointGroupsRequest", "AggregatedListNodeGroupsRequest", "AggregatedListNodeTemplatesRequest", @@ -1830,6 +1971,7 @@ "AggregatedListReservationsRequest", "AggregatedListResourcePoliciesRequest", "AggregatedListRoutersRequest", + "AggregatedListSecurityPoliciesRequest", "AggregatedListServiceAttachmentsRequest", "AggregatedListSslCertificatesRequest", "AggregatedListSubnetworksRequest", @@ -1884,6 +2026,9 @@ "BackendServiceGroupHealth", "BackendServiceIAP", "BackendServiceList", + "BackendServiceLocalityLoadBalancingPolicyConfig", + "BackendServiceLocalityLoadBalancingPolicyConfigCustomPolicy", + "BackendServiceLocalityLoadBalancingPolicyConfigPolicy", "BackendServiceLogConfig", "BackendServiceReference", "BackendServicesScopedList", @@ -1899,6 +2044,8 @@ "CacheKeyPolicy", "CircuitBreakers", "CloneRulesFirewallPolicyRequest", + "CloneRulesNetworkFirewallPolicyRequest", + "CloneRulesRegionNetworkFirewallPolicyRequest", "Commitment", "CommitmentAggregatedList", "CommitmentList", @@ -1946,7 +2093,9 @@ "DeleteInterconnectRequest", "DeleteLicenseRequest", "DeleteMachineImageRequest", + "DeleteNetworkEdgeSecurityServiceRequest", "DeleteNetworkEndpointGroupRequest", + "DeleteNetworkFirewallPolicyRequest", "DeleteNetworkRequest", "DeleteNodeGroupRequest", "DeleteNodesNodeGroupRequest", @@ -1963,9 +2112,11 @@ "DeleteRegionHealthCheckServiceRequest", "DeleteRegionInstanceGroupManagerRequest", "DeleteRegionNetworkEndpointGroupRequest", + "DeleteRegionNetworkFirewallPolicyRequest", "DeleteRegionNotificationEndpointRequest", "DeleteRegionOperationRequest", "DeleteRegionOperationResponse", + "DeleteRegionSecurityPolicyRequest", "DeleteRegionSslCertificateRequest", "DeleteRegionTargetHttpProxyRequest", "DeleteRegionTargetHttpsProxyRequest", @@ -2042,6 +2193,7 @@ "FirewallPolicyRule", "FirewallPolicyRuleMatcher", "FirewallPolicyRuleMatcherLayer4Config", + "FirewallPolicyRuleSecureTag", "FixedOrPercent", "ForwardingRule", "ForwardingRuleAggregatedList", @@ -2052,6 +2204,8 @@ "GetAcceleratorTypeRequest", "GetAddressRequest", "GetAssociationFirewallPolicyRequest", + "GetAssociationNetworkFirewallPolicyRequest", + "GetAssociationRegionNetworkFirewallPolicyRequest", "GetAutoscalerRequest", "GetBackendBucketRequest", "GetBackendServiceRequest", @@ -2060,6 +2214,7 @@ "GetDiskTypeRequest", "GetEffectiveFirewallsInstanceRequest", "GetEffectiveFirewallsNetworkRequest", + "GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest", "GetExternalVpnGatewayRequest", "GetFirewallPolicyRequest", "GetFirewallRequest", @@ -2083,9 +2238,11 @@ "GetIamPolicyInstanceTemplateRequest", "GetIamPolicyLicenseRequest", "GetIamPolicyMachineImageRequest", + "GetIamPolicyNetworkFirewallPolicyRequest", "GetIamPolicyNodeGroupRequest", "GetIamPolicyNodeTemplateRequest", "GetIamPolicyRegionDiskRequest", + "GetIamPolicyRegionNetworkFirewallPolicyRequest", "GetIamPolicyReservationRequest", "GetIamPolicyResourcePolicyRequest", "GetIamPolicyServiceAttachmentRequest", @@ -2105,7 +2262,9 @@ "GetMachineImageRequest", "GetMachineTypeRequest", "GetNatMappingInfoRoutersRequest", + "GetNetworkEdgeSecurityServiceRequest", "GetNetworkEndpointGroupRequest", + "GetNetworkFirewallPolicyRequest", "GetNetworkRequest", "GetNodeGroupRequest", "GetNodeTemplateRequest", @@ -2124,9 +2283,11 @@ "GetRegionInstanceGroupManagerRequest", "GetRegionInstanceGroupRequest", "GetRegionNetworkEndpointGroupRequest", + "GetRegionNetworkFirewallPolicyRequest", "GetRegionNotificationEndpointRequest", "GetRegionOperationRequest", "GetRegionRequest", + "GetRegionSecurityPolicyRequest", "GetRegionSslCertificateRequest", "GetRegionTargetHttpProxyRequest", "GetRegionTargetHttpsProxyRequest", @@ -2137,6 +2298,8 @@ "GetRouterRequest", "GetRouterStatusRouterRequest", "GetRuleFirewallPolicyRequest", + "GetRuleNetworkFirewallPolicyRequest", + "GetRuleRegionNetworkFirewallPolicyRequest", "GetRuleSecurityPolicyRequest", "GetScreenshotInstanceRequest", "GetSecurityPolicyRequest", @@ -2227,7 +2390,9 @@ "InsertInterconnectRequest", "InsertLicenseRequest", "InsertMachineImageRequest", + "InsertNetworkEdgeSecurityServiceRequest", "InsertNetworkEndpointGroupRequest", + "InsertNetworkFirewallPolicyRequest", "InsertNetworkRequest", "InsertNodeGroupRequest", "InsertNodeTemplateRequest", @@ -2242,7 +2407,9 @@ "InsertRegionHealthCheckServiceRequest", "InsertRegionInstanceGroupManagerRequest", "InsertRegionNetworkEndpointGroupRequest", + "InsertRegionNetworkFirewallPolicyRequest", "InsertRegionNotificationEndpointRequest", + "InsertRegionSecurityPolicyRequest", "InsertRegionSslCertificateRequest", "InsertRegionTargetHttpProxyRequest", "InsertRegionTargetHttpsProxyRequest", @@ -2310,6 +2477,7 @@ "InstanceManagedByIgmErrorInstanceActionDetails", "InstanceManagedByIgmErrorManagedInstanceError", "InstanceMoveRequest", + "InstanceParams", "InstanceProperties", "InstanceReference", "InstancesAddResourcePoliciesRequest", @@ -2394,6 +2562,7 @@ "ListNetworkEndpointGroupsRequest", "ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest", "ListNetworkEndpointsNetworkEndpointGroupsRequest", + "ListNetworkFirewallPoliciesRequest", "ListNetworksRequest", "ListNodeGroupsRequest", "ListNodesNodeGroupsRequest", @@ -2417,8 +2586,10 @@ "ListRegionInstanceGroupManagersRequest", "ListRegionInstanceGroupsRequest", "ListRegionNetworkEndpointGroupsRequest", + "ListRegionNetworkFirewallPoliciesRequest", "ListRegionNotificationEndpointsRequest", "ListRegionOperationsRequest", + "ListRegionSecurityPoliciesRequest", "ListRegionsRequest", "ListRegionSslCertificatesRequest", "ListRegionTargetHttpProxiesRequest", @@ -2475,6 +2646,9 @@ "MoveInstanceProjectRequest", "NamedPort", "Network", + "NetworkEdgeSecurityService", + "NetworkEdgeSecurityServiceAggregatedList", + "NetworkEdgeSecurityServicesScopedList", "NetworkEndpoint", "NetworkEndpointGroup", "NetworkEndpointGroupAggregatedList", @@ -2550,6 +2724,8 @@ "PatchInstanceGroupManagerRequest", "PatchInterconnectAttachmentRequest", "PatchInterconnectRequest", + "PatchNetworkEdgeSecurityServiceRequest", + "PatchNetworkFirewallPolicyRequest", "PatchNetworkRequest", "PatchNodeGroupRequest", "PatchPacketMirroringRequest", @@ -2562,9 +2738,14 @@ "PatchRegionHealthCheckRequest", "PatchRegionHealthCheckServiceRequest", "PatchRegionInstanceGroupManagerRequest", + "PatchRegionNetworkFirewallPolicyRequest", + "PatchRegionSecurityPolicyRequest", + "PatchRegionTargetHttpsProxyRequest", "PatchRegionUrlMapRequest", "PatchRouterRequest", "PatchRuleFirewallPolicyRequest", + "PatchRuleNetworkFirewallPolicyRequest", + "PatchRuleRegionNetworkFirewallPolicyRequest", "PatchRuleSecurityPolicyRequest", "PatchSecurityPolicyRequest", "PatchServiceAttachmentRequest", @@ -2626,11 +2807,15 @@ "RegionInstanceGroupsListInstancesRequest", "RegionInstanceGroupsSetNamedPortsRequest", "RegionList", + "RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse", + "RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponseEffectiveFirewallPolicy", "RegionSetLabelsRequest", "RegionSetPolicyRequest", "RegionTargetHttpsProxiesSetSslCertificatesRequest", "RegionUrlMapsValidateRequest", "RemoveAssociationFirewallPolicyRequest", + "RemoveAssociationNetworkFirewallPolicyRequest", + "RemoveAssociationRegionNetworkFirewallPolicyRequest", "RemoveHealthCheckTargetPoolRequest", "RemoveInstancesInstanceGroupRequest", "RemoveInstanceTargetPoolRequest", @@ -2639,6 +2824,8 @@ "RemoveResourcePoliciesInstanceRequest", "RemoveResourcePoliciesRegionDiskRequest", "RemoveRuleFirewallPolicyRequest", + "RemoveRuleNetworkFirewallPolicyRequest", + "RemoveRuleRegionNetworkFirewallPolicyRequest", "RemoveRuleSecurityPolicyRequest", "RequestMirrorPolicy", "Reservation", @@ -2704,12 +2891,15 @@ "SchedulingNodeAffinity", "ScratchDisks", "Screenshot", + "SecurityPoliciesAggregatedList", "SecurityPoliciesListPreconfiguredExpressionSetsResponse", + "SecurityPoliciesScopedList", "SecurityPoliciesWafConfig", "SecurityPolicy", "SecurityPolicyAdaptiveProtectionConfig", "SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfig", "SecurityPolicyAdvancedOptionsConfig", + "SecurityPolicyDdosProtectionConfig", "SecurityPolicyList", "SecurityPolicyRecaptchaOptionsConfig", "SecurityPolicyReference", @@ -2749,9 +2939,11 @@ "SetIamPolicyInstanceTemplateRequest", "SetIamPolicyLicenseRequest", "SetIamPolicyMachineImageRequest", + "SetIamPolicyNetworkFirewallPolicyRequest", "SetIamPolicyNodeGroupRequest", "SetIamPolicyNodeTemplateRequest", "SetIamPolicyRegionDiskRequest", + "SetIamPolicyRegionNetworkFirewallPolicyRequest", "SetIamPolicyReservationRequest", "SetIamPolicyResourcePolicyRequest", "SetIamPolicyServiceAttachmentRequest", @@ -2891,10 +3083,12 @@ "TestIamPermissionsLicenseRequest", "TestIamPermissionsMachineImageRequest", "TestIamPermissionsNetworkEndpointGroupRequest", + "TestIamPermissionsNetworkFirewallPolicyRequest", "TestIamPermissionsNodeGroupRequest", "TestIamPermissionsNodeTemplateRequest", "TestIamPermissionsPacketMirroringRequest", "TestIamPermissionsRegionDiskRequest", + "TestIamPermissionsRegionNetworkFirewallPolicyRequest", "TestIamPermissionsReservationRequest", "TestIamPermissionsResourcePolicyRequest", "TestIamPermissionsServiceAttachmentRequest", diff --git a/google/cloud/compute_v1/__init__.py b/google/cloud/compute_v1/__init__.py index 499c7c8db..c331c598b 100644 --- a/google/cloud/compute_v1/__init__.py +++ b/google/cloud/compute_v1/__init__.py @@ -47,7 +47,9 @@ from .services.licenses import LicensesClient from .services.machine_images import MachineImagesClient from .services.machine_types import MachineTypesClient +from .services.network_edge_security_services import NetworkEdgeSecurityServicesClient from .services.network_endpoint_groups import NetworkEndpointGroupsClient +from .services.network_firewall_policies import NetworkFirewallPoliciesClient from .services.networks import NetworksClient from .services.node_groups import NodeGroupsClient from .services.node_templates import NodeTemplatesClient @@ -67,9 +69,13 @@ from .services.region_instance_groups import RegionInstanceGroupsClient from .services.region_instances import RegionInstancesClient from .services.region_network_endpoint_groups import RegionNetworkEndpointGroupsClient +from .services.region_network_firewall_policies import ( + RegionNetworkFirewallPoliciesClient, +) from .services.region_notification_endpoints import RegionNotificationEndpointsClient from .services.region_operations import RegionOperationsClient from .services.regions import RegionsClient +from .services.region_security_policies import RegionSecurityPoliciesClient from .services.region_ssl_certificates import RegionSslCertificatesClient from .services.region_target_http_proxies import RegionTargetHttpProxiesClient from .services.region_target_https_proxies import RegionTargetHttpsProxiesClient @@ -109,6 +115,8 @@ from .types.compute import AccessConfig from .types.compute import AddAccessConfigInstanceRequest from .types.compute import AddAssociationFirewallPolicyRequest +from .types.compute import AddAssociationNetworkFirewallPolicyRequest +from .types.compute import AddAssociationRegionNetworkFirewallPolicyRequest from .types.compute import AddHealthCheckTargetPoolRequest from .types.compute import AddInstancesInstanceGroupRequest from .types.compute import AddInstanceTargetPoolRequest @@ -122,6 +130,8 @@ from .types.compute import AddressesScopedList from .types.compute import AddressList from .types.compute import AddRuleFirewallPolicyRequest +from .types.compute import AddRuleNetworkFirewallPolicyRequest +from .types.compute import AddRuleRegionNetworkFirewallPolicyRequest from .types.compute import AddRuleSecurityPolicyRequest from .types.compute import AddSignedUrlKeyBackendBucketRequest from .types.compute import AddSignedUrlKeyBackendServiceRequest @@ -140,6 +150,7 @@ from .types.compute import AggregatedListInstancesRequest from .types.compute import AggregatedListInterconnectAttachmentsRequest from .types.compute import AggregatedListMachineTypesRequest +from .types.compute import AggregatedListNetworkEdgeSecurityServicesRequest from .types.compute import AggregatedListNetworkEndpointGroupsRequest from .types.compute import AggregatedListNodeGroupsRequest from .types.compute import AggregatedListNodeTemplatesRequest @@ -150,6 +161,7 @@ from .types.compute import AggregatedListReservationsRequest from .types.compute import AggregatedListResourcePoliciesRequest from .types.compute import AggregatedListRoutersRequest +from .types.compute import AggregatedListSecurityPoliciesRequest from .types.compute import AggregatedListServiceAttachmentsRequest from .types.compute import AggregatedListSslCertificatesRequest from .types.compute import AggregatedListSubnetworksRequest @@ -206,6 +218,9 @@ from .types.compute import BackendServiceGroupHealth from .types.compute import BackendServiceIAP from .types.compute import BackendServiceList +from .types.compute import BackendServiceLocalityLoadBalancingPolicyConfig +from .types.compute import BackendServiceLocalityLoadBalancingPolicyConfigCustomPolicy +from .types.compute import BackendServiceLocalityLoadBalancingPolicyConfigPolicy from .types.compute import BackendServiceLogConfig from .types.compute import BackendServiceReference from .types.compute import BackendServicesScopedList @@ -221,6 +236,8 @@ from .types.compute import CacheKeyPolicy from .types.compute import CircuitBreakers from .types.compute import CloneRulesFirewallPolicyRequest +from .types.compute import CloneRulesNetworkFirewallPolicyRequest +from .types.compute import CloneRulesRegionNetworkFirewallPolicyRequest from .types.compute import Commitment from .types.compute import CommitmentAggregatedList from .types.compute import CommitmentList @@ -268,7 +285,9 @@ from .types.compute import DeleteInterconnectRequest from .types.compute import DeleteLicenseRequest from .types.compute import DeleteMachineImageRequest +from .types.compute import DeleteNetworkEdgeSecurityServiceRequest from .types.compute import DeleteNetworkEndpointGroupRequest +from .types.compute import DeleteNetworkFirewallPolicyRequest from .types.compute import DeleteNetworkRequest from .types.compute import DeleteNodeGroupRequest from .types.compute import DeleteNodesNodeGroupRequest @@ -285,9 +304,11 @@ from .types.compute import DeleteRegionHealthCheckServiceRequest from .types.compute import DeleteRegionInstanceGroupManagerRequest from .types.compute import DeleteRegionNetworkEndpointGroupRequest +from .types.compute import DeleteRegionNetworkFirewallPolicyRequest from .types.compute import DeleteRegionNotificationEndpointRequest from .types.compute import DeleteRegionOperationRequest from .types.compute import DeleteRegionOperationResponse +from .types.compute import DeleteRegionSecurityPolicyRequest from .types.compute import DeleteRegionSslCertificateRequest from .types.compute import DeleteRegionTargetHttpProxyRequest from .types.compute import DeleteRegionTargetHttpsProxyRequest @@ -364,6 +385,7 @@ from .types.compute import FirewallPolicyRule from .types.compute import FirewallPolicyRuleMatcher from .types.compute import FirewallPolicyRuleMatcherLayer4Config +from .types.compute import FirewallPolicyRuleSecureTag from .types.compute import FixedOrPercent from .types.compute import ForwardingRule from .types.compute import ForwardingRuleAggregatedList @@ -374,6 +396,8 @@ from .types.compute import GetAcceleratorTypeRequest from .types.compute import GetAddressRequest from .types.compute import GetAssociationFirewallPolicyRequest +from .types.compute import GetAssociationNetworkFirewallPolicyRequest +from .types.compute import GetAssociationRegionNetworkFirewallPolicyRequest from .types.compute import GetAutoscalerRequest from .types.compute import GetBackendBucketRequest from .types.compute import GetBackendServiceRequest @@ -382,6 +406,7 @@ from .types.compute import GetDiskTypeRequest from .types.compute import GetEffectiveFirewallsInstanceRequest from .types.compute import GetEffectiveFirewallsNetworkRequest +from .types.compute import GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest from .types.compute import GetExternalVpnGatewayRequest from .types.compute import GetFirewallPolicyRequest from .types.compute import GetFirewallRequest @@ -405,9 +430,11 @@ from .types.compute import GetIamPolicyInstanceTemplateRequest from .types.compute import GetIamPolicyLicenseRequest from .types.compute import GetIamPolicyMachineImageRequest +from .types.compute import GetIamPolicyNetworkFirewallPolicyRequest from .types.compute import GetIamPolicyNodeGroupRequest from .types.compute import GetIamPolicyNodeTemplateRequest from .types.compute import GetIamPolicyRegionDiskRequest +from .types.compute import GetIamPolicyRegionNetworkFirewallPolicyRequest from .types.compute import GetIamPolicyReservationRequest from .types.compute import GetIamPolicyResourcePolicyRequest from .types.compute import GetIamPolicyServiceAttachmentRequest @@ -427,7 +454,9 @@ from .types.compute import GetMachineImageRequest from .types.compute import GetMachineTypeRequest from .types.compute import GetNatMappingInfoRoutersRequest +from .types.compute import GetNetworkEdgeSecurityServiceRequest from .types.compute import GetNetworkEndpointGroupRequest +from .types.compute import GetNetworkFirewallPolicyRequest from .types.compute import GetNetworkRequest from .types.compute import GetNodeGroupRequest from .types.compute import GetNodeTemplateRequest @@ -446,9 +475,11 @@ from .types.compute import GetRegionInstanceGroupManagerRequest from .types.compute import GetRegionInstanceGroupRequest from .types.compute import GetRegionNetworkEndpointGroupRequest +from .types.compute import GetRegionNetworkFirewallPolicyRequest from .types.compute import GetRegionNotificationEndpointRequest from .types.compute import GetRegionOperationRequest from .types.compute import GetRegionRequest +from .types.compute import GetRegionSecurityPolicyRequest from .types.compute import GetRegionSslCertificateRequest from .types.compute import GetRegionTargetHttpProxyRequest from .types.compute import GetRegionTargetHttpsProxyRequest @@ -459,6 +490,8 @@ from .types.compute import GetRouterRequest from .types.compute import GetRouterStatusRouterRequest from .types.compute import GetRuleFirewallPolicyRequest +from .types.compute import GetRuleNetworkFirewallPolicyRequest +from .types.compute import GetRuleRegionNetworkFirewallPolicyRequest from .types.compute import GetRuleSecurityPolicyRequest from .types.compute import GetScreenshotInstanceRequest from .types.compute import GetSecurityPolicyRequest @@ -549,7 +582,9 @@ from .types.compute import InsertInterconnectRequest from .types.compute import InsertLicenseRequest from .types.compute import InsertMachineImageRequest +from .types.compute import InsertNetworkEdgeSecurityServiceRequest from .types.compute import InsertNetworkEndpointGroupRequest +from .types.compute import InsertNetworkFirewallPolicyRequest from .types.compute import InsertNetworkRequest from .types.compute import InsertNodeGroupRequest from .types.compute import InsertNodeTemplateRequest @@ -564,7 +599,9 @@ from .types.compute import InsertRegionHealthCheckServiceRequest from .types.compute import InsertRegionInstanceGroupManagerRequest from .types.compute import InsertRegionNetworkEndpointGroupRequest +from .types.compute import InsertRegionNetworkFirewallPolicyRequest from .types.compute import InsertRegionNotificationEndpointRequest +from .types.compute import InsertRegionSecurityPolicyRequest from .types.compute import InsertRegionSslCertificateRequest from .types.compute import InsertRegionTargetHttpProxyRequest from .types.compute import InsertRegionTargetHttpsProxyRequest @@ -632,6 +669,7 @@ from .types.compute import InstanceManagedByIgmErrorInstanceActionDetails from .types.compute import InstanceManagedByIgmErrorManagedInstanceError from .types.compute import InstanceMoveRequest +from .types.compute import InstanceParams from .types.compute import InstanceProperties from .types.compute import InstanceReference from .types.compute import InstancesAddResourcePoliciesRequest @@ -716,6 +754,7 @@ from .types.compute import ListNetworkEndpointGroupsRequest from .types.compute import ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest from .types.compute import ListNetworkEndpointsNetworkEndpointGroupsRequest +from .types.compute import ListNetworkFirewallPoliciesRequest from .types.compute import ListNetworksRequest from .types.compute import ListNodeGroupsRequest from .types.compute import ListNodesNodeGroupsRequest @@ -739,8 +778,10 @@ from .types.compute import ListRegionInstanceGroupManagersRequest from .types.compute import ListRegionInstanceGroupsRequest from .types.compute import ListRegionNetworkEndpointGroupsRequest +from .types.compute import ListRegionNetworkFirewallPoliciesRequest from .types.compute import ListRegionNotificationEndpointsRequest from .types.compute import ListRegionOperationsRequest +from .types.compute import ListRegionSecurityPoliciesRequest from .types.compute import ListRegionsRequest from .types.compute import ListRegionSslCertificatesRequest from .types.compute import ListRegionTargetHttpProxiesRequest @@ -797,6 +838,9 @@ from .types.compute import MoveInstanceProjectRequest from .types.compute import NamedPort from .types.compute import Network +from .types.compute import NetworkEdgeSecurityService +from .types.compute import NetworkEdgeSecurityServiceAggregatedList +from .types.compute import NetworkEdgeSecurityServicesScopedList from .types.compute import NetworkEndpoint from .types.compute import NetworkEndpointGroup from .types.compute import NetworkEndpointGroupAggregatedList @@ -872,6 +916,8 @@ from .types.compute import PatchInstanceGroupManagerRequest from .types.compute import PatchInterconnectAttachmentRequest from .types.compute import PatchInterconnectRequest +from .types.compute import PatchNetworkEdgeSecurityServiceRequest +from .types.compute import PatchNetworkFirewallPolicyRequest from .types.compute import PatchNetworkRequest from .types.compute import PatchNodeGroupRequest from .types.compute import PatchPacketMirroringRequest @@ -884,9 +930,14 @@ from .types.compute import PatchRegionHealthCheckRequest from .types.compute import PatchRegionHealthCheckServiceRequest from .types.compute import PatchRegionInstanceGroupManagerRequest +from .types.compute import PatchRegionNetworkFirewallPolicyRequest +from .types.compute import PatchRegionSecurityPolicyRequest +from .types.compute import PatchRegionTargetHttpsProxyRequest from .types.compute import PatchRegionUrlMapRequest from .types.compute import PatchRouterRequest from .types.compute import PatchRuleFirewallPolicyRequest +from .types.compute import PatchRuleNetworkFirewallPolicyRequest +from .types.compute import PatchRuleRegionNetworkFirewallPolicyRequest from .types.compute import PatchRuleSecurityPolicyRequest from .types.compute import PatchSecurityPolicyRequest from .types.compute import PatchServiceAttachmentRequest @@ -948,11 +999,17 @@ from .types.compute import RegionInstanceGroupsListInstancesRequest from .types.compute import RegionInstanceGroupsSetNamedPortsRequest from .types.compute import RegionList +from .types.compute import RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse +from .types.compute import ( + RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponseEffectiveFirewallPolicy, +) from .types.compute import RegionSetLabelsRequest from .types.compute import RegionSetPolicyRequest from .types.compute import RegionTargetHttpsProxiesSetSslCertificatesRequest from .types.compute import RegionUrlMapsValidateRequest from .types.compute import RemoveAssociationFirewallPolicyRequest +from .types.compute import RemoveAssociationNetworkFirewallPolicyRequest +from .types.compute import RemoveAssociationRegionNetworkFirewallPolicyRequest from .types.compute import RemoveHealthCheckTargetPoolRequest from .types.compute import RemoveInstancesInstanceGroupRequest from .types.compute import RemoveInstanceTargetPoolRequest @@ -961,6 +1018,8 @@ from .types.compute import RemoveResourcePoliciesInstanceRequest from .types.compute import RemoveResourcePoliciesRegionDiskRequest from .types.compute import RemoveRuleFirewallPolicyRequest +from .types.compute import RemoveRuleNetworkFirewallPolicyRequest +from .types.compute import RemoveRuleRegionNetworkFirewallPolicyRequest from .types.compute import RemoveRuleSecurityPolicyRequest from .types.compute import RequestMirrorPolicy from .types.compute import Reservation @@ -1026,12 +1085,15 @@ from .types.compute import SchedulingNodeAffinity from .types.compute import ScratchDisks from .types.compute import Screenshot +from .types.compute import SecurityPoliciesAggregatedList from .types.compute import SecurityPoliciesListPreconfiguredExpressionSetsResponse +from .types.compute import SecurityPoliciesScopedList from .types.compute import SecurityPoliciesWafConfig from .types.compute import SecurityPolicy from .types.compute import SecurityPolicyAdaptiveProtectionConfig from .types.compute import SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfig from .types.compute import SecurityPolicyAdvancedOptionsConfig +from .types.compute import SecurityPolicyDdosProtectionConfig from .types.compute import SecurityPolicyList from .types.compute import SecurityPolicyRecaptchaOptionsConfig from .types.compute import SecurityPolicyReference @@ -1071,9 +1133,11 @@ from .types.compute import SetIamPolicyInstanceTemplateRequest from .types.compute import SetIamPolicyLicenseRequest from .types.compute import SetIamPolicyMachineImageRequest +from .types.compute import SetIamPolicyNetworkFirewallPolicyRequest from .types.compute import SetIamPolicyNodeGroupRequest from .types.compute import SetIamPolicyNodeTemplateRequest from .types.compute import SetIamPolicyRegionDiskRequest +from .types.compute import SetIamPolicyRegionNetworkFirewallPolicyRequest from .types.compute import SetIamPolicyReservationRequest from .types.compute import SetIamPolicyResourcePolicyRequest from .types.compute import SetIamPolicyServiceAttachmentRequest @@ -1213,10 +1277,12 @@ from .types.compute import TestIamPermissionsLicenseRequest from .types.compute import TestIamPermissionsMachineImageRequest from .types.compute import TestIamPermissionsNetworkEndpointGroupRequest +from .types.compute import TestIamPermissionsNetworkFirewallPolicyRequest from .types.compute import TestIamPermissionsNodeGroupRequest from .types.compute import TestIamPermissionsNodeTemplateRequest from .types.compute import TestIamPermissionsPacketMirroringRequest from .types.compute import TestIamPermissionsRegionDiskRequest +from .types.compute import TestIamPermissionsRegionNetworkFirewallPolicyRequest from .types.compute import TestIamPermissionsReservationRequest from .types.compute import TestIamPermissionsResourcePolicyRequest from .types.compute import TestIamPermissionsServiceAttachmentRequest @@ -1309,6 +1375,8 @@ "AccessConfig", "AddAccessConfigInstanceRequest", "AddAssociationFirewallPolicyRequest", + "AddAssociationNetworkFirewallPolicyRequest", + "AddAssociationRegionNetworkFirewallPolicyRequest", "AddHealthCheckTargetPoolRequest", "AddInstanceTargetPoolRequest", "AddInstancesInstanceGroupRequest", @@ -1318,6 +1386,8 @@ "AddResourcePoliciesInstanceRequest", "AddResourcePoliciesRegionDiskRequest", "AddRuleFirewallPolicyRequest", + "AddRuleNetworkFirewallPolicyRequest", + "AddRuleRegionNetworkFirewallPolicyRequest", "AddRuleSecurityPolicyRequest", "AddSignedUrlKeyBackendBucketRequest", "AddSignedUrlKeyBackendServiceRequest", @@ -1341,6 +1411,7 @@ "AggregatedListInstancesRequest", "AggregatedListInterconnectAttachmentsRequest", "AggregatedListMachineTypesRequest", + "AggregatedListNetworkEdgeSecurityServicesRequest", "AggregatedListNetworkEndpointGroupsRequest", "AggregatedListNodeGroupsRequest", "AggregatedListNodeTemplatesRequest", @@ -1351,6 +1422,7 @@ "AggregatedListReservationsRequest", "AggregatedListResourcePoliciesRequest", "AggregatedListRoutersRequest", + "AggregatedListSecurityPoliciesRequest", "AggregatedListServiceAttachmentsRequest", "AggregatedListSslCertificatesRequest", "AggregatedListSubnetworksRequest", @@ -1407,6 +1479,9 @@ "BackendServiceGroupHealth", "BackendServiceIAP", "BackendServiceList", + "BackendServiceLocalityLoadBalancingPolicyConfig", + "BackendServiceLocalityLoadBalancingPolicyConfigCustomPolicy", + "BackendServiceLocalityLoadBalancingPolicyConfigPolicy", "BackendServiceLogConfig", "BackendServiceReference", "BackendServicesClient", @@ -1423,6 +1498,8 @@ "CacheKeyPolicy", "CircuitBreakers", "CloneRulesFirewallPolicyRequest", + "CloneRulesNetworkFirewallPolicyRequest", + "CloneRulesRegionNetworkFirewallPolicyRequest", "Commitment", "CommitmentAggregatedList", "CommitmentList", @@ -1470,7 +1547,9 @@ "DeleteInterconnectRequest", "DeleteLicenseRequest", "DeleteMachineImageRequest", + "DeleteNetworkEdgeSecurityServiceRequest", "DeleteNetworkEndpointGroupRequest", + "DeleteNetworkFirewallPolicyRequest", "DeleteNetworkRequest", "DeleteNodeGroupRequest", "DeleteNodeTemplateRequest", @@ -1487,9 +1566,11 @@ "DeleteRegionHealthCheckServiceRequest", "DeleteRegionInstanceGroupManagerRequest", "DeleteRegionNetworkEndpointGroupRequest", + "DeleteRegionNetworkFirewallPolicyRequest", "DeleteRegionNotificationEndpointRequest", "DeleteRegionOperationRequest", "DeleteRegionOperationResponse", + "DeleteRegionSecurityPolicyRequest", "DeleteRegionSslCertificateRequest", "DeleteRegionTargetHttpProxyRequest", "DeleteRegionTargetHttpsProxyRequest", @@ -1570,6 +1651,7 @@ "FirewallPolicyRule", "FirewallPolicyRuleMatcher", "FirewallPolicyRuleMatcherLayer4Config", + "FirewallPolicyRuleSecureTag", "FirewallsClient", "FixedOrPercent", "ForwardingRule", @@ -1583,6 +1665,8 @@ "GetAcceleratorTypeRequest", "GetAddressRequest", "GetAssociationFirewallPolicyRequest", + "GetAssociationNetworkFirewallPolicyRequest", + "GetAssociationRegionNetworkFirewallPolicyRequest", "GetAutoscalerRequest", "GetBackendBucketRequest", "GetBackendServiceRequest", @@ -1591,6 +1675,7 @@ "GetDiskTypeRequest", "GetEffectiveFirewallsInstanceRequest", "GetEffectiveFirewallsNetworkRequest", + "GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest", "GetExternalVpnGatewayRequest", "GetFirewallPolicyRequest", "GetFirewallRequest", @@ -1614,9 +1699,11 @@ "GetIamPolicyInstanceTemplateRequest", "GetIamPolicyLicenseRequest", "GetIamPolicyMachineImageRequest", + "GetIamPolicyNetworkFirewallPolicyRequest", "GetIamPolicyNodeGroupRequest", "GetIamPolicyNodeTemplateRequest", "GetIamPolicyRegionDiskRequest", + "GetIamPolicyRegionNetworkFirewallPolicyRequest", "GetIamPolicyReservationRequest", "GetIamPolicyResourcePolicyRequest", "GetIamPolicyServiceAttachmentRequest", @@ -1636,7 +1723,9 @@ "GetMachineImageRequest", "GetMachineTypeRequest", "GetNatMappingInfoRoutersRequest", + "GetNetworkEdgeSecurityServiceRequest", "GetNetworkEndpointGroupRequest", + "GetNetworkFirewallPolicyRequest", "GetNetworkRequest", "GetNodeGroupRequest", "GetNodeTemplateRequest", @@ -1655,9 +1744,11 @@ "GetRegionInstanceGroupManagerRequest", "GetRegionInstanceGroupRequest", "GetRegionNetworkEndpointGroupRequest", + "GetRegionNetworkFirewallPolicyRequest", "GetRegionNotificationEndpointRequest", "GetRegionOperationRequest", "GetRegionRequest", + "GetRegionSecurityPolicyRequest", "GetRegionSslCertificateRequest", "GetRegionTargetHttpProxyRequest", "GetRegionTargetHttpsProxyRequest", @@ -1668,6 +1759,8 @@ "GetRouterRequest", "GetRouterStatusRouterRequest", "GetRuleFirewallPolicyRequest", + "GetRuleNetworkFirewallPolicyRequest", + "GetRuleRegionNetworkFirewallPolicyRequest", "GetRuleSecurityPolicyRequest", "GetScreenshotInstanceRequest", "GetSecurityPolicyRequest", @@ -1766,7 +1859,9 @@ "InsertInterconnectRequest", "InsertLicenseRequest", "InsertMachineImageRequest", + "InsertNetworkEdgeSecurityServiceRequest", "InsertNetworkEndpointGroupRequest", + "InsertNetworkFirewallPolicyRequest", "InsertNetworkRequest", "InsertNodeGroupRequest", "InsertNodeTemplateRequest", @@ -1781,7 +1876,9 @@ "InsertRegionHealthCheckServiceRequest", "InsertRegionInstanceGroupManagerRequest", "InsertRegionNetworkEndpointGroupRequest", + "InsertRegionNetworkFirewallPolicyRequest", "InsertRegionNotificationEndpointRequest", + "InsertRegionSecurityPolicyRequest", "InsertRegionSslCertificateRequest", "InsertRegionTargetHttpProxyRequest", "InsertRegionTargetHttpsProxyRequest", @@ -1851,6 +1948,7 @@ "InstanceManagedByIgmErrorInstanceActionDetails", "InstanceManagedByIgmErrorManagedInstanceError", "InstanceMoveRequest", + "InstanceParams", "InstanceProperties", "InstanceReference", "InstanceTemplate", @@ -1942,6 +2040,7 @@ "ListNetworkEndpointGroupsRequest", "ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest", "ListNetworkEndpointsNetworkEndpointGroupsRequest", + "ListNetworkFirewallPoliciesRequest", "ListNetworksRequest", "ListNodeGroupsRequest", "ListNodeTemplatesRequest", @@ -1965,8 +2064,10 @@ "ListRegionInstanceGroupManagersRequest", "ListRegionInstanceGroupsRequest", "ListRegionNetworkEndpointGroupsRequest", + "ListRegionNetworkFirewallPoliciesRequest", "ListRegionNotificationEndpointsRequest", "ListRegionOperationsRequest", + "ListRegionSecurityPoliciesRequest", "ListRegionSslCertificatesRequest", "ListRegionTargetHttpProxiesRequest", "ListRegionTargetHttpsProxiesRequest", @@ -2025,6 +2126,10 @@ "MoveInstanceProjectRequest", "NamedPort", "Network", + "NetworkEdgeSecurityService", + "NetworkEdgeSecurityServiceAggregatedList", + "NetworkEdgeSecurityServicesClient", + "NetworkEdgeSecurityServicesScopedList", "NetworkEndpoint", "NetworkEndpointGroup", "NetworkEndpointGroupAggregatedList", @@ -2039,6 +2144,7 @@ "NetworkEndpointGroupsListNetworkEndpoints", "NetworkEndpointGroupsScopedList", "NetworkEndpointWithHealthStatus", + "NetworkFirewallPoliciesClient", "NetworkInterface", "NetworkList", "NetworkPeering", @@ -2106,6 +2212,8 @@ "PatchInstanceGroupManagerRequest", "PatchInterconnectAttachmentRequest", "PatchInterconnectRequest", + "PatchNetworkEdgeSecurityServiceRequest", + "PatchNetworkFirewallPolicyRequest", "PatchNetworkRequest", "PatchNodeGroupRequest", "PatchPacketMirroringRequest", @@ -2118,9 +2226,14 @@ "PatchRegionHealthCheckRequest", "PatchRegionHealthCheckServiceRequest", "PatchRegionInstanceGroupManagerRequest", + "PatchRegionNetworkFirewallPolicyRequest", + "PatchRegionSecurityPolicyRequest", + "PatchRegionTargetHttpsProxyRequest", "PatchRegionUrlMapRequest", "PatchRouterRequest", "PatchRuleFirewallPolicyRequest", + "PatchRuleNetworkFirewallPolicyRequest", + "PatchRuleRegionNetworkFirewallPolicyRequest", "PatchRuleSecurityPolicyRequest", "PatchSecurityPolicyRequest", "PatchServiceAttachmentRequest", @@ -2196,8 +2309,12 @@ "RegionInstancesClient", "RegionList", "RegionNetworkEndpointGroupsClient", + "RegionNetworkFirewallPoliciesClient", + "RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse", + "RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponseEffectiveFirewallPolicy", "RegionNotificationEndpointsClient", "RegionOperationsClient", + "RegionSecurityPoliciesClient", "RegionSetLabelsRequest", "RegionSetPolicyRequest", "RegionSslCertificatesClient", @@ -2208,6 +2325,8 @@ "RegionUrlMapsValidateRequest", "RegionsClient", "RemoveAssociationFirewallPolicyRequest", + "RemoveAssociationNetworkFirewallPolicyRequest", + "RemoveAssociationRegionNetworkFirewallPolicyRequest", "RemoveHealthCheckTargetPoolRequest", "RemoveInstanceTargetPoolRequest", "RemoveInstancesInstanceGroupRequest", @@ -2216,6 +2335,8 @@ "RemoveResourcePoliciesInstanceRequest", "RemoveResourcePoliciesRegionDiskRequest", "RemoveRuleFirewallPolicyRequest", + "RemoveRuleNetworkFirewallPolicyRequest", + "RemoveRuleRegionNetworkFirewallPolicyRequest", "RemoveRuleSecurityPolicyRequest", "RequestMirrorPolicy", "Reservation", @@ -2286,13 +2407,16 @@ "SchedulingNodeAffinity", "ScratchDisks", "Screenshot", + "SecurityPoliciesAggregatedList", "SecurityPoliciesClient", "SecurityPoliciesListPreconfiguredExpressionSetsResponse", + "SecurityPoliciesScopedList", "SecurityPoliciesWafConfig", "SecurityPolicy", "SecurityPolicyAdaptiveProtectionConfig", "SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfig", "SecurityPolicyAdvancedOptionsConfig", + "SecurityPolicyDdosProtectionConfig", "SecurityPolicyList", "SecurityPolicyRecaptchaOptionsConfig", "SecurityPolicyReference", @@ -2333,9 +2457,11 @@ "SetIamPolicyInstanceTemplateRequest", "SetIamPolicyLicenseRequest", "SetIamPolicyMachineImageRequest", + "SetIamPolicyNetworkFirewallPolicyRequest", "SetIamPolicyNodeGroupRequest", "SetIamPolicyNodeTemplateRequest", "SetIamPolicyRegionDiskRequest", + "SetIamPolicyRegionNetworkFirewallPolicyRequest", "SetIamPolicyReservationRequest", "SetIamPolicyResourcePolicyRequest", "SetIamPolicyServiceAttachmentRequest", @@ -2486,10 +2612,12 @@ "TestIamPermissionsLicenseRequest", "TestIamPermissionsMachineImageRequest", "TestIamPermissionsNetworkEndpointGroupRequest", + "TestIamPermissionsNetworkFirewallPolicyRequest", "TestIamPermissionsNodeGroupRequest", "TestIamPermissionsNodeTemplateRequest", "TestIamPermissionsPacketMirroringRequest", "TestIamPermissionsRegionDiskRequest", + "TestIamPermissionsRegionNetworkFirewallPolicyRequest", "TestIamPermissionsReservationRequest", "TestIamPermissionsResourcePolicyRequest", "TestIamPermissionsServiceAttachmentRequest", diff --git a/google/cloud/compute_v1/gapic_metadata.json b/google/cloud/compute_v1/gapic_metadata.json index 69050086d..90c22bc58 100644 --- a/google/cloud/compute_v1/gapic_metadata.json +++ b/google/cloud/compute_v1/gapic_metadata.json @@ -1554,6 +1554,40 @@ } } }, + "NetworkEdgeSecurityServices": { + "clients": { + "rest": { + "libraryClient": "NetworkEdgeSecurityServicesClient", + "rpcs": { + "AggregatedList": { + "methods": [ + "aggregated_list" + ] + }, + "Delete": { + "methods": [ + "delete" + ] + }, + "Get": { + "methods": [ + "get" + ] + }, + "Insert": { + "methods": [ + "insert" + ] + }, + "Patch": { + "methods": [ + "patch" + ] + } + } + } + } + }, "NetworkEndpointGroups": { "clients": { "rest": { @@ -1608,6 +1642,95 @@ } } }, + "NetworkFirewallPolicies": { + "clients": { + "rest": { + "libraryClient": "NetworkFirewallPoliciesClient", + "rpcs": { + "AddAssociation": { + "methods": [ + "add_association" + ] + }, + "AddRule": { + "methods": [ + "add_rule" + ] + }, + "CloneRules": { + "methods": [ + "clone_rules" + ] + }, + "Delete": { + "methods": [ + "delete" + ] + }, + "Get": { + "methods": [ + "get" + ] + }, + "GetAssociation": { + "methods": [ + "get_association" + ] + }, + "GetIamPolicy": { + "methods": [ + "get_iam_policy" + ] + }, + "GetRule": { + "methods": [ + "get_rule" + ] + }, + "Insert": { + "methods": [ + "insert" + ] + }, + "List": { + "methods": [ + "list" + ] + }, + "Patch": { + "methods": [ + "patch" + ] + }, + "PatchRule": { + "methods": [ + "patch_rule" + ] + }, + "RemoveAssociation": { + "methods": [ + "remove_association" + ] + }, + "RemoveRule": { + "methods": [ + "remove_rule" + ] + }, + "SetIamPolicy": { + "methods": [ + "set_iam_policy" + ] + }, + "TestIamPermissions": { + "methods": [ + "test_iam_permissions" + ] + } + } + } + } + }, "Networks": { "clients": { "rest": { @@ -2464,6 +2587,100 @@ } } }, + "RegionNetworkFirewallPolicies": { + "clients": { + "rest": { + "libraryClient": "RegionNetworkFirewallPoliciesClient", + "rpcs": { + "AddAssociation": { + "methods": [ + "add_association" + ] + }, + "AddRule": { + "methods": [ + "add_rule" + ] + }, + "CloneRules": { + "methods": [ + "clone_rules" + ] + }, + "Delete": { + "methods": [ + "delete" + ] + }, + "Get": { + "methods": [ + "get" + ] + }, + "GetAssociation": { + "methods": [ + "get_association" + ] + }, + "GetEffectiveFirewalls": { + "methods": [ + "get_effective_firewalls" + ] + }, + "GetIamPolicy": { + "methods": [ + "get_iam_policy" + ] + }, + "GetRule": { + "methods": [ + "get_rule" + ] + }, + "Insert": { + "methods": [ + "insert" + ] + }, + "List": { + "methods": [ + "list" + ] + }, + "Patch": { + "methods": [ + "patch" + ] + }, + "PatchRule": { + "methods": [ + "patch_rule" + ] + }, + "RemoveAssociation": { + "methods": [ + "remove_association" + ] + }, + "RemoveRule": { + "methods": [ + "remove_rule" + ] + }, + "SetIamPolicy": { + "methods": [ + "set_iam_policy" + ] + }, + "TestIamPermissions": { + "methods": [ + "test_iam_permissions" + ] + } + } + } + } + }, "RegionNotificationEndpoints": { "clients": { "rest": { @@ -2522,6 +2739,40 @@ } } }, + "RegionSecurityPolicies": { + "clients": { + "rest": { + "libraryClient": "RegionSecurityPoliciesClient", + "rpcs": { + "Delete": { + "methods": [ + "delete" + ] + }, + "Get": { + "methods": [ + "get" + ] + }, + "Insert": { + "methods": [ + "insert" + ] + }, + "List": { + "methods": [ + "list" + ] + }, + "Patch": { + "methods": [ + "patch" + ] + } + } + } + } + }, "RegionSslCertificates": { "clients": { "rest": { @@ -2610,6 +2861,11 @@ "list" ] }, + "Patch": { + "methods": [ + "patch" + ] + }, "SetSslCertificates": { "methods": [ "set_ssl_certificates" @@ -2893,6 +3149,11 @@ "add_rule" ] }, + "AggregatedList": { + "methods": [ + "aggregated_list" + ] + }, "Delete": { "methods": [ "delete" diff --git a/google/cloud/compute_v1/services/instances/client.py b/google/cloud/compute_v1/services/instances/client.py index 6ee82ab54..7efeea920 100644 --- a/google/cloud/compute_v1/services/instances/client.py +++ b/google/cloud/compute_v1/services/instances/client.py @@ -2368,7 +2368,7 @@ def reset_unary( metadata: Sequence[Tuple[str, str]] = (), ) -> compute.Operation: r"""Performs a reset on the instance. This is a hard - reset the VM does not do a graceful shutdown. For more + reset. The VM does not do a graceful shutdown. For more information, see Resetting an instance. Args: diff --git a/google/cloud/compute_v1/services/network_edge_security_services/__init__.py b/google/cloud/compute_v1/services/network_edge_security_services/__init__.py new file mode 100644 index 000000000..7e4edd52e --- /dev/null +++ b/google/cloud/compute_v1/services/network_edge_security_services/__init__.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +from .client import NetworkEdgeSecurityServicesClient + +__all__ = ("NetworkEdgeSecurityServicesClient",) diff --git a/google/cloud/compute_v1/services/network_edge_security_services/client.py b/google/cloud/compute_v1/services/network_edge_security_services/client.py new file mode 100644 index 000000000..92c6d3f25 --- /dev/null +++ b/google/cloud/compute_v1/services/network_edge_security_services/client.py @@ -0,0 +1,933 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +from collections import OrderedDict +import os +import re +from typing import Dict, Optional, Sequence, Tuple, Type, Union +import pkg_resources + +from google.api_core import client_options as client_options_lib +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries +from google.auth import credentials as ga_credentials # type: ignore +from google.auth.transport import mtls # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore +from google.oauth2 import service_account # type: ignore + +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore + +from google.cloud.compute_v1.services.network_edge_security_services import pagers +from google.cloud.compute_v1.types import compute +from .transports.base import NetworkEdgeSecurityServicesTransport, DEFAULT_CLIENT_INFO +from .transports.rest import NetworkEdgeSecurityServicesRestTransport + + +class NetworkEdgeSecurityServicesClientMeta(type): + """Metaclass for the NetworkEdgeSecurityServices client. + + This provides class-level methods for building and retrieving + support objects (e.g. transport) without polluting the client instance + objects. + """ + + _transport_registry = ( + OrderedDict() + ) # type: Dict[str, Type[NetworkEdgeSecurityServicesTransport]] + _transport_registry["rest"] = NetworkEdgeSecurityServicesRestTransport + + def get_transport_class( + cls, + label: str = None, + ) -> Type[NetworkEdgeSecurityServicesTransport]: + """Returns an appropriate transport class. + + Args: + label: The name of the desired transport. If none is + provided, then the first transport in the registry is used. + + Returns: + The transport class to use. + """ + # If a specific transport is requested, return that one. + if label: + return cls._transport_registry[label] + + # No transport is requested; return the default (that is, the first one + # in the dictionary). + return next(iter(cls._transport_registry.values())) + + +class NetworkEdgeSecurityServicesClient( + metaclass=NetworkEdgeSecurityServicesClientMeta +): + """The NetworkEdgeSecurityServices API.""" + + @staticmethod + def _get_default_mtls_endpoint(api_endpoint): + """Converts api endpoint to mTLS endpoint. + + Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to + "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. + Args: + api_endpoint (Optional[str]): the api endpoint to convert. + Returns: + str: converted mTLS api endpoint. + """ + if not api_endpoint: + return api_endpoint + + mtls_endpoint_re = re.compile( + r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" + ) + + m = mtls_endpoint_re.match(api_endpoint) + name, mtls, sandbox, googledomain = m.groups() + if mtls or not googledomain: + return api_endpoint + + if sandbox: + return api_endpoint.replace( + "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" + ) + + return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") + + DEFAULT_ENDPOINT = "compute.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials + info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + NetworkEdgeSecurityServicesClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + NetworkEdgeSecurityServicesClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file(filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + @property + def transport(self) -> NetworkEdgeSecurityServicesTransport: + """Returns the transport used by the client instance. + + Returns: + NetworkEdgeSecurityServicesTransport: The transport used by the client + instance. + """ + return self._transport + + @staticmethod + def common_billing_account_path( + billing_account: str, + ) -> str: + """Returns a fully-qualified billing_account string.""" + return "billingAccounts/{billing_account}".format( + billing_account=billing_account, + ) + + @staticmethod + def parse_common_billing_account_path(path: str) -> Dict[str, str]: + """Parse a billing_account path into its component segments.""" + m = re.match(r"^billingAccounts/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_folder_path( + folder: str, + ) -> str: + """Returns a fully-qualified folder string.""" + return "folders/{folder}".format( + folder=folder, + ) + + @staticmethod + def parse_common_folder_path(path: str) -> Dict[str, str]: + """Parse a folder path into its component segments.""" + m = re.match(r"^folders/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_organization_path( + organization: str, + ) -> str: + """Returns a fully-qualified organization string.""" + return "organizations/{organization}".format( + organization=organization, + ) + + @staticmethod + def parse_common_organization_path(path: str) -> Dict[str, str]: + """Parse a organization path into its component segments.""" + m = re.match(r"^organizations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_project_path( + project: str, + ) -> str: + """Returns a fully-qualified project string.""" + return "projects/{project}".format( + project=project, + ) + + @staticmethod + def parse_common_project_path(path: str) -> Dict[str, str]: + """Parse a project path into its component segments.""" + m = re.match(r"^projects/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_location_path( + project: str, + location: str, + ) -> str: + """Returns a fully-qualified location string.""" + return "projects/{project}/locations/{location}".format( + project=project, + location=location, + ) + + @staticmethod + def parse_common_location_path(path: str) -> Dict[str, str]: + """Parse a location path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @classmethod + def get_mtls_endpoint_and_cert_source( + cls, client_options: Optional[client_options_lib.ClientOptions] = None + ): + """Return the API endpoint and client cert source for mutual TLS. + + The client cert source is determined in the following order: + (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the + client cert source is None. + (2) if `client_options.client_cert_source` is provided, use the provided one; if the + default client cert source exists, use the default one; otherwise the client cert + source is None. + + The API endpoint is determined in the following order: + (1) if `client_options.api_endpoint` if provided, use the provided one. + (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the + default mTLS endpoint; if the environment variabel is "never", use the default API + endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise + use the default API endpoint. + + More details can be found at https://google.aip.dev/auth/4114. + + Args: + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. Only the `api_endpoint` and `client_cert_source` properties may be used + in this method. + + Returns: + Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the + client cert source to use. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If any errors happen. + """ + if client_options is None: + client_options = client_options_lib.ClientOptions() + use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") + use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") + if use_client_cert not in ("true", "false"): + raise ValueError( + "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + ) + if use_mtls_endpoint not in ("auto", "never", "always"): + raise MutualTLSChannelError( + "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" + ) + + # Figure out the client cert source to use. + client_cert_source = None + if use_client_cert == "true": + if client_options.client_cert_source: + client_cert_source = client_options.client_cert_source + elif mtls.has_default_client_cert_source(): + client_cert_source = mtls.default_client_cert_source() + + # Figure out which api endpoint to use. + if client_options.api_endpoint is not None: + api_endpoint = client_options.api_endpoint + elif use_mtls_endpoint == "always" or ( + use_mtls_endpoint == "auto" and client_cert_source + ): + api_endpoint = cls.DEFAULT_MTLS_ENDPOINT + else: + api_endpoint = cls.DEFAULT_ENDPOINT + + return api_endpoint, client_cert_source + + def __init__( + self, + *, + credentials: Optional[ga_credentials.Credentials] = None, + transport: Union[str, NetworkEdgeSecurityServicesTransport, None] = None, + client_options: Optional[client_options_lib.ClientOptions] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiates the network edge security services client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, NetworkEdgeSecurityServicesTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. It won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + """ + if isinstance(client_options, dict): + client_options = client_options_lib.from_dict(client_options) + if client_options is None: + client_options = client_options_lib.ClientOptions() + + api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( + client_options + ) + + api_key_value = getattr(client_options, "api_key", None) + if api_key_value and credentials: + raise ValueError( + "client_options.api_key and credentials are mutually exclusive" + ) + + # Save or instantiate the transport. + # Ordinarily, we provide the transport, but allowing a custom transport + # instance provides an extensibility point for unusual situations. + if isinstance(transport, NetworkEdgeSecurityServicesTransport): + # transport is a NetworkEdgeSecurityServicesTransport instance. + if credentials or client_options.credentials_file or api_key_value: + raise ValueError( + "When providing a transport instance, " + "provide its credentials directly." + ) + if client_options.scopes: + raise ValueError( + "When providing a transport instance, provide its scopes " + "directly." + ) + self._transport = transport + else: + import google.auth._default # type: ignore + + if api_key_value and hasattr( + google.auth._default, "get_api_key_credentials" + ): + credentials = google.auth._default.get_api_key_credentials( + api_key_value + ) + + Transport = type(self).get_transport_class(transport) + self._transport = Transport( + credentials=credentials, + credentials_file=client_options.credentials_file, + host=api_endpoint, + scopes=client_options.scopes, + client_cert_source_for_mtls=client_cert_source_func, + quota_project_id=client_options.quota_project_id, + client_info=client_info, + always_use_jwt_access=True, + ) + + def aggregated_list( + self, + request: Union[ + compute.AggregatedListNetworkEdgeSecurityServicesRequest, dict + ] = None, + *, + project: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.AggregatedListPager: + r"""Retrieves the list of all NetworkEdgeSecurityService + resources available to the specified project. + + Args: + request (Union[google.cloud.compute_v1.types.AggregatedListNetworkEdgeSecurityServicesRequest, dict]): + The request object. A request message for + NetworkEdgeSecurityServices.AggregatedList. See the + method description for details. + project (str): + Name of the project scoping this + request. + + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.services.network_edge_security_services.pagers.AggregatedListPager: + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([project]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.AggregatedListNetworkEdgeSecurityServicesRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance( + request, compute.AggregatedListNetworkEdgeSecurityServicesRequest + ): + request = compute.AggregatedListNetworkEdgeSecurityServicesRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.aggregated_list] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.AggregatedListPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def delete_unary( + self, + request: Union[compute.DeleteNetworkEdgeSecurityServiceRequest, dict] = None, + *, + project: str = None, + region: str = None, + network_edge_security_service: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Deletes the specified service. + + Args: + request (Union[google.cloud.compute_v1.types.DeleteNetworkEdgeSecurityServiceRequest, dict]): + The request object. A request message for + NetworkEdgeSecurityServices.Delete. See the method + description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + region (str): + Name of the region scoping this + request. + + This corresponds to the ``region`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + network_edge_security_service (str): + Name of the network edge security + service to delete. + + This corresponds to the ``network_edge_security_service`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + [Global](/compute/docs/reference/rest/v1/globalOperations) + \* + [Regional](/compute/docs/reference/rest/v1/regionOperations) + \* + [Zonal](/compute/docs/reference/rest/v1/zoneOperations) + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the globalOperations + resource. - For regional operations, use the + regionOperations resource. - For zonal operations, use + the zonalOperations resource. For more information, read + Global, Regional, and Zonal Resources. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([project, region, network_edge_security_service]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.DeleteNetworkEdgeSecurityServiceRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, compute.DeleteNetworkEdgeSecurityServiceRequest): + request = compute.DeleteNetworkEdgeSecurityServiceRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if region is not None: + request.region = region + if network_edge_security_service is not None: + request.network_edge_security_service = network_edge_security_service + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get( + self, + request: Union[compute.GetNetworkEdgeSecurityServiceRequest, dict] = None, + *, + project: str = None, + region: str = None, + network_edge_security_service: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.NetworkEdgeSecurityService: + r"""Gets a specified NetworkEdgeSecurityService. + + Args: + request (Union[google.cloud.compute_v1.types.GetNetworkEdgeSecurityServiceRequest, dict]): + The request object. A request message for + NetworkEdgeSecurityServices.Get. See the method + description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + region (str): + Name of the region scoping this + request. + + This corresponds to the ``region`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + network_edge_security_service (str): + Name of the network edge security + service to get. + + This corresponds to the ``network_edge_security_service`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.NetworkEdgeSecurityService: + Represents a Google Cloud Armor + network edge security service resource. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([project, region, network_edge_security_service]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.GetNetworkEdgeSecurityServiceRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, compute.GetNetworkEdgeSecurityServiceRequest): + request = compute.GetNetworkEdgeSecurityServiceRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if region is not None: + request.region = region + if network_edge_security_service is not None: + request.network_edge_security_service = network_edge_security_service + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def insert_unary( + self, + request: Union[compute.InsertNetworkEdgeSecurityServiceRequest, dict] = None, + *, + project: str = None, + region: str = None, + network_edge_security_service_resource: compute.NetworkEdgeSecurityService = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Creates a new service in the specified project using + the data included in the request. + + Args: + request (Union[google.cloud.compute_v1.types.InsertNetworkEdgeSecurityServiceRequest, dict]): + The request object. A request message for + NetworkEdgeSecurityServices.Insert. See the method + description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + region (str): + Name of the region scoping this + request. + + This corresponds to the ``region`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + network_edge_security_service_resource (google.cloud.compute_v1.types.NetworkEdgeSecurityService): + The body resource for this request + This corresponds to the ``network_edge_security_service_resource`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + [Global](/compute/docs/reference/rest/v1/globalOperations) + \* + [Regional](/compute/docs/reference/rest/v1/regionOperations) + \* + [Zonal](/compute/docs/reference/rest/v1/zoneOperations) + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the globalOperations + resource. - For regional operations, use the + regionOperations resource. - For zonal operations, use + the zonalOperations resource. For more information, read + Global, Regional, and Zonal Resources. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any( + [project, region, network_edge_security_service_resource] + ) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.InsertNetworkEdgeSecurityServiceRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, compute.InsertNetworkEdgeSecurityServiceRequest): + request = compute.InsertNetworkEdgeSecurityServiceRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if region is not None: + request.region = region + if network_edge_security_service_resource is not None: + request.network_edge_security_service_resource = ( + network_edge_security_service_resource + ) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.insert] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def patch_unary( + self, + request: Union[compute.PatchNetworkEdgeSecurityServiceRequest, dict] = None, + *, + project: str = None, + region: str = None, + network_edge_security_service: str = None, + network_edge_security_service_resource: compute.NetworkEdgeSecurityService = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Patches the specified policy with the data included + in the request. + + Args: + request (Union[google.cloud.compute_v1.types.PatchNetworkEdgeSecurityServiceRequest, dict]): + The request object. A request message for + NetworkEdgeSecurityServices.Patch. See the method + description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + region (str): + Name of the region scoping this + request. + + This corresponds to the ``region`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + network_edge_security_service (str): + Name of the network edge security + service to update. + + This corresponds to the ``network_edge_security_service`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + network_edge_security_service_resource (google.cloud.compute_v1.types.NetworkEdgeSecurityService): + The body resource for this request + This corresponds to the ``network_edge_security_service_resource`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + [Global](/compute/docs/reference/rest/v1/globalOperations) + \* + [Regional](/compute/docs/reference/rest/v1/regionOperations) + \* + [Zonal](/compute/docs/reference/rest/v1/zoneOperations) + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the globalOperations + resource. - For regional operations, use the + regionOperations resource. - For zonal operations, use + the zonalOperations resource. For more information, read + Global, Regional, and Zonal Resources. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any( + [ + project, + region, + network_edge_security_service, + network_edge_security_service_resource, + ] + ) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.PatchNetworkEdgeSecurityServiceRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, compute.PatchNetworkEdgeSecurityServiceRequest): + request = compute.PatchNetworkEdgeSecurityServiceRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if region is not None: + request.region = region + if network_edge_security_service is not None: + request.network_edge_security_service = network_edge_security_service + if network_edge_security_service_resource is not None: + request.network_edge_security_service_resource = ( + network_edge_security_service_resource + ) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.patch] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def __enter__(self): + return self + + def __exit__(self, type, value, traceback): + """Releases underlying transport's resources. + + .. warning:: + ONLY use as a context manager if the transport is NOT shared + with other clients! Exiting the with block will CLOSE the transport + and may cause errors in other clients! + """ + self.transport.close() + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ("NetworkEdgeSecurityServicesClient",) diff --git a/google/cloud/compute_v1/services/network_edge_security_services/pagers.py b/google/cloud/compute_v1/services/network_edge_security_services/pagers.py new file mode 100644 index 000000000..7f6ae87e2 --- /dev/null +++ b/google/cloud/compute_v1/services/network_edge_security_services/pagers.py @@ -0,0 +1,96 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +from typing import ( + Any, + AsyncIterator, + Awaitable, + Callable, + Sequence, + Tuple, + Optional, + Iterator, +) + +from google.cloud.compute_v1.types import compute + + +class AggregatedListPager: + """A pager for iterating through ``aggregated_list`` requests. + + This class thinly wraps an initial + :class:`google.cloud.compute_v1.types.NetworkEdgeSecurityServiceAggregatedList` object, and + provides an ``__iter__`` method to iterate through its + ``items`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``AggregatedList`` requests and continue to iterate + through the ``items`` field on the + corresponding responses. + + All the usual :class:`google.cloud.compute_v1.types.NetworkEdgeSecurityServiceAggregatedList` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., compute.NetworkEdgeSecurityServiceAggregatedList], + request: compute.AggregatedListNetworkEdgeSecurityServicesRequest, + response: compute.NetworkEdgeSecurityServiceAggregatedList, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.compute_v1.types.AggregatedListNetworkEdgeSecurityServicesRequest): + The initial request object. + response (google.cloud.compute_v1.types.NetworkEdgeSecurityServiceAggregatedList): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = compute.AggregatedListNetworkEdgeSecurityServicesRequest( + request + ) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[compute.NetworkEdgeSecurityServiceAggregatedList]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__( + self, + ) -> Iterator[Tuple[str, compute.NetworkEdgeSecurityServicesScopedList]]: + for page in self.pages: + yield from page.items.items() + + def get(self, key: str) -> Optional[compute.NetworkEdgeSecurityServicesScopedList]: + return self._response.items.get(key) + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/cloud/compute_v1/services/network_edge_security_services/transports/__init__.py b/google/cloud/compute_v1/services/network_edge_security_services/transports/__init__.py new file mode 100644 index 000000000..9f688f6ca --- /dev/null +++ b/google/cloud/compute_v1/services/network_edge_security_services/transports/__init__.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +from collections import OrderedDict +from typing import Dict, Type + +from .base import NetworkEdgeSecurityServicesTransport +from .rest import NetworkEdgeSecurityServicesRestTransport +from .rest import NetworkEdgeSecurityServicesRestInterceptor + + +# Compile a registry of transports. +_transport_registry = ( + OrderedDict() +) # type: Dict[str, Type[NetworkEdgeSecurityServicesTransport]] +_transport_registry["rest"] = NetworkEdgeSecurityServicesRestTransport + +__all__ = ( + "NetworkEdgeSecurityServicesTransport", + "NetworkEdgeSecurityServicesRestTransport", + "NetworkEdgeSecurityServicesRestInterceptor", +) diff --git a/google/cloud/compute_v1/services/network_edge_security_services/transports/base.py b/google/cloud/compute_v1/services/network_edge_security_services/transports/base.py new file mode 100644 index 000000000..e4f1f6cbd --- /dev/null +++ b/google/cloud/compute_v1/services/network_edge_security_services/transports/base.py @@ -0,0 +1,214 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +import abc +from typing import Awaitable, Callable, Dict, Optional, Sequence, Union +import pkg_resources + +import google.auth # type: ignore +import google.api_core +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries +from google.auth import credentials as ga_credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.compute_v1.types import compute + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +class NetworkEdgeSecurityServicesTransport(abc.ABC): + """Abstract transport class for NetworkEdgeSecurityServices.""" + + AUTH_SCOPES = ( + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/cloud-platform", + ) + + DEFAULT_HOST: str = "compute.googleapis.com" + + def __init__( + self, + *, + host: str = DEFAULT_HOST, + credentials: ga_credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + **kwargs, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): + The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A list of scopes. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + + scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} + + # Save the scopes. + self._scopes = scopes + + # If no credentials are provided, then determine the appropriate + # defaults. + if credentials and credentials_file: + raise core_exceptions.DuplicateCredentialArgs( + "'credentials_file' and 'credentials' are mutually exclusive" + ) + + if credentials_file is not None: + credentials, _ = google.auth.load_credentials_from_file( + credentials_file, **scopes_kwargs, quota_project_id=quota_project_id + ) + elif credentials is None: + credentials, _ = google.auth.default( + **scopes_kwargs, quota_project_id=quota_project_id + ) + + # If the credentials are service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + + # Save the credentials. + self._credentials = credentials + + def _prep_wrapped_messages(self, client_info): + # Precompute the wrapped methods. + self._wrapped_methods = { + self.aggregated_list: gapic_v1.method.wrap_method( + self.aggregated_list, + default_timeout=None, + client_info=client_info, + ), + self.delete: gapic_v1.method.wrap_method( + self.delete, + default_timeout=None, + client_info=client_info, + ), + self.get: gapic_v1.method.wrap_method( + self.get, + default_timeout=None, + client_info=client_info, + ), + self.insert: gapic_v1.method.wrap_method( + self.insert, + default_timeout=None, + client_info=client_info, + ), + self.patch: gapic_v1.method.wrap_method( + self.patch, + default_timeout=None, + client_info=client_info, + ), + } + + def close(self): + """Closes resources associated with the transport. + + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! + """ + raise NotImplementedError() + + @property + def aggregated_list( + self, + ) -> Callable[ + [compute.AggregatedListNetworkEdgeSecurityServicesRequest], + Union[ + compute.NetworkEdgeSecurityServiceAggregatedList, + Awaitable[compute.NetworkEdgeSecurityServiceAggregatedList], + ], + ]: + raise NotImplementedError() + + @property + def delete( + self, + ) -> Callable[ + [compute.DeleteNetworkEdgeSecurityServiceRequest], + Union[compute.Operation, Awaitable[compute.Operation]], + ]: + raise NotImplementedError() + + @property + def get( + self, + ) -> Callable[ + [compute.GetNetworkEdgeSecurityServiceRequest], + Union[ + compute.NetworkEdgeSecurityService, + Awaitable[compute.NetworkEdgeSecurityService], + ], + ]: + raise NotImplementedError() + + @property + def insert( + self, + ) -> Callable[ + [compute.InsertNetworkEdgeSecurityServiceRequest], + Union[compute.Operation, Awaitable[compute.Operation]], + ]: + raise NotImplementedError() + + @property + def patch( + self, + ) -> Callable[ + [compute.PatchNetworkEdgeSecurityServiceRequest], + Union[compute.Operation, Awaitable[compute.Operation]], + ]: + raise NotImplementedError() + + +__all__ = ("NetworkEdgeSecurityServicesTransport",) diff --git a/google/cloud/compute_v1/services/network_edge_security_services/transports/rest.py b/google/cloud/compute_v1/services/network_edge_security_services/transports/rest.py new file mode 100644 index 000000000..8e3892f94 --- /dev/null +++ b/google/cloud/compute_v1/services/network_edge_security_services/transports/rest.py @@ -0,0 +1,926 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# + +from google.auth.transport.requests import AuthorizedSession # type: ignore +import json # type: ignore +import grpc # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.auth import credentials as ga_credentials # type: ignore +from google.api_core import exceptions as core_exceptions +from google.api_core import retry as retries +from google.api_core import rest_helpers +from google.api_core import rest_streaming +from google.api_core import path_template +from google.api_core import gapic_v1 + +from requests import __version__ as requests_version +import dataclasses +import re +from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +import warnings + +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore + + +from google.cloud.compute_v1.types import compute + +from .base import ( + NetworkEdgeSecurityServicesTransport, + DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO, +) + + +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version, + grpc_version=None, + rest_version=requests_version, +) + + +class NetworkEdgeSecurityServicesRestInterceptor: + """Interceptor for NetworkEdgeSecurityServices. + + Interceptors are used to manipulate requests, request metadata, and responses + in arbitrary ways. + Example use cases include: + * Logging + * Verifying requests according to service or custom semantics + * Stripping extraneous information from responses + + These use cases and more can be enabled by injecting an + instance of a custom subclass when constructing the NetworkEdgeSecurityServicesRestTransport. + + .. code-block:: python + class MyCustomNetworkEdgeSecurityServicesInterceptor(NetworkEdgeSecurityServicesRestInterceptor): + def pre_aggregated_list(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_aggregated_list(response): + logging.log(f"Received response: {response}") + + def pre_delete(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_delete(response): + logging.log(f"Received response: {response}") + + def pre_get(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_get(response): + logging.log(f"Received response: {response}") + + def pre_insert(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_insert(response): + logging.log(f"Received response: {response}") + + def pre_patch(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_patch(response): + logging.log(f"Received response: {response}") + + transport = NetworkEdgeSecurityServicesRestTransport(interceptor=MyCustomNetworkEdgeSecurityServicesInterceptor()) + client = NetworkEdgeSecurityServicesClient(transport=transport) + + + """ + + def pre_aggregated_list( + self, + request: compute.AggregatedListNetworkEdgeSecurityServicesRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + compute.AggregatedListNetworkEdgeSecurityServicesRequest, + Sequence[Tuple[str, str]], + ]: + """Pre-rpc interceptor for aggregated_list + + Override in a subclass to manipulate the request or metadata + before they are sent to the NetworkEdgeSecurityServices server. + """ + return request, metadata + + def post_aggregated_list( + self, response: compute.NetworkEdgeSecurityServiceAggregatedList + ) -> compute.NetworkEdgeSecurityServiceAggregatedList: + """Post-rpc interceptor for aggregated_list + + Override in a subclass to manipulate the response + after it is returned by the NetworkEdgeSecurityServices server but before + it is returned to user code. + """ + return response + + def pre_delete( + self, + request: compute.DeleteNetworkEdgeSecurityServiceRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + compute.DeleteNetworkEdgeSecurityServiceRequest, Sequence[Tuple[str, str]] + ]: + """Pre-rpc interceptor for delete + + Override in a subclass to manipulate the request or metadata + before they are sent to the NetworkEdgeSecurityServices server. + """ + return request, metadata + + def post_delete(self, response: compute.Operation) -> compute.Operation: + """Post-rpc interceptor for delete + + Override in a subclass to manipulate the response + after it is returned by the NetworkEdgeSecurityServices server but before + it is returned to user code. + """ + return response + + def pre_get( + self, + request: compute.GetNetworkEdgeSecurityServiceRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[compute.GetNetworkEdgeSecurityServiceRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for get + + Override in a subclass to manipulate the request or metadata + before they are sent to the NetworkEdgeSecurityServices server. + """ + return request, metadata + + def post_get( + self, response: compute.NetworkEdgeSecurityService + ) -> compute.NetworkEdgeSecurityService: + """Post-rpc interceptor for get + + Override in a subclass to manipulate the response + after it is returned by the NetworkEdgeSecurityServices server but before + it is returned to user code. + """ + return response + + def pre_insert( + self, + request: compute.InsertNetworkEdgeSecurityServiceRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + compute.InsertNetworkEdgeSecurityServiceRequest, Sequence[Tuple[str, str]] + ]: + """Pre-rpc interceptor for insert + + Override in a subclass to manipulate the request or metadata + before they are sent to the NetworkEdgeSecurityServices server. + """ + return request, metadata + + def post_insert(self, response: compute.Operation) -> compute.Operation: + """Post-rpc interceptor for insert + + Override in a subclass to manipulate the response + after it is returned by the NetworkEdgeSecurityServices server but before + it is returned to user code. + """ + return response + + def pre_patch( + self, + request: compute.PatchNetworkEdgeSecurityServiceRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + compute.PatchNetworkEdgeSecurityServiceRequest, Sequence[Tuple[str, str]] + ]: + """Pre-rpc interceptor for patch + + Override in a subclass to manipulate the request or metadata + before they are sent to the NetworkEdgeSecurityServices server. + """ + return request, metadata + + def post_patch(self, response: compute.Operation) -> compute.Operation: + """Post-rpc interceptor for patch + + Override in a subclass to manipulate the response + after it is returned by the NetworkEdgeSecurityServices server but before + it is returned to user code. + """ + return response + + +@dataclasses.dataclass +class NetworkEdgeSecurityServicesRestStub: + _session: AuthorizedSession + _host: str + _interceptor: NetworkEdgeSecurityServicesRestInterceptor + + +class NetworkEdgeSecurityServicesRestTransport(NetworkEdgeSecurityServicesTransport): + """REST backend transport for NetworkEdgeSecurityServices. + + The NetworkEdgeSecurityServices API. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends JSON representations of protocol buffers over HTTP/1.1 + """ + + _STUBS: Dict[str, NetworkEdgeSecurityServicesRestStub] = {} + + def __init__( + self, + *, + host: str = "compute.googleapis.com", + credentials: ga_credentials.Credentials = None, + credentials_file: str = None, + scopes: Sequence[str] = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + url_scheme: str = "https", + interceptor: Optional[NetworkEdgeSecurityServicesRestInterceptor] = None, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): + The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client + certificate to configure mutual TLS HTTP channel. It is ignored + if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you are developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + url_scheme: the protocol scheme for the API endpoint. Normally + "https", but for testing or local servers, + "http" can be specified. + """ + # Run the base constructor + # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. + # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the + # credentials object + maybe_url_match = re.match("^(?Phttp(?:s)?://)?(?P.*)$", host) + if maybe_url_match is None: + raise ValueError( + f"Unexpected hostname structure: {host}" + ) # pragma: NO COVER + + url_match_items = maybe_url_match.groupdict() + + host = f"{url_scheme}://{host}" if not url_match_items["scheme"] else host + + super().__init__( + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, + ) + self._session = AuthorizedSession( + self._credentials, default_host=self.DEFAULT_HOST + ) + if client_cert_source_for_mtls: + self._session.configure_mtls_channel(client_cert_source_for_mtls) + self._interceptor = interceptor or NetworkEdgeSecurityServicesRestInterceptor() + self._prep_wrapped_messages(client_info) + + class _AggregatedList(NetworkEdgeSecurityServicesRestStub): + def __hash__(self): + return hash("AggregatedList") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.AggregatedListNetworkEdgeSecurityServicesRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.NetworkEdgeSecurityServiceAggregatedList: + r"""Call the aggregated list method over HTTP. + + Args: + request (~.compute.AggregatedListNetworkEdgeSecurityServicesRequest): + The request object. A request message for + NetworkEdgeSecurityServices.AggregatedList. + See the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.NetworkEdgeSecurityServiceAggregatedList: + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/compute/v1/projects/{project}/aggregated/networkEdgeSecurityServices", + }, + ] + request, metadata = self._interceptor.pre_aggregated_list(request, metadata) + request_kwargs = ( + compute.AggregatedListNetworkEdgeSecurityServicesRequest.to_dict( + request + ) + ) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.AggregatedListNetworkEdgeSecurityServicesRequest.to_json( + compute.AggregatedListNetworkEdgeSecurityServicesRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.NetworkEdgeSecurityServiceAggregatedList.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_aggregated_list(resp) + return resp + + class _Delete(NetworkEdgeSecurityServicesRestStub): + def __hash__(self): + return hash("Delete") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.DeleteNetworkEdgeSecurityServiceRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Call the delete method over HTTP. + + Args: + request (~.compute.DeleteNetworkEdgeSecurityServiceRequest): + The request object. A request message for + NetworkEdgeSecurityServices.Delete. See + the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "delete", + "uri": "/compute/v1/projects/{project}/regions/{region}/networkEdgeSecurityServices/{network_edge_security_service}", + }, + ] + request, metadata = self._interceptor.pre_delete(request, metadata) + request_kwargs = compute.DeleteNetworkEdgeSecurityServiceRequest.to_dict( + request + ) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.DeleteNetworkEdgeSecurityServiceRequest.to_json( + compute.DeleteNetworkEdgeSecurityServiceRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.Operation.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_delete(resp) + return resp + + class _Get(NetworkEdgeSecurityServicesRestStub): + def __hash__(self): + return hash("Get") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.GetNetworkEdgeSecurityServiceRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.NetworkEdgeSecurityService: + r"""Call the get method over HTTP. + + Args: + request (~.compute.GetNetworkEdgeSecurityServiceRequest): + The request object. A request message for + NetworkEdgeSecurityServices.Get. See the + method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.NetworkEdgeSecurityService: + Represents a Google Cloud Armor + network edge security service resource. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/compute/v1/projects/{project}/regions/{region}/networkEdgeSecurityServices/{network_edge_security_service}", + }, + ] + request, metadata = self._interceptor.pre_get(request, metadata) + request_kwargs = compute.GetNetworkEdgeSecurityServiceRequest.to_dict( + request + ) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.GetNetworkEdgeSecurityServiceRequest.to_json( + compute.GetNetworkEdgeSecurityServiceRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.NetworkEdgeSecurityService.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_get(resp) + return resp + + class _Insert(NetworkEdgeSecurityServicesRestStub): + def __hash__(self): + return hash("Insert") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.InsertNetworkEdgeSecurityServiceRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Call the insert method over HTTP. + + Args: + request (~.compute.InsertNetworkEdgeSecurityServiceRequest): + The request object. A request message for + NetworkEdgeSecurityServices.Insert. See + the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/compute/v1/projects/{project}/regions/{region}/networkEdgeSecurityServices", + "body": "network_edge_security_service_resource", + }, + ] + request, metadata = self._interceptor.pre_insert(request, metadata) + request_kwargs = compute.InsertNetworkEdgeSecurityServiceRequest.to_dict( + request + ) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + # Jsonify the request body + body = compute.NetworkEdgeSecurityService.to_json( + compute.NetworkEdgeSecurityService(transcoded_request["body"]), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.InsertNetworkEdgeSecurityServiceRequest.to_json( + compute.InsertNetworkEdgeSecurityServiceRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.Operation.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_insert(resp) + return resp + + class _Patch(NetworkEdgeSecurityServicesRestStub): + def __hash__(self): + return hash("Patch") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.PatchNetworkEdgeSecurityServiceRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Call the patch method over HTTP. + + Args: + request (~.compute.PatchNetworkEdgeSecurityServiceRequest): + The request object. A request message for + NetworkEdgeSecurityServices.Patch. See + the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "patch", + "uri": "/compute/v1/projects/{project}/regions/{region}/networkEdgeSecurityServices/{network_edge_security_service}", + "body": "network_edge_security_service_resource", + }, + ] + request, metadata = self._interceptor.pre_patch(request, metadata) + request_kwargs = compute.PatchNetworkEdgeSecurityServiceRequest.to_dict( + request + ) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + # Jsonify the request body + body = compute.NetworkEdgeSecurityService.to_json( + compute.NetworkEdgeSecurityService(transcoded_request["body"]), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.PatchNetworkEdgeSecurityServiceRequest.to_json( + compute.PatchNetworkEdgeSecurityServiceRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.Operation.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_patch(resp) + return resp + + @property + def aggregated_list( + self, + ) -> Callable[ + [compute.AggregatedListNetworkEdgeSecurityServicesRequest], + compute.NetworkEdgeSecurityServiceAggregatedList, + ]: + stub = self._STUBS.get("aggregated_list") + if not stub: + stub = self._STUBS["aggregated_list"] = self._AggregatedList( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def delete( + self, + ) -> Callable[[compute.DeleteNetworkEdgeSecurityServiceRequest], compute.Operation]: + stub = self._STUBS.get("delete") + if not stub: + stub = self._STUBS["delete"] = self._Delete( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def get( + self, + ) -> Callable[ + [compute.GetNetworkEdgeSecurityServiceRequest], + compute.NetworkEdgeSecurityService, + ]: + stub = self._STUBS.get("get") + if not stub: + stub = self._STUBS["get"] = self._Get( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def insert( + self, + ) -> Callable[[compute.InsertNetworkEdgeSecurityServiceRequest], compute.Operation]: + stub = self._STUBS.get("insert") + if not stub: + stub = self._STUBS["insert"] = self._Insert( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def patch( + self, + ) -> Callable[[compute.PatchNetworkEdgeSecurityServiceRequest], compute.Operation]: + stub = self._STUBS.get("patch") + if not stub: + stub = self._STUBS["patch"] = self._Patch( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + def close(self): + self._session.close() + + +__all__ = ("NetworkEdgeSecurityServicesRestTransport",) diff --git a/google/cloud/compute_v1/services/network_firewall_policies/__init__.py b/google/cloud/compute_v1/services/network_firewall_policies/__init__.py new file mode 100644 index 000000000..6dd6f5ecb --- /dev/null +++ b/google/cloud/compute_v1/services/network_firewall_policies/__init__.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +from .client import NetworkFirewallPoliciesClient + +__all__ = ("NetworkFirewallPoliciesClient",) diff --git a/google/cloud/compute_v1/services/network_firewall_policies/client.py b/google/cloud/compute_v1/services/network_firewall_policies/client.py new file mode 100644 index 000000000..ef9e587eb --- /dev/null +++ b/google/cloud/compute_v1/services/network_firewall_policies/client.py @@ -0,0 +1,1960 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +from collections import OrderedDict +import os +import re +from typing import Dict, Optional, Sequence, Tuple, Type, Union +import pkg_resources + +from google.api_core import client_options as client_options_lib +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries +from google.auth import credentials as ga_credentials # type: ignore +from google.auth.transport import mtls # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore +from google.oauth2 import service_account # type: ignore + +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore + +from google.cloud.compute_v1.services.network_firewall_policies import pagers +from google.cloud.compute_v1.types import compute +from .transports.base import NetworkFirewallPoliciesTransport, DEFAULT_CLIENT_INFO +from .transports.rest import NetworkFirewallPoliciesRestTransport + + +class NetworkFirewallPoliciesClientMeta(type): + """Metaclass for the NetworkFirewallPolicies client. + + This provides class-level methods for building and retrieving + support objects (e.g. transport) without polluting the client instance + objects. + """ + + _transport_registry = ( + OrderedDict() + ) # type: Dict[str, Type[NetworkFirewallPoliciesTransport]] + _transport_registry["rest"] = NetworkFirewallPoliciesRestTransport + + def get_transport_class( + cls, + label: str = None, + ) -> Type[NetworkFirewallPoliciesTransport]: + """Returns an appropriate transport class. + + Args: + label: The name of the desired transport. If none is + provided, then the first transport in the registry is used. + + Returns: + The transport class to use. + """ + # If a specific transport is requested, return that one. + if label: + return cls._transport_registry[label] + + # No transport is requested; return the default (that is, the first one + # in the dictionary). + return next(iter(cls._transport_registry.values())) + + +class NetworkFirewallPoliciesClient(metaclass=NetworkFirewallPoliciesClientMeta): + """The NetworkFirewallPolicies API.""" + + @staticmethod + def _get_default_mtls_endpoint(api_endpoint): + """Converts api endpoint to mTLS endpoint. + + Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to + "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. + Args: + api_endpoint (Optional[str]): the api endpoint to convert. + Returns: + str: converted mTLS api endpoint. + """ + if not api_endpoint: + return api_endpoint + + mtls_endpoint_re = re.compile( + r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" + ) + + m = mtls_endpoint_re.match(api_endpoint) + name, mtls, sandbox, googledomain = m.groups() + if mtls or not googledomain: + return api_endpoint + + if sandbox: + return api_endpoint.replace( + "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" + ) + + return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") + + DEFAULT_ENDPOINT = "compute.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials + info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + NetworkFirewallPoliciesClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + NetworkFirewallPoliciesClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file(filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + @property + def transport(self) -> NetworkFirewallPoliciesTransport: + """Returns the transport used by the client instance. + + Returns: + NetworkFirewallPoliciesTransport: The transport used by the client + instance. + """ + return self._transport + + @staticmethod + def common_billing_account_path( + billing_account: str, + ) -> str: + """Returns a fully-qualified billing_account string.""" + return "billingAccounts/{billing_account}".format( + billing_account=billing_account, + ) + + @staticmethod + def parse_common_billing_account_path(path: str) -> Dict[str, str]: + """Parse a billing_account path into its component segments.""" + m = re.match(r"^billingAccounts/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_folder_path( + folder: str, + ) -> str: + """Returns a fully-qualified folder string.""" + return "folders/{folder}".format( + folder=folder, + ) + + @staticmethod + def parse_common_folder_path(path: str) -> Dict[str, str]: + """Parse a folder path into its component segments.""" + m = re.match(r"^folders/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_organization_path( + organization: str, + ) -> str: + """Returns a fully-qualified organization string.""" + return "organizations/{organization}".format( + organization=organization, + ) + + @staticmethod + def parse_common_organization_path(path: str) -> Dict[str, str]: + """Parse a organization path into its component segments.""" + m = re.match(r"^organizations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_project_path( + project: str, + ) -> str: + """Returns a fully-qualified project string.""" + return "projects/{project}".format( + project=project, + ) + + @staticmethod + def parse_common_project_path(path: str) -> Dict[str, str]: + """Parse a project path into its component segments.""" + m = re.match(r"^projects/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_location_path( + project: str, + location: str, + ) -> str: + """Returns a fully-qualified location string.""" + return "projects/{project}/locations/{location}".format( + project=project, + location=location, + ) + + @staticmethod + def parse_common_location_path(path: str) -> Dict[str, str]: + """Parse a location path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @classmethod + def get_mtls_endpoint_and_cert_source( + cls, client_options: Optional[client_options_lib.ClientOptions] = None + ): + """Return the API endpoint and client cert source for mutual TLS. + + The client cert source is determined in the following order: + (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the + client cert source is None. + (2) if `client_options.client_cert_source` is provided, use the provided one; if the + default client cert source exists, use the default one; otherwise the client cert + source is None. + + The API endpoint is determined in the following order: + (1) if `client_options.api_endpoint` if provided, use the provided one. + (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the + default mTLS endpoint; if the environment variabel is "never", use the default API + endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise + use the default API endpoint. + + More details can be found at https://google.aip.dev/auth/4114. + + Args: + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. Only the `api_endpoint` and `client_cert_source` properties may be used + in this method. + + Returns: + Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the + client cert source to use. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If any errors happen. + """ + if client_options is None: + client_options = client_options_lib.ClientOptions() + use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") + use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") + if use_client_cert not in ("true", "false"): + raise ValueError( + "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + ) + if use_mtls_endpoint not in ("auto", "never", "always"): + raise MutualTLSChannelError( + "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" + ) + + # Figure out the client cert source to use. + client_cert_source = None + if use_client_cert == "true": + if client_options.client_cert_source: + client_cert_source = client_options.client_cert_source + elif mtls.has_default_client_cert_source(): + client_cert_source = mtls.default_client_cert_source() + + # Figure out which api endpoint to use. + if client_options.api_endpoint is not None: + api_endpoint = client_options.api_endpoint + elif use_mtls_endpoint == "always" or ( + use_mtls_endpoint == "auto" and client_cert_source + ): + api_endpoint = cls.DEFAULT_MTLS_ENDPOINT + else: + api_endpoint = cls.DEFAULT_ENDPOINT + + return api_endpoint, client_cert_source + + def __init__( + self, + *, + credentials: Optional[ga_credentials.Credentials] = None, + transport: Union[str, NetworkFirewallPoliciesTransport, None] = None, + client_options: Optional[client_options_lib.ClientOptions] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiates the network firewall policies client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, NetworkFirewallPoliciesTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. It won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + """ + if isinstance(client_options, dict): + client_options = client_options_lib.from_dict(client_options) + if client_options is None: + client_options = client_options_lib.ClientOptions() + + api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( + client_options + ) + + api_key_value = getattr(client_options, "api_key", None) + if api_key_value and credentials: + raise ValueError( + "client_options.api_key and credentials are mutually exclusive" + ) + + # Save or instantiate the transport. + # Ordinarily, we provide the transport, but allowing a custom transport + # instance provides an extensibility point for unusual situations. + if isinstance(transport, NetworkFirewallPoliciesTransport): + # transport is a NetworkFirewallPoliciesTransport instance. + if credentials or client_options.credentials_file or api_key_value: + raise ValueError( + "When providing a transport instance, " + "provide its credentials directly." + ) + if client_options.scopes: + raise ValueError( + "When providing a transport instance, provide its scopes " + "directly." + ) + self._transport = transport + else: + import google.auth._default # type: ignore + + if api_key_value and hasattr( + google.auth._default, "get_api_key_credentials" + ): + credentials = google.auth._default.get_api_key_credentials( + api_key_value + ) + + Transport = type(self).get_transport_class(transport) + self._transport = Transport( + credentials=credentials, + credentials_file=client_options.credentials_file, + host=api_endpoint, + scopes=client_options.scopes, + client_cert_source_for_mtls=client_cert_source_func, + quota_project_id=client_options.quota_project_id, + client_info=client_info, + always_use_jwt_access=True, + ) + + def add_association_unary( + self, + request: Union[compute.AddAssociationNetworkFirewallPolicyRequest, dict] = None, + *, + project: str = None, + firewall_policy: str = None, + firewall_policy_association_resource: compute.FirewallPolicyAssociation = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Inserts an association for the specified firewall + policy. + + Args: + request (Union[google.cloud.compute_v1.types.AddAssociationNetworkFirewallPolicyRequest, dict]): + The request object. A request message for + NetworkFirewallPolicies.AddAssociation. See the method + description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + firewall_policy (str): + Name of the firewall policy to + update. + + This corresponds to the ``firewall_policy`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + firewall_policy_association_resource (google.cloud.compute_v1.types.FirewallPolicyAssociation): + The body resource for this request + This corresponds to the ``firewall_policy_association_resource`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + [Global](/compute/docs/reference/rest/v1/globalOperations) + \* + [Regional](/compute/docs/reference/rest/v1/regionOperations) + \* + [Zonal](/compute/docs/reference/rest/v1/zoneOperations) + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the globalOperations + resource. - For regional operations, use the + regionOperations resource. - For zonal operations, use + the zonalOperations resource. For more information, read + Global, Regional, and Zonal Resources. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any( + [project, firewall_policy, firewall_policy_association_resource] + ) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.AddAssociationNetworkFirewallPolicyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, compute.AddAssociationNetworkFirewallPolicyRequest): + request = compute.AddAssociationNetworkFirewallPolicyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if firewall_policy is not None: + request.firewall_policy = firewall_policy + if firewall_policy_association_resource is not None: + request.firewall_policy_association_resource = ( + firewall_policy_association_resource + ) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.add_association] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def add_rule_unary( + self, + request: Union[compute.AddRuleNetworkFirewallPolicyRequest, dict] = None, + *, + project: str = None, + firewall_policy: str = None, + firewall_policy_rule_resource: compute.FirewallPolicyRule = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Inserts a rule into a firewall policy. + + Args: + request (Union[google.cloud.compute_v1.types.AddRuleNetworkFirewallPolicyRequest, dict]): + The request object. A request message for + NetworkFirewallPolicies.AddRule. See the method + description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + firewall_policy (str): + Name of the firewall policy to + update. + + This corresponds to the ``firewall_policy`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + firewall_policy_rule_resource (google.cloud.compute_v1.types.FirewallPolicyRule): + The body resource for this request + This corresponds to the ``firewall_policy_rule_resource`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + [Global](/compute/docs/reference/rest/v1/globalOperations) + \* + [Regional](/compute/docs/reference/rest/v1/regionOperations) + \* + [Zonal](/compute/docs/reference/rest/v1/zoneOperations) + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the globalOperations + resource. - For regional operations, use the + regionOperations resource. - For zonal operations, use + the zonalOperations resource. For more information, read + Global, Regional, and Zonal Resources. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any( + [project, firewall_policy, firewall_policy_rule_resource] + ) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.AddRuleNetworkFirewallPolicyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, compute.AddRuleNetworkFirewallPolicyRequest): + request = compute.AddRuleNetworkFirewallPolicyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if firewall_policy is not None: + request.firewall_policy = firewall_policy + if firewall_policy_rule_resource is not None: + request.firewall_policy_rule_resource = firewall_policy_rule_resource + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.add_rule] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def clone_rules_unary( + self, + request: Union[compute.CloneRulesNetworkFirewallPolicyRequest, dict] = None, + *, + project: str = None, + firewall_policy: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Copies rules to the specified firewall policy. + + Args: + request (Union[google.cloud.compute_v1.types.CloneRulesNetworkFirewallPolicyRequest, dict]): + The request object. A request message for + NetworkFirewallPolicies.CloneRules. See the method + description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + firewall_policy (str): + Name of the firewall policy to + update. + + This corresponds to the ``firewall_policy`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + [Global](/compute/docs/reference/rest/v1/globalOperations) + \* + [Regional](/compute/docs/reference/rest/v1/regionOperations) + \* + [Zonal](/compute/docs/reference/rest/v1/zoneOperations) + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the globalOperations + resource. - For regional operations, use the + regionOperations resource. - For zonal operations, use + the zonalOperations resource. For more information, read + Global, Regional, and Zonal Resources. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([project, firewall_policy]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.CloneRulesNetworkFirewallPolicyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, compute.CloneRulesNetworkFirewallPolicyRequest): + request = compute.CloneRulesNetworkFirewallPolicyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if firewall_policy is not None: + request.firewall_policy = firewall_policy + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.clone_rules] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def delete_unary( + self, + request: Union[compute.DeleteNetworkFirewallPolicyRequest, dict] = None, + *, + project: str = None, + firewall_policy: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Deletes the specified policy. + + Args: + request (Union[google.cloud.compute_v1.types.DeleteNetworkFirewallPolicyRequest, dict]): + The request object. A request message for + NetworkFirewallPolicies.Delete. See the method + description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + firewall_policy (str): + Name of the firewall policy to + delete. + + This corresponds to the ``firewall_policy`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + [Global](/compute/docs/reference/rest/v1/globalOperations) + \* + [Regional](/compute/docs/reference/rest/v1/regionOperations) + \* + [Zonal](/compute/docs/reference/rest/v1/zoneOperations) + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the globalOperations + resource. - For regional operations, use the + regionOperations resource. - For zonal operations, use + the zonalOperations resource. For more information, read + Global, Regional, and Zonal Resources. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([project, firewall_policy]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.DeleteNetworkFirewallPolicyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, compute.DeleteNetworkFirewallPolicyRequest): + request = compute.DeleteNetworkFirewallPolicyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if firewall_policy is not None: + request.firewall_policy = firewall_policy + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get( + self, + request: Union[compute.GetNetworkFirewallPolicyRequest, dict] = None, + *, + project: str = None, + firewall_policy: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.FirewallPolicy: + r"""Returns the specified network firewall policy. + + Args: + request (Union[google.cloud.compute_v1.types.GetNetworkFirewallPolicyRequest, dict]): + The request object. A request message for + NetworkFirewallPolicies.Get. See the method description + for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + firewall_policy (str): + Name of the firewall policy to get. + This corresponds to the ``firewall_policy`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.FirewallPolicy: + Represents a Firewall Policy + resource. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([project, firewall_policy]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.GetNetworkFirewallPolicyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, compute.GetNetworkFirewallPolicyRequest): + request = compute.GetNetworkFirewallPolicyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if firewall_policy is not None: + request.firewall_policy = firewall_policy + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_association( + self, + request: Union[compute.GetAssociationNetworkFirewallPolicyRequest, dict] = None, + *, + project: str = None, + firewall_policy: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.FirewallPolicyAssociation: + r"""Gets an association with the specified name. + + Args: + request (Union[google.cloud.compute_v1.types.GetAssociationNetworkFirewallPolicyRequest, dict]): + The request object. A request message for + NetworkFirewallPolicies.GetAssociation. See the method + description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + firewall_policy (str): + Name of the firewall policy to which + the queried association belongs. + + This corresponds to the ``firewall_policy`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.FirewallPolicyAssociation: + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([project, firewall_policy]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.GetAssociationNetworkFirewallPolicyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, compute.GetAssociationNetworkFirewallPolicyRequest): + request = compute.GetAssociationNetworkFirewallPolicyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if firewall_policy is not None: + request.firewall_policy = firewall_policy + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_association] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_iam_policy( + self, + request: Union[compute.GetIamPolicyNetworkFirewallPolicyRequest, dict] = None, + *, + project: str = None, + resource: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Policy: + r"""Gets the access control policy for a resource. May be + empty if no such policy or resource exists. + + Args: + request (Union[google.cloud.compute_v1.types.GetIamPolicyNetworkFirewallPolicyRequest, dict]): + The request object. A request message for + NetworkFirewallPolicies.GetIamPolicy. See the method + description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + resource (str): + Name or id of the resource for this + request. + + This corresponds to the ``resource`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.Policy: + An Identity and Access Management (IAM) policy, which + specifies access controls for Google Cloud resources. A + Policy is a collection of bindings. A binding binds one + or more members, or principals, to a single role. + Principals can be user accounts, service accounts, + Google groups, and domains (such as G Suite). A role is + a named list of permissions; each role can be an IAM + predefined role or a user-created custom role. For some + types of Google Cloud resources, a binding can also + specify a condition, which is a logical expression that + allows access to a resource only if the expression + evaluates to true. A condition can add constraints based + on attributes of the request, the resource, or both. To + learn which resources support conditions in their IAM + policies, see the [IAM + documentation](\ https://cloud.google.com/iam/help/conditions/resource-policies). + **JSON example:** { "bindings": [ { "role": + "roles/resourcemanager.organizationAdmin", "members": [ + "user:mike@example.com", "group:admins@example.com", + "domain:google.com", + "serviceAccount:my-project-id@appspot.gserviceaccount.com" + ] }, { "role": + "roles/resourcemanager.organizationViewer", "members": [ + "user:eve@example.com" ], "condition": { "title": + "expirable access", "description": "Does not grant + access after Sep 2020", "expression": "request.time < + timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": + "BwWWja0YfJA=", "version": 3 } **YAML example:** + bindings: - members: - user:\ mike@example.com - + group:\ admins@example.com - domain:google.com - + serviceAccount:\ my-project-id@appspot.gserviceaccount.com + role: roles/resourcemanager.organizationAdmin - members: + - user:\ eve@example.com role: + roles/resourcemanager.organizationViewer condition: + title: expirable access description: Does not grant + access after Sep 2020 expression: request.time < + timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= + version: 3 For a description of IAM and its features, + see the [IAM + documentation](\ https://cloud.google.com/iam/docs/). + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([project, resource]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.GetIamPolicyNetworkFirewallPolicyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, compute.GetIamPolicyNetworkFirewallPolicyRequest): + request = compute.GetIamPolicyNetworkFirewallPolicyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if resource is not None: + request.resource = resource + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_iam_policy] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_rule( + self, + request: Union[compute.GetRuleNetworkFirewallPolicyRequest, dict] = None, + *, + project: str = None, + firewall_policy: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.FirewallPolicyRule: + r"""Gets a rule of the specified priority. + + Args: + request (Union[google.cloud.compute_v1.types.GetRuleNetworkFirewallPolicyRequest, dict]): + The request object. A request message for + NetworkFirewallPolicies.GetRule. See the method + description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + firewall_policy (str): + Name of the firewall policy to which + the queried rule belongs. + + This corresponds to the ``firewall_policy`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.FirewallPolicyRule: + Represents a rule that describes one + or more match conditions along with the + action to be taken when traffic matches + this condition (allow or deny). + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([project, firewall_policy]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.GetRuleNetworkFirewallPolicyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, compute.GetRuleNetworkFirewallPolicyRequest): + request = compute.GetRuleNetworkFirewallPolicyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if firewall_policy is not None: + request.firewall_policy = firewall_policy + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_rule] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def insert_unary( + self, + request: Union[compute.InsertNetworkFirewallPolicyRequest, dict] = None, + *, + project: str = None, + firewall_policy_resource: compute.FirewallPolicy = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Creates a new policy in the specified project using + the data included in the request. + + Args: + request (Union[google.cloud.compute_v1.types.InsertNetworkFirewallPolicyRequest, dict]): + The request object. A request message for + NetworkFirewallPolicies.Insert. See the method + description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + firewall_policy_resource (google.cloud.compute_v1.types.FirewallPolicy): + The body resource for this request + This corresponds to the ``firewall_policy_resource`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + [Global](/compute/docs/reference/rest/v1/globalOperations) + \* + [Regional](/compute/docs/reference/rest/v1/regionOperations) + \* + [Zonal](/compute/docs/reference/rest/v1/zoneOperations) + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the globalOperations + resource. - For regional operations, use the + regionOperations resource. - For zonal operations, use + the zonalOperations resource. For more information, read + Global, Regional, and Zonal Resources. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([project, firewall_policy_resource]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.InsertNetworkFirewallPolicyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, compute.InsertNetworkFirewallPolicyRequest): + request = compute.InsertNetworkFirewallPolicyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if firewall_policy_resource is not None: + request.firewall_policy_resource = firewall_policy_resource + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.insert] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list( + self, + request: Union[compute.ListNetworkFirewallPoliciesRequest, dict] = None, + *, + project: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListPager: + r"""Lists all the policies that have been configured for + the specified project. + + Args: + request (Union[google.cloud.compute_v1.types.ListNetworkFirewallPoliciesRequest, dict]): + The request object. A request message for + NetworkFirewallPolicies.List. See the method description + for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.services.network_firewall_policies.pagers.ListPager: + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([project]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.ListNetworkFirewallPoliciesRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, compute.ListNetworkFirewallPoliciesRequest): + request = compute.ListNetworkFirewallPoliciesRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def patch_unary( + self, + request: Union[compute.PatchNetworkFirewallPolicyRequest, dict] = None, + *, + project: str = None, + firewall_policy: str = None, + firewall_policy_resource: compute.FirewallPolicy = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Patches the specified policy with the data included + in the request. + + Args: + request (Union[google.cloud.compute_v1.types.PatchNetworkFirewallPolicyRequest, dict]): + The request object. A request message for + NetworkFirewallPolicies.Patch. See the method + description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + firewall_policy (str): + Name of the firewall policy to + update. + + This corresponds to the ``firewall_policy`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + firewall_policy_resource (google.cloud.compute_v1.types.FirewallPolicy): + The body resource for this request + This corresponds to the ``firewall_policy_resource`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + [Global](/compute/docs/reference/rest/v1/globalOperations) + \* + [Regional](/compute/docs/reference/rest/v1/regionOperations) + \* + [Zonal](/compute/docs/reference/rest/v1/zoneOperations) + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the globalOperations + resource. - For regional operations, use the + regionOperations resource. - For zonal operations, use + the zonalOperations resource. For more information, read + Global, Regional, and Zonal Resources. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([project, firewall_policy, firewall_policy_resource]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.PatchNetworkFirewallPolicyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, compute.PatchNetworkFirewallPolicyRequest): + request = compute.PatchNetworkFirewallPolicyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if firewall_policy is not None: + request.firewall_policy = firewall_policy + if firewall_policy_resource is not None: + request.firewall_policy_resource = firewall_policy_resource + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.patch] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def patch_rule_unary( + self, + request: Union[compute.PatchRuleNetworkFirewallPolicyRequest, dict] = None, + *, + project: str = None, + firewall_policy: str = None, + firewall_policy_rule_resource: compute.FirewallPolicyRule = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Patches a rule of the specified priority. + + Args: + request (Union[google.cloud.compute_v1.types.PatchRuleNetworkFirewallPolicyRequest, dict]): + The request object. A request message for + NetworkFirewallPolicies.PatchRule. See the method + description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + firewall_policy (str): + Name of the firewall policy to + update. + + This corresponds to the ``firewall_policy`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + firewall_policy_rule_resource (google.cloud.compute_v1.types.FirewallPolicyRule): + The body resource for this request + This corresponds to the ``firewall_policy_rule_resource`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + [Global](/compute/docs/reference/rest/v1/globalOperations) + \* + [Regional](/compute/docs/reference/rest/v1/regionOperations) + \* + [Zonal](/compute/docs/reference/rest/v1/zoneOperations) + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the globalOperations + resource. - For regional operations, use the + regionOperations resource. - For zonal operations, use + the zonalOperations resource. For more information, read + Global, Regional, and Zonal Resources. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any( + [project, firewall_policy, firewall_policy_rule_resource] + ) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.PatchRuleNetworkFirewallPolicyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, compute.PatchRuleNetworkFirewallPolicyRequest): + request = compute.PatchRuleNetworkFirewallPolicyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if firewall_policy is not None: + request.firewall_policy = firewall_policy + if firewall_policy_rule_resource is not None: + request.firewall_policy_rule_resource = firewall_policy_rule_resource + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.patch_rule] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def remove_association_unary( + self, + request: Union[ + compute.RemoveAssociationNetworkFirewallPolicyRequest, dict + ] = None, + *, + project: str = None, + firewall_policy: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Removes an association for the specified firewall + policy. + + Args: + request (Union[google.cloud.compute_v1.types.RemoveAssociationNetworkFirewallPolicyRequest, dict]): + The request object. A request message for + NetworkFirewallPolicies.RemoveAssociation. See the + method description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + firewall_policy (str): + Name of the firewall policy to + update. + + This corresponds to the ``firewall_policy`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + [Global](/compute/docs/reference/rest/v1/globalOperations) + \* + [Regional](/compute/docs/reference/rest/v1/regionOperations) + \* + [Zonal](/compute/docs/reference/rest/v1/zoneOperations) + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the globalOperations + resource. - For regional operations, use the + regionOperations resource. - For zonal operations, use + the zonalOperations resource. For more information, read + Global, Regional, and Zonal Resources. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([project, firewall_policy]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.RemoveAssociationNetworkFirewallPolicyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance( + request, compute.RemoveAssociationNetworkFirewallPolicyRequest + ): + request = compute.RemoveAssociationNetworkFirewallPolicyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if firewall_policy is not None: + request.firewall_policy = firewall_policy + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.remove_association] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def remove_rule_unary( + self, + request: Union[compute.RemoveRuleNetworkFirewallPolicyRequest, dict] = None, + *, + project: str = None, + firewall_policy: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Deletes a rule of the specified priority. + + Args: + request (Union[google.cloud.compute_v1.types.RemoveRuleNetworkFirewallPolicyRequest, dict]): + The request object. A request message for + NetworkFirewallPolicies.RemoveRule. See the method + description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + firewall_policy (str): + Name of the firewall policy to + update. + + This corresponds to the ``firewall_policy`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + [Global](/compute/docs/reference/rest/v1/globalOperations) + \* + [Regional](/compute/docs/reference/rest/v1/regionOperations) + \* + [Zonal](/compute/docs/reference/rest/v1/zoneOperations) + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the globalOperations + resource. - For regional operations, use the + regionOperations resource. - For zonal operations, use + the zonalOperations resource. For more information, read + Global, Regional, and Zonal Resources. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([project, firewall_policy]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.RemoveRuleNetworkFirewallPolicyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, compute.RemoveRuleNetworkFirewallPolicyRequest): + request = compute.RemoveRuleNetworkFirewallPolicyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if firewall_policy is not None: + request.firewall_policy = firewall_policy + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.remove_rule] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def set_iam_policy( + self, + request: Union[compute.SetIamPolicyNetworkFirewallPolicyRequest, dict] = None, + *, + project: str = None, + resource: str = None, + global_set_policy_request_resource: compute.GlobalSetPolicyRequest = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Policy: + r"""Sets the access control policy on the specified + resource. Replaces any existing policy. + + Args: + request (Union[google.cloud.compute_v1.types.SetIamPolicyNetworkFirewallPolicyRequest, dict]): + The request object. A request message for + NetworkFirewallPolicies.SetIamPolicy. See the method + description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + resource (str): + Name or id of the resource for this + request. + + This corresponds to the ``resource`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + global_set_policy_request_resource (google.cloud.compute_v1.types.GlobalSetPolicyRequest): + The body resource for this request + This corresponds to the ``global_set_policy_request_resource`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.Policy: + An Identity and Access Management (IAM) policy, which + specifies access controls for Google Cloud resources. A + Policy is a collection of bindings. A binding binds one + or more members, or principals, to a single role. + Principals can be user accounts, service accounts, + Google groups, and domains (such as G Suite). A role is + a named list of permissions; each role can be an IAM + predefined role or a user-created custom role. For some + types of Google Cloud resources, a binding can also + specify a condition, which is a logical expression that + allows access to a resource only if the expression + evaluates to true. A condition can add constraints based + on attributes of the request, the resource, or both. To + learn which resources support conditions in their IAM + policies, see the [IAM + documentation](\ https://cloud.google.com/iam/help/conditions/resource-policies). + **JSON example:** { "bindings": [ { "role": + "roles/resourcemanager.organizationAdmin", "members": [ + "user:mike@example.com", "group:admins@example.com", + "domain:google.com", + "serviceAccount:my-project-id@appspot.gserviceaccount.com" + ] }, { "role": + "roles/resourcemanager.organizationViewer", "members": [ + "user:eve@example.com" ], "condition": { "title": + "expirable access", "description": "Does not grant + access after Sep 2020", "expression": "request.time < + timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": + "BwWWja0YfJA=", "version": 3 } **YAML example:** + bindings: - members: - user:\ mike@example.com - + group:\ admins@example.com - domain:google.com - + serviceAccount:\ my-project-id@appspot.gserviceaccount.com + role: roles/resourcemanager.organizationAdmin - members: + - user:\ eve@example.com role: + roles/resourcemanager.organizationViewer condition: + title: expirable access description: Does not grant + access after Sep 2020 expression: request.time < + timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= + version: 3 For a description of IAM and its features, + see the [IAM + documentation](\ https://cloud.google.com/iam/docs/). + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any( + [project, resource, global_set_policy_request_resource] + ) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.SetIamPolicyNetworkFirewallPolicyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, compute.SetIamPolicyNetworkFirewallPolicyRequest): + request = compute.SetIamPolicyNetworkFirewallPolicyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if resource is not None: + request.resource = resource + if global_set_policy_request_resource is not None: + request.global_set_policy_request_resource = ( + global_set_policy_request_resource + ) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.set_iam_policy] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def test_iam_permissions( + self, + request: Union[ + compute.TestIamPermissionsNetworkFirewallPolicyRequest, dict + ] = None, + *, + project: str = None, + resource: str = None, + test_permissions_request_resource: compute.TestPermissionsRequest = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.TestPermissionsResponse: + r"""Returns permissions that a caller has on the + specified resource. + + Args: + request (Union[google.cloud.compute_v1.types.TestIamPermissionsNetworkFirewallPolicyRequest, dict]): + The request object. A request message for + NetworkFirewallPolicies.TestIamPermissions. See the + method description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + resource (str): + Name or id of the resource for this + request. + + This corresponds to the ``resource`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + test_permissions_request_resource (google.cloud.compute_v1.types.TestPermissionsRequest): + The body resource for this request + This corresponds to the ``test_permissions_request_resource`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.TestPermissionsResponse: + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any( + [project, resource, test_permissions_request_resource] + ) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.TestIamPermissionsNetworkFirewallPolicyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance( + request, compute.TestIamPermissionsNetworkFirewallPolicyRequest + ): + request = compute.TestIamPermissionsNetworkFirewallPolicyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if resource is not None: + request.resource = resource + if test_permissions_request_resource is not None: + request.test_permissions_request_resource = ( + test_permissions_request_resource + ) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.test_iam_permissions] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def __enter__(self): + return self + + def __exit__(self, type, value, traceback): + """Releases underlying transport's resources. + + .. warning:: + ONLY use as a context manager if the transport is NOT shared + with other clients! Exiting the with block will CLOSE the transport + and may cause errors in other clients! + """ + self.transport.close() + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ("NetworkFirewallPoliciesClient",) diff --git a/google/cloud/compute_v1/services/network_firewall_policies/pagers.py b/google/cloud/compute_v1/services/network_firewall_policies/pagers.py new file mode 100644 index 000000000..cd2b0f89b --- /dev/null +++ b/google/cloud/compute_v1/services/network_firewall_policies/pagers.py @@ -0,0 +1,89 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +from typing import ( + Any, + AsyncIterator, + Awaitable, + Callable, + Sequence, + Tuple, + Optional, + Iterator, +) + +from google.cloud.compute_v1.types import compute + + +class ListPager: + """A pager for iterating through ``list`` requests. + + This class thinly wraps an initial + :class:`google.cloud.compute_v1.types.FirewallPolicyList` object, and + provides an ``__iter__`` method to iterate through its + ``items`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``List`` requests and continue to iterate + through the ``items`` field on the + corresponding responses. + + All the usual :class:`google.cloud.compute_v1.types.FirewallPolicyList` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., compute.FirewallPolicyList], + request: compute.ListNetworkFirewallPoliciesRequest, + response: compute.FirewallPolicyList, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.compute_v1.types.ListNetworkFirewallPoliciesRequest): + The initial request object. + response (google.cloud.compute_v1.types.FirewallPolicyList): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = compute.ListNetworkFirewallPoliciesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[compute.FirewallPolicyList]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[compute.FirewallPolicy]: + for page in self.pages: + yield from page.items + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/cloud/compute_v1/services/network_firewall_policies/transports/__init__.py b/google/cloud/compute_v1/services/network_firewall_policies/transports/__init__.py new file mode 100644 index 000000000..898b3733b --- /dev/null +++ b/google/cloud/compute_v1/services/network_firewall_policies/transports/__init__.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +from collections import OrderedDict +from typing import Dict, Type + +from .base import NetworkFirewallPoliciesTransport +from .rest import NetworkFirewallPoliciesRestTransport +from .rest import NetworkFirewallPoliciesRestInterceptor + + +# Compile a registry of transports. +_transport_registry = ( + OrderedDict() +) # type: Dict[str, Type[NetworkFirewallPoliciesTransport]] +_transport_registry["rest"] = NetworkFirewallPoliciesRestTransport + +__all__ = ( + "NetworkFirewallPoliciesTransport", + "NetworkFirewallPoliciesRestTransport", + "NetworkFirewallPoliciesRestInterceptor", +) diff --git a/google/cloud/compute_v1/services/network_firewall_policies/transports/base.py b/google/cloud/compute_v1/services/network_firewall_policies/transports/base.py new file mode 100644 index 000000000..9d3df658e --- /dev/null +++ b/google/cloud/compute_v1/services/network_firewall_policies/transports/base.py @@ -0,0 +1,367 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +import abc +from typing import Awaitable, Callable, Dict, Optional, Sequence, Union +import pkg_resources + +import google.auth # type: ignore +import google.api_core +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries +from google.auth import credentials as ga_credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.compute_v1.types import compute + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +class NetworkFirewallPoliciesTransport(abc.ABC): + """Abstract transport class for NetworkFirewallPolicies.""" + + AUTH_SCOPES = ( + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/cloud-platform", + ) + + DEFAULT_HOST: str = "compute.googleapis.com" + + def __init__( + self, + *, + host: str = DEFAULT_HOST, + credentials: ga_credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + **kwargs, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): + The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A list of scopes. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + + scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} + + # Save the scopes. + self._scopes = scopes + + # If no credentials are provided, then determine the appropriate + # defaults. + if credentials and credentials_file: + raise core_exceptions.DuplicateCredentialArgs( + "'credentials_file' and 'credentials' are mutually exclusive" + ) + + if credentials_file is not None: + credentials, _ = google.auth.load_credentials_from_file( + credentials_file, **scopes_kwargs, quota_project_id=quota_project_id + ) + elif credentials is None: + credentials, _ = google.auth.default( + **scopes_kwargs, quota_project_id=quota_project_id + ) + + # If the credentials are service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + + # Save the credentials. + self._credentials = credentials + + def _prep_wrapped_messages(self, client_info): + # Precompute the wrapped methods. + self._wrapped_methods = { + self.add_association: gapic_v1.method.wrap_method( + self.add_association, + default_timeout=None, + client_info=client_info, + ), + self.add_rule: gapic_v1.method.wrap_method( + self.add_rule, + default_timeout=None, + client_info=client_info, + ), + self.clone_rules: gapic_v1.method.wrap_method( + self.clone_rules, + default_timeout=None, + client_info=client_info, + ), + self.delete: gapic_v1.method.wrap_method( + self.delete, + default_timeout=None, + client_info=client_info, + ), + self.get: gapic_v1.method.wrap_method( + self.get, + default_timeout=None, + client_info=client_info, + ), + self.get_association: gapic_v1.method.wrap_method( + self.get_association, + default_timeout=None, + client_info=client_info, + ), + self.get_iam_policy: gapic_v1.method.wrap_method( + self.get_iam_policy, + default_timeout=None, + client_info=client_info, + ), + self.get_rule: gapic_v1.method.wrap_method( + self.get_rule, + default_timeout=None, + client_info=client_info, + ), + self.insert: gapic_v1.method.wrap_method( + self.insert, + default_timeout=None, + client_info=client_info, + ), + self.list: gapic_v1.method.wrap_method( + self.list, + default_timeout=None, + client_info=client_info, + ), + self.patch: gapic_v1.method.wrap_method( + self.patch, + default_timeout=None, + client_info=client_info, + ), + self.patch_rule: gapic_v1.method.wrap_method( + self.patch_rule, + default_timeout=None, + client_info=client_info, + ), + self.remove_association: gapic_v1.method.wrap_method( + self.remove_association, + default_timeout=None, + client_info=client_info, + ), + self.remove_rule: gapic_v1.method.wrap_method( + self.remove_rule, + default_timeout=None, + client_info=client_info, + ), + self.set_iam_policy: gapic_v1.method.wrap_method( + self.set_iam_policy, + default_timeout=None, + client_info=client_info, + ), + self.test_iam_permissions: gapic_v1.method.wrap_method( + self.test_iam_permissions, + default_timeout=None, + client_info=client_info, + ), + } + + def close(self): + """Closes resources associated with the transport. + + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! + """ + raise NotImplementedError() + + @property + def add_association( + self, + ) -> Callable[ + [compute.AddAssociationNetworkFirewallPolicyRequest], + Union[compute.Operation, Awaitable[compute.Operation]], + ]: + raise NotImplementedError() + + @property + def add_rule( + self, + ) -> Callable[ + [compute.AddRuleNetworkFirewallPolicyRequest], + Union[compute.Operation, Awaitable[compute.Operation]], + ]: + raise NotImplementedError() + + @property + def clone_rules( + self, + ) -> Callable[ + [compute.CloneRulesNetworkFirewallPolicyRequest], + Union[compute.Operation, Awaitable[compute.Operation]], + ]: + raise NotImplementedError() + + @property + def delete( + self, + ) -> Callable[ + [compute.DeleteNetworkFirewallPolicyRequest], + Union[compute.Operation, Awaitable[compute.Operation]], + ]: + raise NotImplementedError() + + @property + def get( + self, + ) -> Callable[ + [compute.GetNetworkFirewallPolicyRequest], + Union[compute.FirewallPolicy, Awaitable[compute.FirewallPolicy]], + ]: + raise NotImplementedError() + + @property + def get_association( + self, + ) -> Callable[ + [compute.GetAssociationNetworkFirewallPolicyRequest], + Union[ + compute.FirewallPolicyAssociation, + Awaitable[compute.FirewallPolicyAssociation], + ], + ]: + raise NotImplementedError() + + @property + def get_iam_policy( + self, + ) -> Callable[ + [compute.GetIamPolicyNetworkFirewallPolicyRequest], + Union[compute.Policy, Awaitable[compute.Policy]], + ]: + raise NotImplementedError() + + @property + def get_rule( + self, + ) -> Callable[ + [compute.GetRuleNetworkFirewallPolicyRequest], + Union[compute.FirewallPolicyRule, Awaitable[compute.FirewallPolicyRule]], + ]: + raise NotImplementedError() + + @property + def insert( + self, + ) -> Callable[ + [compute.InsertNetworkFirewallPolicyRequest], + Union[compute.Operation, Awaitable[compute.Operation]], + ]: + raise NotImplementedError() + + @property + def list( + self, + ) -> Callable[ + [compute.ListNetworkFirewallPoliciesRequest], + Union[compute.FirewallPolicyList, Awaitable[compute.FirewallPolicyList]], + ]: + raise NotImplementedError() + + @property + def patch( + self, + ) -> Callable[ + [compute.PatchNetworkFirewallPolicyRequest], + Union[compute.Operation, Awaitable[compute.Operation]], + ]: + raise NotImplementedError() + + @property + def patch_rule( + self, + ) -> Callable[ + [compute.PatchRuleNetworkFirewallPolicyRequest], + Union[compute.Operation, Awaitable[compute.Operation]], + ]: + raise NotImplementedError() + + @property + def remove_association( + self, + ) -> Callable[ + [compute.RemoveAssociationNetworkFirewallPolicyRequest], + Union[compute.Operation, Awaitable[compute.Operation]], + ]: + raise NotImplementedError() + + @property + def remove_rule( + self, + ) -> Callable[ + [compute.RemoveRuleNetworkFirewallPolicyRequest], + Union[compute.Operation, Awaitable[compute.Operation]], + ]: + raise NotImplementedError() + + @property + def set_iam_policy( + self, + ) -> Callable[ + [compute.SetIamPolicyNetworkFirewallPolicyRequest], + Union[compute.Policy, Awaitable[compute.Policy]], + ]: + raise NotImplementedError() + + @property + def test_iam_permissions( + self, + ) -> Callable[ + [compute.TestIamPermissionsNetworkFirewallPolicyRequest], + Union[ + compute.TestPermissionsResponse, Awaitable[compute.TestPermissionsResponse] + ], + ]: + raise NotImplementedError() + + +__all__ = ("NetworkFirewallPoliciesTransport",) diff --git a/google/cloud/compute_v1/services/network_firewall_policies/transports/rest.py b/google/cloud/compute_v1/services/network_firewall_policies/transports/rest.py new file mode 100644 index 000000000..90b9e38c2 --- /dev/null +++ b/google/cloud/compute_v1/services/network_firewall_policies/transports/rest.py @@ -0,0 +1,2619 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# + +from google.auth.transport.requests import AuthorizedSession # type: ignore +import json # type: ignore +import grpc # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.auth import credentials as ga_credentials # type: ignore +from google.api_core import exceptions as core_exceptions +from google.api_core import retry as retries +from google.api_core import rest_helpers +from google.api_core import rest_streaming +from google.api_core import path_template +from google.api_core import gapic_v1 + +from requests import __version__ as requests_version +import dataclasses +import re +from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +import warnings + +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore + + +from google.cloud.compute_v1.types import compute + +from .base import ( + NetworkFirewallPoliciesTransport, + DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO, +) + + +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version, + grpc_version=None, + rest_version=requests_version, +) + + +class NetworkFirewallPoliciesRestInterceptor: + """Interceptor for NetworkFirewallPolicies. + + Interceptors are used to manipulate requests, request metadata, and responses + in arbitrary ways. + Example use cases include: + * Logging + * Verifying requests according to service or custom semantics + * Stripping extraneous information from responses + + These use cases and more can be enabled by injecting an + instance of a custom subclass when constructing the NetworkFirewallPoliciesRestTransport. + + .. code-block:: python + class MyCustomNetworkFirewallPoliciesInterceptor(NetworkFirewallPoliciesRestInterceptor): + def pre_add_association(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_add_association(response): + logging.log(f"Received response: {response}") + + def pre_add_rule(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_add_rule(response): + logging.log(f"Received response: {response}") + + def pre_clone_rules(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_clone_rules(response): + logging.log(f"Received response: {response}") + + def pre_delete(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_delete(response): + logging.log(f"Received response: {response}") + + def pre_get(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_get(response): + logging.log(f"Received response: {response}") + + def pre_get_association(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_get_association(response): + logging.log(f"Received response: {response}") + + def pre_get_iam_policy(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_get_iam_policy(response): + logging.log(f"Received response: {response}") + + def pre_get_rule(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_get_rule(response): + logging.log(f"Received response: {response}") + + def pre_insert(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_insert(response): + logging.log(f"Received response: {response}") + + def pre_list(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_list(response): + logging.log(f"Received response: {response}") + + def pre_patch(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_patch(response): + logging.log(f"Received response: {response}") + + def pre_patch_rule(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_patch_rule(response): + logging.log(f"Received response: {response}") + + def pre_remove_association(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_remove_association(response): + logging.log(f"Received response: {response}") + + def pre_remove_rule(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_remove_rule(response): + logging.log(f"Received response: {response}") + + def pre_set_iam_policy(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_set_iam_policy(response): + logging.log(f"Received response: {response}") + + def pre_test_iam_permissions(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_test_iam_permissions(response): + logging.log(f"Received response: {response}") + + transport = NetworkFirewallPoliciesRestTransport(interceptor=MyCustomNetworkFirewallPoliciesInterceptor()) + client = NetworkFirewallPoliciesClient(transport=transport) + + + """ + + def pre_add_association( + self, + request: compute.AddAssociationNetworkFirewallPolicyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + compute.AddAssociationNetworkFirewallPolicyRequest, Sequence[Tuple[str, str]] + ]: + """Pre-rpc interceptor for add_association + + Override in a subclass to manipulate the request or metadata + before they are sent to the NetworkFirewallPolicies server. + """ + return request, metadata + + def post_add_association(self, response: compute.Operation) -> compute.Operation: + """Post-rpc interceptor for add_association + + Override in a subclass to manipulate the response + after it is returned by the NetworkFirewallPolicies server but before + it is returned to user code. + """ + return response + + def pre_add_rule( + self, + request: compute.AddRuleNetworkFirewallPolicyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[compute.AddRuleNetworkFirewallPolicyRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for add_rule + + Override in a subclass to manipulate the request or metadata + before they are sent to the NetworkFirewallPolicies server. + """ + return request, metadata + + def post_add_rule(self, response: compute.Operation) -> compute.Operation: + """Post-rpc interceptor for add_rule + + Override in a subclass to manipulate the response + after it is returned by the NetworkFirewallPolicies server but before + it is returned to user code. + """ + return response + + def pre_clone_rules( + self, + request: compute.CloneRulesNetworkFirewallPolicyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + compute.CloneRulesNetworkFirewallPolicyRequest, Sequence[Tuple[str, str]] + ]: + """Pre-rpc interceptor for clone_rules + + Override in a subclass to manipulate the request or metadata + before they are sent to the NetworkFirewallPolicies server. + """ + return request, metadata + + def post_clone_rules(self, response: compute.Operation) -> compute.Operation: + """Post-rpc interceptor for clone_rules + + Override in a subclass to manipulate the response + after it is returned by the NetworkFirewallPolicies server but before + it is returned to user code. + """ + return response + + def pre_delete( + self, + request: compute.DeleteNetworkFirewallPolicyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[compute.DeleteNetworkFirewallPolicyRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for delete + + Override in a subclass to manipulate the request or metadata + before they are sent to the NetworkFirewallPolicies server. + """ + return request, metadata + + def post_delete(self, response: compute.Operation) -> compute.Operation: + """Post-rpc interceptor for delete + + Override in a subclass to manipulate the response + after it is returned by the NetworkFirewallPolicies server but before + it is returned to user code. + """ + return response + + def pre_get( + self, + request: compute.GetNetworkFirewallPolicyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[compute.GetNetworkFirewallPolicyRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for get + + Override in a subclass to manipulate the request or metadata + before they are sent to the NetworkFirewallPolicies server. + """ + return request, metadata + + def post_get(self, response: compute.FirewallPolicy) -> compute.FirewallPolicy: + """Post-rpc interceptor for get + + Override in a subclass to manipulate the response + after it is returned by the NetworkFirewallPolicies server but before + it is returned to user code. + """ + return response + + def pre_get_association( + self, + request: compute.GetAssociationNetworkFirewallPolicyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + compute.GetAssociationNetworkFirewallPolicyRequest, Sequence[Tuple[str, str]] + ]: + """Pre-rpc interceptor for get_association + + Override in a subclass to manipulate the request or metadata + before they are sent to the NetworkFirewallPolicies server. + """ + return request, metadata + + def post_get_association( + self, response: compute.FirewallPolicyAssociation + ) -> compute.FirewallPolicyAssociation: + """Post-rpc interceptor for get_association + + Override in a subclass to manipulate the response + after it is returned by the NetworkFirewallPolicies server but before + it is returned to user code. + """ + return response + + def pre_get_iam_policy( + self, + request: compute.GetIamPolicyNetworkFirewallPolicyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + compute.GetIamPolicyNetworkFirewallPolicyRequest, Sequence[Tuple[str, str]] + ]: + """Pre-rpc interceptor for get_iam_policy + + Override in a subclass to manipulate the request or metadata + before they are sent to the NetworkFirewallPolicies server. + """ + return request, metadata + + def post_get_iam_policy(self, response: compute.Policy) -> compute.Policy: + """Post-rpc interceptor for get_iam_policy + + Override in a subclass to manipulate the response + after it is returned by the NetworkFirewallPolicies server but before + it is returned to user code. + """ + return response + + def pre_get_rule( + self, + request: compute.GetRuleNetworkFirewallPolicyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[compute.GetRuleNetworkFirewallPolicyRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for get_rule + + Override in a subclass to manipulate the request or metadata + before they are sent to the NetworkFirewallPolicies server. + """ + return request, metadata + + def post_get_rule( + self, response: compute.FirewallPolicyRule + ) -> compute.FirewallPolicyRule: + """Post-rpc interceptor for get_rule + + Override in a subclass to manipulate the response + after it is returned by the NetworkFirewallPolicies server but before + it is returned to user code. + """ + return response + + def pre_insert( + self, + request: compute.InsertNetworkFirewallPolicyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[compute.InsertNetworkFirewallPolicyRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for insert + + Override in a subclass to manipulate the request or metadata + before they are sent to the NetworkFirewallPolicies server. + """ + return request, metadata + + def post_insert(self, response: compute.Operation) -> compute.Operation: + """Post-rpc interceptor for insert + + Override in a subclass to manipulate the response + after it is returned by the NetworkFirewallPolicies server but before + it is returned to user code. + """ + return response + + def pre_list( + self, + request: compute.ListNetworkFirewallPoliciesRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[compute.ListNetworkFirewallPoliciesRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for list + + Override in a subclass to manipulate the request or metadata + before they are sent to the NetworkFirewallPolicies server. + """ + return request, metadata + + def post_list( + self, response: compute.FirewallPolicyList + ) -> compute.FirewallPolicyList: + """Post-rpc interceptor for list + + Override in a subclass to manipulate the response + after it is returned by the NetworkFirewallPolicies server but before + it is returned to user code. + """ + return response + + def pre_patch( + self, + request: compute.PatchNetworkFirewallPolicyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[compute.PatchNetworkFirewallPolicyRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for patch + + Override in a subclass to manipulate the request or metadata + before they are sent to the NetworkFirewallPolicies server. + """ + return request, metadata + + def post_patch(self, response: compute.Operation) -> compute.Operation: + """Post-rpc interceptor for patch + + Override in a subclass to manipulate the response + after it is returned by the NetworkFirewallPolicies server but before + it is returned to user code. + """ + return response + + def pre_patch_rule( + self, + request: compute.PatchRuleNetworkFirewallPolicyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + compute.PatchRuleNetworkFirewallPolicyRequest, Sequence[Tuple[str, str]] + ]: + """Pre-rpc interceptor for patch_rule + + Override in a subclass to manipulate the request or metadata + before they are sent to the NetworkFirewallPolicies server. + """ + return request, metadata + + def post_patch_rule(self, response: compute.Operation) -> compute.Operation: + """Post-rpc interceptor for patch_rule + + Override in a subclass to manipulate the response + after it is returned by the NetworkFirewallPolicies server but before + it is returned to user code. + """ + return response + + def pre_remove_association( + self, + request: compute.RemoveAssociationNetworkFirewallPolicyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + compute.RemoveAssociationNetworkFirewallPolicyRequest, Sequence[Tuple[str, str]] + ]: + """Pre-rpc interceptor for remove_association + + Override in a subclass to manipulate the request or metadata + before they are sent to the NetworkFirewallPolicies server. + """ + return request, metadata + + def post_remove_association(self, response: compute.Operation) -> compute.Operation: + """Post-rpc interceptor for remove_association + + Override in a subclass to manipulate the response + after it is returned by the NetworkFirewallPolicies server but before + it is returned to user code. + """ + return response + + def pre_remove_rule( + self, + request: compute.RemoveRuleNetworkFirewallPolicyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + compute.RemoveRuleNetworkFirewallPolicyRequest, Sequence[Tuple[str, str]] + ]: + """Pre-rpc interceptor for remove_rule + + Override in a subclass to manipulate the request or metadata + before they are sent to the NetworkFirewallPolicies server. + """ + return request, metadata + + def post_remove_rule(self, response: compute.Operation) -> compute.Operation: + """Post-rpc interceptor for remove_rule + + Override in a subclass to manipulate the response + after it is returned by the NetworkFirewallPolicies server but before + it is returned to user code. + """ + return response + + def pre_set_iam_policy( + self, + request: compute.SetIamPolicyNetworkFirewallPolicyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + compute.SetIamPolicyNetworkFirewallPolicyRequest, Sequence[Tuple[str, str]] + ]: + """Pre-rpc interceptor for set_iam_policy + + Override in a subclass to manipulate the request or metadata + before they are sent to the NetworkFirewallPolicies server. + """ + return request, metadata + + def post_set_iam_policy(self, response: compute.Policy) -> compute.Policy: + """Post-rpc interceptor for set_iam_policy + + Override in a subclass to manipulate the response + after it is returned by the NetworkFirewallPolicies server but before + it is returned to user code. + """ + return response + + def pre_test_iam_permissions( + self, + request: compute.TestIamPermissionsNetworkFirewallPolicyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + compute.TestIamPermissionsNetworkFirewallPolicyRequest, + Sequence[Tuple[str, str]], + ]: + """Pre-rpc interceptor for test_iam_permissions + + Override in a subclass to manipulate the request or metadata + before they are sent to the NetworkFirewallPolicies server. + """ + return request, metadata + + def post_test_iam_permissions( + self, response: compute.TestPermissionsResponse + ) -> compute.TestPermissionsResponse: + """Post-rpc interceptor for test_iam_permissions + + Override in a subclass to manipulate the response + after it is returned by the NetworkFirewallPolicies server but before + it is returned to user code. + """ + return response + + +@dataclasses.dataclass +class NetworkFirewallPoliciesRestStub: + _session: AuthorizedSession + _host: str + _interceptor: NetworkFirewallPoliciesRestInterceptor + + +class NetworkFirewallPoliciesRestTransport(NetworkFirewallPoliciesTransport): + """REST backend transport for NetworkFirewallPolicies. + + The NetworkFirewallPolicies API. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends JSON representations of protocol buffers over HTTP/1.1 + """ + + _STUBS: Dict[str, NetworkFirewallPoliciesRestStub] = {} + + def __init__( + self, + *, + host: str = "compute.googleapis.com", + credentials: ga_credentials.Credentials = None, + credentials_file: str = None, + scopes: Sequence[str] = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + url_scheme: str = "https", + interceptor: Optional[NetworkFirewallPoliciesRestInterceptor] = None, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): + The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client + certificate to configure mutual TLS HTTP channel. It is ignored + if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you are developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + url_scheme: the protocol scheme for the API endpoint. Normally + "https", but for testing or local servers, + "http" can be specified. + """ + # Run the base constructor + # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. + # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the + # credentials object + maybe_url_match = re.match("^(?Phttp(?:s)?://)?(?P.*)$", host) + if maybe_url_match is None: + raise ValueError( + f"Unexpected hostname structure: {host}" + ) # pragma: NO COVER + + url_match_items = maybe_url_match.groupdict() + + host = f"{url_scheme}://{host}" if not url_match_items["scheme"] else host + + super().__init__( + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, + ) + self._session = AuthorizedSession( + self._credentials, default_host=self.DEFAULT_HOST + ) + if client_cert_source_for_mtls: + self._session.configure_mtls_channel(client_cert_source_for_mtls) + self._interceptor = interceptor or NetworkFirewallPoliciesRestInterceptor() + self._prep_wrapped_messages(client_info) + + class _AddAssociation(NetworkFirewallPoliciesRestStub): + def __hash__(self): + return hash("AddAssociation") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.AddAssociationNetworkFirewallPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Call the add association method over HTTP. + + Args: + request (~.compute.AddAssociationNetworkFirewallPolicyRequest): + The request object. A request message for + NetworkFirewallPolicies.AddAssociation. + See the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/compute/v1/projects/{project}/global/firewallPolicies/{firewall_policy}/addAssociation", + "body": "firewall_policy_association_resource", + }, + ] + request, metadata = self._interceptor.pre_add_association(request, metadata) + request_kwargs = compute.AddAssociationNetworkFirewallPolicyRequest.to_dict( + request + ) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + # Jsonify the request body + body = compute.FirewallPolicyAssociation.to_json( + compute.FirewallPolicyAssociation(transcoded_request["body"]), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.AddAssociationNetworkFirewallPolicyRequest.to_json( + compute.AddAssociationNetworkFirewallPolicyRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.Operation.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_add_association(resp) + return resp + + class _AddRule(NetworkFirewallPoliciesRestStub): + def __hash__(self): + return hash("AddRule") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.AddRuleNetworkFirewallPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Call the add rule method over HTTP. + + Args: + request (~.compute.AddRuleNetworkFirewallPolicyRequest): + The request object. A request message for + NetworkFirewallPolicies.AddRule. See the + method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/compute/v1/projects/{project}/global/firewallPolicies/{firewall_policy}/addRule", + "body": "firewall_policy_rule_resource", + }, + ] + request, metadata = self._interceptor.pre_add_rule(request, metadata) + request_kwargs = compute.AddRuleNetworkFirewallPolicyRequest.to_dict( + request + ) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + # Jsonify the request body + body = compute.FirewallPolicyRule.to_json( + compute.FirewallPolicyRule(transcoded_request["body"]), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.AddRuleNetworkFirewallPolicyRequest.to_json( + compute.AddRuleNetworkFirewallPolicyRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.Operation.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_add_rule(resp) + return resp + + class _CloneRules(NetworkFirewallPoliciesRestStub): + def __hash__(self): + return hash("CloneRules") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.CloneRulesNetworkFirewallPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Call the clone rules method over HTTP. + + Args: + request (~.compute.CloneRulesNetworkFirewallPolicyRequest): + The request object. A request message for + NetworkFirewallPolicies.CloneRules. See + the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/compute/v1/projects/{project}/global/firewallPolicies/{firewall_policy}/cloneRules", + }, + ] + request, metadata = self._interceptor.pre_clone_rules(request, metadata) + request_kwargs = compute.CloneRulesNetworkFirewallPolicyRequest.to_dict( + request + ) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.CloneRulesNetworkFirewallPolicyRequest.to_json( + compute.CloneRulesNetworkFirewallPolicyRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.Operation.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_clone_rules(resp) + return resp + + class _Delete(NetworkFirewallPoliciesRestStub): + def __hash__(self): + return hash("Delete") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.DeleteNetworkFirewallPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Call the delete method over HTTP. + + Args: + request (~.compute.DeleteNetworkFirewallPolicyRequest): + The request object. A request message for + NetworkFirewallPolicies.Delete. See the + method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "delete", + "uri": "/compute/v1/projects/{project}/global/firewallPolicies/{firewall_policy}", + }, + ] + request, metadata = self._interceptor.pre_delete(request, metadata) + request_kwargs = compute.DeleteNetworkFirewallPolicyRequest.to_dict(request) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.DeleteNetworkFirewallPolicyRequest.to_json( + compute.DeleteNetworkFirewallPolicyRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.Operation.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_delete(resp) + return resp + + class _Get(NetworkFirewallPoliciesRestStub): + def __hash__(self): + return hash("Get") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.GetNetworkFirewallPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.FirewallPolicy: + r"""Call the get method over HTTP. + + Args: + request (~.compute.GetNetworkFirewallPolicyRequest): + The request object. A request message for + NetworkFirewallPolicies.Get. See the + method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.FirewallPolicy: + Represents a Firewall Policy + resource. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/compute/v1/projects/{project}/global/firewallPolicies/{firewall_policy}", + }, + ] + request, metadata = self._interceptor.pre_get(request, metadata) + request_kwargs = compute.GetNetworkFirewallPolicyRequest.to_dict(request) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.GetNetworkFirewallPolicyRequest.to_json( + compute.GetNetworkFirewallPolicyRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.FirewallPolicy.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_get(resp) + return resp + + class _GetAssociation(NetworkFirewallPoliciesRestStub): + def __hash__(self): + return hash("GetAssociation") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.GetAssociationNetworkFirewallPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.FirewallPolicyAssociation: + r"""Call the get association method over HTTP. + + Args: + request (~.compute.GetAssociationNetworkFirewallPolicyRequest): + The request object. A request message for + NetworkFirewallPolicies.GetAssociation. + See the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.FirewallPolicyAssociation: + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/compute/v1/projects/{project}/global/firewallPolicies/{firewall_policy}/getAssociation", + }, + ] + request, metadata = self._interceptor.pre_get_association(request, metadata) + request_kwargs = compute.GetAssociationNetworkFirewallPolicyRequest.to_dict( + request + ) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.GetAssociationNetworkFirewallPolicyRequest.to_json( + compute.GetAssociationNetworkFirewallPolicyRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.FirewallPolicyAssociation.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_get_association(resp) + return resp + + class _GetIamPolicy(NetworkFirewallPoliciesRestStub): + def __hash__(self): + return hash("GetIamPolicy") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.GetIamPolicyNetworkFirewallPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Policy: + r"""Call the get iam policy method over HTTP. + + Args: + request (~.compute.GetIamPolicyNetworkFirewallPolicyRequest): + The request object. A request message for + NetworkFirewallPolicies.GetIamPolicy. + See the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Policy: + An Identity and Access Management (IAM) policy, which + specifies access controls for Google Cloud resources. A + ``Policy`` is a collection of ``bindings``. A + ``binding`` binds one or more ``members``, or + principals, to a single ``role``. Principals can be user + accounts, service accounts, Google groups, and domains + (such as G Suite). A ``role`` is a named list of + permissions; each ``role`` can be an IAM predefined role + or a user-created custom role. For some types of Google + Cloud resources, a ``binding`` can also specify a + ``condition``, which is a logical expression that allows + access to a resource only if the expression evaluates to + ``true``. A condition can add constraints based on + attributes of the request, the resource, or both. To + learn which resources support conditions in their IAM + policies, see the `IAM + documentation `__. + **JSON example:** { "bindings": [ { "role": + "roles/resourcemanager.organizationAdmin", "members": [ + "user:mike@example.com", "group:admins@example.com", + "domain:google.com", + "serviceAccount:my-project-id@appspot.gserviceaccount.com" + ] }, { "role": + "roles/resourcemanager.organizationViewer", "members": [ + "user:eve@example.com" ], "condition": { "title": + "expirable access", "description": "Does not grant + access after Sep 2020", "expression": "request.time < + timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": + "BwWWja0YfJA=", "version": 3 } **YAML example:** + bindings: - members: - user:mike@example.com - + group:admins@example.com - domain:google.com - + serviceAccount:my-project-id@appspot.gserviceaccount.com + role: roles/resourcemanager.organizationAdmin - members: + - user:eve@example.com role: + roles/resourcemanager.organizationViewer condition: + title: expirable access description: Does not grant + access after Sep 2020 expression: request.time < + timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= + version: 3 For a description of IAM and its features, + see the `IAM + documentation `__. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/compute/v1/projects/{project}/global/firewallPolicies/{resource}/getIamPolicy", + }, + ] + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) + request_kwargs = compute.GetIamPolicyNetworkFirewallPolicyRequest.to_dict( + request + ) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.GetIamPolicyNetworkFirewallPolicyRequest.to_json( + compute.GetIamPolicyNetworkFirewallPolicyRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.Policy.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_get_iam_policy(resp) + return resp + + class _GetRule(NetworkFirewallPoliciesRestStub): + def __hash__(self): + return hash("GetRule") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.GetRuleNetworkFirewallPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.FirewallPolicyRule: + r"""Call the get rule method over HTTP. + + Args: + request (~.compute.GetRuleNetworkFirewallPolicyRequest): + The request object. A request message for + NetworkFirewallPolicies.GetRule. See the + method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.FirewallPolicyRule: + Represents a rule that describes one + or more match conditions along with the + action to be taken when traffic matches + this condition (allow or deny). + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/compute/v1/projects/{project}/global/firewallPolicies/{firewall_policy}/getRule", + }, + ] + request, metadata = self._interceptor.pre_get_rule(request, metadata) + request_kwargs = compute.GetRuleNetworkFirewallPolicyRequest.to_dict( + request + ) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.GetRuleNetworkFirewallPolicyRequest.to_json( + compute.GetRuleNetworkFirewallPolicyRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.FirewallPolicyRule.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_get_rule(resp) + return resp + + class _Insert(NetworkFirewallPoliciesRestStub): + def __hash__(self): + return hash("Insert") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.InsertNetworkFirewallPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Call the insert method over HTTP. + + Args: + request (~.compute.InsertNetworkFirewallPolicyRequest): + The request object. A request message for + NetworkFirewallPolicies.Insert. See the + method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/compute/v1/projects/{project}/global/firewallPolicies", + "body": "firewall_policy_resource", + }, + ] + request, metadata = self._interceptor.pre_insert(request, metadata) + request_kwargs = compute.InsertNetworkFirewallPolicyRequest.to_dict(request) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + # Jsonify the request body + body = compute.FirewallPolicy.to_json( + compute.FirewallPolicy(transcoded_request["body"]), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.InsertNetworkFirewallPolicyRequest.to_json( + compute.InsertNetworkFirewallPolicyRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.Operation.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_insert(resp) + return resp + + class _List(NetworkFirewallPoliciesRestStub): + def __hash__(self): + return hash("List") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.ListNetworkFirewallPoliciesRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.FirewallPolicyList: + r"""Call the list method over HTTP. + + Args: + request (~.compute.ListNetworkFirewallPoliciesRequest): + The request object. A request message for + NetworkFirewallPolicies.List. See the + method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.FirewallPolicyList: + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/compute/v1/projects/{project}/global/firewallPolicies", + }, + ] + request, metadata = self._interceptor.pre_list(request, metadata) + request_kwargs = compute.ListNetworkFirewallPoliciesRequest.to_dict(request) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.ListNetworkFirewallPoliciesRequest.to_json( + compute.ListNetworkFirewallPoliciesRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.FirewallPolicyList.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_list(resp) + return resp + + class _Patch(NetworkFirewallPoliciesRestStub): + def __hash__(self): + return hash("Patch") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.PatchNetworkFirewallPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Call the patch method over HTTP. + + Args: + request (~.compute.PatchNetworkFirewallPolicyRequest): + The request object. A request message for + NetworkFirewallPolicies.Patch. See the + method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "patch", + "uri": "/compute/v1/projects/{project}/global/firewallPolicies/{firewall_policy}", + "body": "firewall_policy_resource", + }, + ] + request, metadata = self._interceptor.pre_patch(request, metadata) + request_kwargs = compute.PatchNetworkFirewallPolicyRequest.to_dict(request) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + # Jsonify the request body + body = compute.FirewallPolicy.to_json( + compute.FirewallPolicy(transcoded_request["body"]), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.PatchNetworkFirewallPolicyRequest.to_json( + compute.PatchNetworkFirewallPolicyRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.Operation.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_patch(resp) + return resp + + class _PatchRule(NetworkFirewallPoliciesRestStub): + def __hash__(self): + return hash("PatchRule") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.PatchRuleNetworkFirewallPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Call the patch rule method over HTTP. + + Args: + request (~.compute.PatchRuleNetworkFirewallPolicyRequest): + The request object. A request message for + NetworkFirewallPolicies.PatchRule. See + the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/compute/v1/projects/{project}/global/firewallPolicies/{firewall_policy}/patchRule", + "body": "firewall_policy_rule_resource", + }, + ] + request, metadata = self._interceptor.pre_patch_rule(request, metadata) + request_kwargs = compute.PatchRuleNetworkFirewallPolicyRequest.to_dict( + request + ) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + # Jsonify the request body + body = compute.FirewallPolicyRule.to_json( + compute.FirewallPolicyRule(transcoded_request["body"]), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.PatchRuleNetworkFirewallPolicyRequest.to_json( + compute.PatchRuleNetworkFirewallPolicyRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.Operation.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_patch_rule(resp) + return resp + + class _RemoveAssociation(NetworkFirewallPoliciesRestStub): + def __hash__(self): + return hash("RemoveAssociation") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.RemoveAssociationNetworkFirewallPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Call the remove association method over HTTP. + + Args: + request (~.compute.RemoveAssociationNetworkFirewallPolicyRequest): + The request object. A request message for + NetworkFirewallPolicies.RemoveAssociation. + See the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/compute/v1/projects/{project}/global/firewallPolicies/{firewall_policy}/removeAssociation", + }, + ] + request, metadata = self._interceptor.pre_remove_association( + request, metadata + ) + request_kwargs = ( + compute.RemoveAssociationNetworkFirewallPolicyRequest.to_dict(request) + ) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.RemoveAssociationNetworkFirewallPolicyRequest.to_json( + compute.RemoveAssociationNetworkFirewallPolicyRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.Operation.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_remove_association(resp) + return resp + + class _RemoveRule(NetworkFirewallPoliciesRestStub): + def __hash__(self): + return hash("RemoveRule") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.RemoveRuleNetworkFirewallPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Call the remove rule method over HTTP. + + Args: + request (~.compute.RemoveRuleNetworkFirewallPolicyRequest): + The request object. A request message for + NetworkFirewallPolicies.RemoveRule. See + the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/compute/v1/projects/{project}/global/firewallPolicies/{firewall_policy}/removeRule", + }, + ] + request, metadata = self._interceptor.pre_remove_rule(request, metadata) + request_kwargs = compute.RemoveRuleNetworkFirewallPolicyRequest.to_dict( + request + ) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.RemoveRuleNetworkFirewallPolicyRequest.to_json( + compute.RemoveRuleNetworkFirewallPolicyRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.Operation.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_remove_rule(resp) + return resp + + class _SetIamPolicy(NetworkFirewallPoliciesRestStub): + def __hash__(self): + return hash("SetIamPolicy") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.SetIamPolicyNetworkFirewallPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Policy: + r"""Call the set iam policy method over HTTP. + + Args: + request (~.compute.SetIamPolicyNetworkFirewallPolicyRequest): + The request object. A request message for + NetworkFirewallPolicies.SetIamPolicy. + See the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Policy: + An Identity and Access Management (IAM) policy, which + specifies access controls for Google Cloud resources. A + ``Policy`` is a collection of ``bindings``. A + ``binding`` binds one or more ``members``, or + principals, to a single ``role``. Principals can be user + accounts, service accounts, Google groups, and domains + (such as G Suite). A ``role`` is a named list of + permissions; each ``role`` can be an IAM predefined role + or a user-created custom role. For some types of Google + Cloud resources, a ``binding`` can also specify a + ``condition``, which is a logical expression that allows + access to a resource only if the expression evaluates to + ``true``. A condition can add constraints based on + attributes of the request, the resource, or both. To + learn which resources support conditions in their IAM + policies, see the `IAM + documentation `__. + **JSON example:** { "bindings": [ { "role": + "roles/resourcemanager.organizationAdmin", "members": [ + "user:mike@example.com", "group:admins@example.com", + "domain:google.com", + "serviceAccount:my-project-id@appspot.gserviceaccount.com" + ] }, { "role": + "roles/resourcemanager.organizationViewer", "members": [ + "user:eve@example.com" ], "condition": { "title": + "expirable access", "description": "Does not grant + access after Sep 2020", "expression": "request.time < + timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": + "BwWWja0YfJA=", "version": 3 } **YAML example:** + bindings: - members: - user:mike@example.com - + group:admins@example.com - domain:google.com - + serviceAccount:my-project-id@appspot.gserviceaccount.com + role: roles/resourcemanager.organizationAdmin - members: + - user:eve@example.com role: + roles/resourcemanager.organizationViewer condition: + title: expirable access description: Does not grant + access after Sep 2020 expression: request.time < + timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= + version: 3 For a description of IAM and its features, + see the `IAM + documentation `__. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/compute/v1/projects/{project}/global/firewallPolicies/{resource}/setIamPolicy", + "body": "global_set_policy_request_resource", + }, + ] + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) + request_kwargs = compute.SetIamPolicyNetworkFirewallPolicyRequest.to_dict( + request + ) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + # Jsonify the request body + body = compute.GlobalSetPolicyRequest.to_json( + compute.GlobalSetPolicyRequest(transcoded_request["body"]), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.SetIamPolicyNetworkFirewallPolicyRequest.to_json( + compute.SetIamPolicyNetworkFirewallPolicyRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.Policy.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_set_iam_policy(resp) + return resp + + class _TestIamPermissions(NetworkFirewallPoliciesRestStub): + def __hash__(self): + return hash("TestIamPermissions") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.TestIamPermissionsNetworkFirewallPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.TestPermissionsResponse: + r"""Call the test iam permissions method over HTTP. + + Args: + request (~.compute.TestIamPermissionsNetworkFirewallPolicyRequest): + The request object. A request message for + NetworkFirewallPolicies.TestIamPermissions. + See the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.TestPermissionsResponse: + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/compute/v1/projects/{project}/global/firewallPolicies/{resource}/testIamPermissions", + "body": "test_permissions_request_resource", + }, + ] + request, metadata = self._interceptor.pre_test_iam_permissions( + request, metadata + ) + request_kwargs = ( + compute.TestIamPermissionsNetworkFirewallPolicyRequest.to_dict(request) + ) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + # Jsonify the request body + body = compute.TestPermissionsRequest.to_json( + compute.TestPermissionsRequest(transcoded_request["body"]), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.TestIamPermissionsNetworkFirewallPolicyRequest.to_json( + compute.TestIamPermissionsNetworkFirewallPolicyRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.TestPermissionsResponse.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_test_iam_permissions(resp) + return resp + + @property + def add_association( + self, + ) -> Callable[ + [compute.AddAssociationNetworkFirewallPolicyRequest], compute.Operation + ]: + stub = self._STUBS.get("add_association") + if not stub: + stub = self._STUBS["add_association"] = self._AddAssociation( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def add_rule( + self, + ) -> Callable[[compute.AddRuleNetworkFirewallPolicyRequest], compute.Operation]: + stub = self._STUBS.get("add_rule") + if not stub: + stub = self._STUBS["add_rule"] = self._AddRule( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def clone_rules( + self, + ) -> Callable[[compute.CloneRulesNetworkFirewallPolicyRequest], compute.Operation]: + stub = self._STUBS.get("clone_rules") + if not stub: + stub = self._STUBS["clone_rules"] = self._CloneRules( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def delete( + self, + ) -> Callable[[compute.DeleteNetworkFirewallPolicyRequest], compute.Operation]: + stub = self._STUBS.get("delete") + if not stub: + stub = self._STUBS["delete"] = self._Delete( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def get( + self, + ) -> Callable[[compute.GetNetworkFirewallPolicyRequest], compute.FirewallPolicy]: + stub = self._STUBS.get("get") + if not stub: + stub = self._STUBS["get"] = self._Get( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def get_association( + self, + ) -> Callable[ + [compute.GetAssociationNetworkFirewallPolicyRequest], + compute.FirewallPolicyAssociation, + ]: + stub = self._STUBS.get("get_association") + if not stub: + stub = self._STUBS["get_association"] = self._GetAssociation( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def get_iam_policy( + self, + ) -> Callable[[compute.GetIamPolicyNetworkFirewallPolicyRequest], compute.Policy]: + stub = self._STUBS.get("get_iam_policy") + if not stub: + stub = self._STUBS["get_iam_policy"] = self._GetIamPolicy( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def get_rule( + self, + ) -> Callable[ + [compute.GetRuleNetworkFirewallPolicyRequest], compute.FirewallPolicyRule + ]: + stub = self._STUBS.get("get_rule") + if not stub: + stub = self._STUBS["get_rule"] = self._GetRule( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def insert( + self, + ) -> Callable[[compute.InsertNetworkFirewallPolicyRequest], compute.Operation]: + stub = self._STUBS.get("insert") + if not stub: + stub = self._STUBS["insert"] = self._Insert( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def list( + self, + ) -> Callable[ + [compute.ListNetworkFirewallPoliciesRequest], compute.FirewallPolicyList + ]: + stub = self._STUBS.get("list") + if not stub: + stub = self._STUBS["list"] = self._List( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def patch( + self, + ) -> Callable[[compute.PatchNetworkFirewallPolicyRequest], compute.Operation]: + stub = self._STUBS.get("patch") + if not stub: + stub = self._STUBS["patch"] = self._Patch( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def patch_rule( + self, + ) -> Callable[[compute.PatchRuleNetworkFirewallPolicyRequest], compute.Operation]: + stub = self._STUBS.get("patch_rule") + if not stub: + stub = self._STUBS["patch_rule"] = self._PatchRule( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def remove_association( + self, + ) -> Callable[ + [compute.RemoveAssociationNetworkFirewallPolicyRequest], compute.Operation + ]: + stub = self._STUBS.get("remove_association") + if not stub: + stub = self._STUBS["remove_association"] = self._RemoveAssociation( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def remove_rule( + self, + ) -> Callable[[compute.RemoveRuleNetworkFirewallPolicyRequest], compute.Operation]: + stub = self._STUBS.get("remove_rule") + if not stub: + stub = self._STUBS["remove_rule"] = self._RemoveRule( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def set_iam_policy( + self, + ) -> Callable[[compute.SetIamPolicyNetworkFirewallPolicyRequest], compute.Policy]: + stub = self._STUBS.get("set_iam_policy") + if not stub: + stub = self._STUBS["set_iam_policy"] = self._SetIamPolicy( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def test_iam_permissions( + self, + ) -> Callable[ + [compute.TestIamPermissionsNetworkFirewallPolicyRequest], + compute.TestPermissionsResponse, + ]: + stub = self._STUBS.get("test_iam_permissions") + if not stub: + stub = self._STUBS["test_iam_permissions"] = self._TestIamPermissions( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + def close(self): + self._session.close() + + +__all__ = ("NetworkFirewallPoliciesRestTransport",) diff --git a/google/cloud/compute_v1/services/region_network_firewall_policies/__init__.py b/google/cloud/compute_v1/services/region_network_firewall_policies/__init__.py new file mode 100644 index 000000000..18d17b0a0 --- /dev/null +++ b/google/cloud/compute_v1/services/region_network_firewall_policies/__init__.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +from .client import RegionNetworkFirewallPoliciesClient + +__all__ = ("RegionNetworkFirewallPoliciesClient",) diff --git a/google/cloud/compute_v1/services/region_network_firewall_policies/client.py b/google/cloud/compute_v1/services/region_network_firewall_policies/client.py new file mode 100644 index 000000000..479d617e1 --- /dev/null +++ b/google/cloud/compute_v1/services/region_network_firewall_policies/client.py @@ -0,0 +1,2246 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +from collections import OrderedDict +import os +import re +from typing import Dict, Optional, Sequence, Tuple, Type, Union +import pkg_resources + +from google.api_core import client_options as client_options_lib +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries +from google.auth import credentials as ga_credentials # type: ignore +from google.auth.transport import mtls # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore +from google.oauth2 import service_account # type: ignore + +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore + +from google.cloud.compute_v1.services.region_network_firewall_policies import pagers +from google.cloud.compute_v1.types import compute +from .transports.base import RegionNetworkFirewallPoliciesTransport, DEFAULT_CLIENT_INFO +from .transports.rest import RegionNetworkFirewallPoliciesRestTransport + + +class RegionNetworkFirewallPoliciesClientMeta(type): + """Metaclass for the RegionNetworkFirewallPolicies client. + + This provides class-level methods for building and retrieving + support objects (e.g. transport) without polluting the client instance + objects. + """ + + _transport_registry = ( + OrderedDict() + ) # type: Dict[str, Type[RegionNetworkFirewallPoliciesTransport]] + _transport_registry["rest"] = RegionNetworkFirewallPoliciesRestTransport + + def get_transport_class( + cls, + label: str = None, + ) -> Type[RegionNetworkFirewallPoliciesTransport]: + """Returns an appropriate transport class. + + Args: + label: The name of the desired transport. If none is + provided, then the first transport in the registry is used. + + Returns: + The transport class to use. + """ + # If a specific transport is requested, return that one. + if label: + return cls._transport_registry[label] + + # No transport is requested; return the default (that is, the first one + # in the dictionary). + return next(iter(cls._transport_registry.values())) + + +class RegionNetworkFirewallPoliciesClient( + metaclass=RegionNetworkFirewallPoliciesClientMeta +): + """The RegionNetworkFirewallPolicies API.""" + + @staticmethod + def _get_default_mtls_endpoint(api_endpoint): + """Converts api endpoint to mTLS endpoint. + + Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to + "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. + Args: + api_endpoint (Optional[str]): the api endpoint to convert. + Returns: + str: converted mTLS api endpoint. + """ + if not api_endpoint: + return api_endpoint + + mtls_endpoint_re = re.compile( + r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" + ) + + m = mtls_endpoint_re.match(api_endpoint) + name, mtls, sandbox, googledomain = m.groups() + if mtls or not googledomain: + return api_endpoint + + if sandbox: + return api_endpoint.replace( + "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" + ) + + return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") + + DEFAULT_ENDPOINT = "compute.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials + info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + RegionNetworkFirewallPoliciesClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + RegionNetworkFirewallPoliciesClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file(filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + @property + def transport(self) -> RegionNetworkFirewallPoliciesTransport: + """Returns the transport used by the client instance. + + Returns: + RegionNetworkFirewallPoliciesTransport: The transport used by the client + instance. + """ + return self._transport + + @staticmethod + def common_billing_account_path( + billing_account: str, + ) -> str: + """Returns a fully-qualified billing_account string.""" + return "billingAccounts/{billing_account}".format( + billing_account=billing_account, + ) + + @staticmethod + def parse_common_billing_account_path(path: str) -> Dict[str, str]: + """Parse a billing_account path into its component segments.""" + m = re.match(r"^billingAccounts/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_folder_path( + folder: str, + ) -> str: + """Returns a fully-qualified folder string.""" + return "folders/{folder}".format( + folder=folder, + ) + + @staticmethod + def parse_common_folder_path(path: str) -> Dict[str, str]: + """Parse a folder path into its component segments.""" + m = re.match(r"^folders/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_organization_path( + organization: str, + ) -> str: + """Returns a fully-qualified organization string.""" + return "organizations/{organization}".format( + organization=organization, + ) + + @staticmethod + def parse_common_organization_path(path: str) -> Dict[str, str]: + """Parse a organization path into its component segments.""" + m = re.match(r"^organizations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_project_path( + project: str, + ) -> str: + """Returns a fully-qualified project string.""" + return "projects/{project}".format( + project=project, + ) + + @staticmethod + def parse_common_project_path(path: str) -> Dict[str, str]: + """Parse a project path into its component segments.""" + m = re.match(r"^projects/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_location_path( + project: str, + location: str, + ) -> str: + """Returns a fully-qualified location string.""" + return "projects/{project}/locations/{location}".format( + project=project, + location=location, + ) + + @staticmethod + def parse_common_location_path(path: str) -> Dict[str, str]: + """Parse a location path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @classmethod + def get_mtls_endpoint_and_cert_source( + cls, client_options: Optional[client_options_lib.ClientOptions] = None + ): + """Return the API endpoint and client cert source for mutual TLS. + + The client cert source is determined in the following order: + (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the + client cert source is None. + (2) if `client_options.client_cert_source` is provided, use the provided one; if the + default client cert source exists, use the default one; otherwise the client cert + source is None. + + The API endpoint is determined in the following order: + (1) if `client_options.api_endpoint` if provided, use the provided one. + (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the + default mTLS endpoint; if the environment variabel is "never", use the default API + endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise + use the default API endpoint. + + More details can be found at https://google.aip.dev/auth/4114. + + Args: + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. Only the `api_endpoint` and `client_cert_source` properties may be used + in this method. + + Returns: + Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the + client cert source to use. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If any errors happen. + """ + if client_options is None: + client_options = client_options_lib.ClientOptions() + use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") + use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") + if use_client_cert not in ("true", "false"): + raise ValueError( + "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + ) + if use_mtls_endpoint not in ("auto", "never", "always"): + raise MutualTLSChannelError( + "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" + ) + + # Figure out the client cert source to use. + client_cert_source = None + if use_client_cert == "true": + if client_options.client_cert_source: + client_cert_source = client_options.client_cert_source + elif mtls.has_default_client_cert_source(): + client_cert_source = mtls.default_client_cert_source() + + # Figure out which api endpoint to use. + if client_options.api_endpoint is not None: + api_endpoint = client_options.api_endpoint + elif use_mtls_endpoint == "always" or ( + use_mtls_endpoint == "auto" and client_cert_source + ): + api_endpoint = cls.DEFAULT_MTLS_ENDPOINT + else: + api_endpoint = cls.DEFAULT_ENDPOINT + + return api_endpoint, client_cert_source + + def __init__( + self, + *, + credentials: Optional[ga_credentials.Credentials] = None, + transport: Union[str, RegionNetworkFirewallPoliciesTransport, None] = None, + client_options: Optional[client_options_lib.ClientOptions] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiates the region network firewall policies client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, RegionNetworkFirewallPoliciesTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. It won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + """ + if isinstance(client_options, dict): + client_options = client_options_lib.from_dict(client_options) + if client_options is None: + client_options = client_options_lib.ClientOptions() + + api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( + client_options + ) + + api_key_value = getattr(client_options, "api_key", None) + if api_key_value and credentials: + raise ValueError( + "client_options.api_key and credentials are mutually exclusive" + ) + + # Save or instantiate the transport. + # Ordinarily, we provide the transport, but allowing a custom transport + # instance provides an extensibility point for unusual situations. + if isinstance(transport, RegionNetworkFirewallPoliciesTransport): + # transport is a RegionNetworkFirewallPoliciesTransport instance. + if credentials or client_options.credentials_file or api_key_value: + raise ValueError( + "When providing a transport instance, " + "provide its credentials directly." + ) + if client_options.scopes: + raise ValueError( + "When providing a transport instance, provide its scopes " + "directly." + ) + self._transport = transport + else: + import google.auth._default # type: ignore + + if api_key_value and hasattr( + google.auth._default, "get_api_key_credentials" + ): + credentials = google.auth._default.get_api_key_credentials( + api_key_value + ) + + Transport = type(self).get_transport_class(transport) + self._transport = Transport( + credentials=credentials, + credentials_file=client_options.credentials_file, + host=api_endpoint, + scopes=client_options.scopes, + client_cert_source_for_mtls=client_cert_source_func, + quota_project_id=client_options.quota_project_id, + client_info=client_info, + always_use_jwt_access=True, + ) + + def add_association_unary( + self, + request: Union[ + compute.AddAssociationRegionNetworkFirewallPolicyRequest, dict + ] = None, + *, + project: str = None, + region: str = None, + firewall_policy: str = None, + firewall_policy_association_resource: compute.FirewallPolicyAssociation = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Inserts an association for the specified network + firewall policy. + + Args: + request (Union[google.cloud.compute_v1.types.AddAssociationRegionNetworkFirewallPolicyRequest, dict]): + The request object. A request message for + RegionNetworkFirewallPolicies.AddAssociation. See the + method description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + region (str): + Name of the region scoping this + request. + + This corresponds to the ``region`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + firewall_policy (str): + Name of the firewall policy to + update. + + This corresponds to the ``firewall_policy`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + firewall_policy_association_resource (google.cloud.compute_v1.types.FirewallPolicyAssociation): + The body resource for this request + This corresponds to the ``firewall_policy_association_resource`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + [Global](/compute/docs/reference/rest/v1/globalOperations) + \* + [Regional](/compute/docs/reference/rest/v1/regionOperations) + \* + [Zonal](/compute/docs/reference/rest/v1/zoneOperations) + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the globalOperations + resource. - For regional operations, use the + regionOperations resource. - For zonal operations, use + the zonalOperations resource. For more information, read + Global, Regional, and Zonal Resources. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any( + [project, region, firewall_policy, firewall_policy_association_resource] + ) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.AddAssociationRegionNetworkFirewallPolicyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance( + request, compute.AddAssociationRegionNetworkFirewallPolicyRequest + ): + request = compute.AddAssociationRegionNetworkFirewallPolicyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if region is not None: + request.region = region + if firewall_policy is not None: + request.firewall_policy = firewall_policy + if firewall_policy_association_resource is not None: + request.firewall_policy_association_resource = ( + firewall_policy_association_resource + ) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.add_association] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def add_rule_unary( + self, + request: Union[compute.AddRuleRegionNetworkFirewallPolicyRequest, dict] = None, + *, + project: str = None, + region: str = None, + firewall_policy: str = None, + firewall_policy_rule_resource: compute.FirewallPolicyRule = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Inserts a rule into a network firewall policy. + + Args: + request (Union[google.cloud.compute_v1.types.AddRuleRegionNetworkFirewallPolicyRequest, dict]): + The request object. A request message for + RegionNetworkFirewallPolicies.AddRule. See the method + description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + region (str): + Name of the region scoping this + request. + + This corresponds to the ``region`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + firewall_policy (str): + Name of the firewall policy to + update. + + This corresponds to the ``firewall_policy`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + firewall_policy_rule_resource (google.cloud.compute_v1.types.FirewallPolicyRule): + The body resource for this request + This corresponds to the ``firewall_policy_rule_resource`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + [Global](/compute/docs/reference/rest/v1/globalOperations) + \* + [Regional](/compute/docs/reference/rest/v1/regionOperations) + \* + [Zonal](/compute/docs/reference/rest/v1/zoneOperations) + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the globalOperations + resource. - For regional operations, use the + regionOperations resource. - For zonal operations, use + the zonalOperations resource. For more information, read + Global, Regional, and Zonal Resources. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any( + [project, region, firewall_policy, firewall_policy_rule_resource] + ) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.AddRuleRegionNetworkFirewallPolicyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, compute.AddRuleRegionNetworkFirewallPolicyRequest): + request = compute.AddRuleRegionNetworkFirewallPolicyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if region is not None: + request.region = region + if firewall_policy is not None: + request.firewall_policy = firewall_policy + if firewall_policy_rule_resource is not None: + request.firewall_policy_rule_resource = firewall_policy_rule_resource + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.add_rule] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def clone_rules_unary( + self, + request: Union[ + compute.CloneRulesRegionNetworkFirewallPolicyRequest, dict + ] = None, + *, + project: str = None, + region: str = None, + firewall_policy: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Copies rules to the specified network firewall + policy. + + Args: + request (Union[google.cloud.compute_v1.types.CloneRulesRegionNetworkFirewallPolicyRequest, dict]): + The request object. A request message for + RegionNetworkFirewallPolicies.CloneRules. See the method + description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + region (str): + Name of the region scoping this + request. + + This corresponds to the ``region`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + firewall_policy (str): + Name of the firewall policy to + update. + + This corresponds to the ``firewall_policy`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + [Global](/compute/docs/reference/rest/v1/globalOperations) + \* + [Regional](/compute/docs/reference/rest/v1/regionOperations) + \* + [Zonal](/compute/docs/reference/rest/v1/zoneOperations) + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the globalOperations + resource. - For regional operations, use the + regionOperations resource. - For zonal operations, use + the zonalOperations resource. For more information, read + Global, Regional, and Zonal Resources. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([project, region, firewall_policy]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.CloneRulesRegionNetworkFirewallPolicyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance( + request, compute.CloneRulesRegionNetworkFirewallPolicyRequest + ): + request = compute.CloneRulesRegionNetworkFirewallPolicyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if region is not None: + request.region = region + if firewall_policy is not None: + request.firewall_policy = firewall_policy + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.clone_rules] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def delete_unary( + self, + request: Union[compute.DeleteRegionNetworkFirewallPolicyRequest, dict] = None, + *, + project: str = None, + region: str = None, + firewall_policy: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Deletes the specified network firewall policy. + + Args: + request (Union[google.cloud.compute_v1.types.DeleteRegionNetworkFirewallPolicyRequest, dict]): + The request object. A request message for + RegionNetworkFirewallPolicies.Delete. See the method + description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + region (str): + Name of the region scoping this + request. + + This corresponds to the ``region`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + firewall_policy (str): + Name of the firewall policy to + delete. + + This corresponds to the ``firewall_policy`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + [Global](/compute/docs/reference/rest/v1/globalOperations) + \* + [Regional](/compute/docs/reference/rest/v1/regionOperations) + \* + [Zonal](/compute/docs/reference/rest/v1/zoneOperations) + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the globalOperations + resource. - For regional operations, use the + regionOperations resource. - For zonal operations, use + the zonalOperations resource. For more information, read + Global, Regional, and Zonal Resources. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([project, region, firewall_policy]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.DeleteRegionNetworkFirewallPolicyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, compute.DeleteRegionNetworkFirewallPolicyRequest): + request = compute.DeleteRegionNetworkFirewallPolicyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if region is not None: + request.region = region + if firewall_policy is not None: + request.firewall_policy = firewall_policy + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get( + self, + request: Union[compute.GetRegionNetworkFirewallPolicyRequest, dict] = None, + *, + project: str = None, + region: str = None, + firewall_policy: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.FirewallPolicy: + r"""Returns the specified network firewall policy. + + Args: + request (Union[google.cloud.compute_v1.types.GetRegionNetworkFirewallPolicyRequest, dict]): + The request object. A request message for + RegionNetworkFirewallPolicies.Get. See the method + description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + region (str): + Name of the region scoping this + request. + + This corresponds to the ``region`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + firewall_policy (str): + Name of the firewall policy to get. + This corresponds to the ``firewall_policy`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.FirewallPolicy: + Represents a Firewall Policy + resource. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([project, region, firewall_policy]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.GetRegionNetworkFirewallPolicyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, compute.GetRegionNetworkFirewallPolicyRequest): + request = compute.GetRegionNetworkFirewallPolicyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if region is not None: + request.region = region + if firewall_policy is not None: + request.firewall_policy = firewall_policy + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_association( + self, + request: Union[ + compute.GetAssociationRegionNetworkFirewallPolicyRequest, dict + ] = None, + *, + project: str = None, + region: str = None, + firewall_policy: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.FirewallPolicyAssociation: + r"""Gets an association with the specified name. + + Args: + request (Union[google.cloud.compute_v1.types.GetAssociationRegionNetworkFirewallPolicyRequest, dict]): + The request object. A request message for + RegionNetworkFirewallPolicies.GetAssociation. See the + method description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + region (str): + Name of the region scoping this + request. + + This corresponds to the ``region`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + firewall_policy (str): + Name of the firewall policy to which + the queried association belongs. + + This corresponds to the ``firewall_policy`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.FirewallPolicyAssociation: + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([project, region, firewall_policy]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.GetAssociationRegionNetworkFirewallPolicyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance( + request, compute.GetAssociationRegionNetworkFirewallPolicyRequest + ): + request = compute.GetAssociationRegionNetworkFirewallPolicyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if region is not None: + request.region = region + if firewall_policy is not None: + request.firewall_policy = firewall_policy + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_association] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_effective_firewalls( + self, + request: Union[ + compute.GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest, dict + ] = None, + *, + project: str = None, + region: str = None, + network: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse: + r"""Returns the effective firewalls on a given network. + + Args: + request (Union[google.cloud.compute_v1.types.GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest, dict]): + The request object. A request message for + RegionNetworkFirewallPolicies.GetEffectiveFirewalls. See + the method description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + region (str): + Name of the region scoping this + request. + + This corresponds to the ``region`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + network (str): + Network reference + This corresponds to the ``network`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse: + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([project, region, network]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance( + request, compute.GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest + ): + request = compute.GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest( + request + ) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if region is not None: + request.region = region + if network is not None: + request.network = network + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_effective_firewalls] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_iam_policy( + self, + request: Union[ + compute.GetIamPolicyRegionNetworkFirewallPolicyRequest, dict + ] = None, + *, + project: str = None, + region: str = None, + resource: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Policy: + r"""Gets the access control policy for a resource. May be + empty if no such policy or resource exists. + + Args: + request (Union[google.cloud.compute_v1.types.GetIamPolicyRegionNetworkFirewallPolicyRequest, dict]): + The request object. A request message for + RegionNetworkFirewallPolicies.GetIamPolicy. See the + method description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + region (str): + The name of the region for this + request. + + This corresponds to the ``region`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + resource (str): + Name or id of the resource for this + request. + + This corresponds to the ``resource`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.Policy: + An Identity and Access Management (IAM) policy, which + specifies access controls for Google Cloud resources. A + Policy is a collection of bindings. A binding binds one + or more members, or principals, to a single role. + Principals can be user accounts, service accounts, + Google groups, and domains (such as G Suite). A role is + a named list of permissions; each role can be an IAM + predefined role or a user-created custom role. For some + types of Google Cloud resources, a binding can also + specify a condition, which is a logical expression that + allows access to a resource only if the expression + evaluates to true. A condition can add constraints based + on attributes of the request, the resource, or both. To + learn which resources support conditions in their IAM + policies, see the [IAM + documentation](\ https://cloud.google.com/iam/help/conditions/resource-policies). + **JSON example:** { "bindings": [ { "role": + "roles/resourcemanager.organizationAdmin", "members": [ + "user:mike@example.com", "group:admins@example.com", + "domain:google.com", + "serviceAccount:my-project-id@appspot.gserviceaccount.com" + ] }, { "role": + "roles/resourcemanager.organizationViewer", "members": [ + "user:eve@example.com" ], "condition": { "title": + "expirable access", "description": "Does not grant + access after Sep 2020", "expression": "request.time < + timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": + "BwWWja0YfJA=", "version": 3 } **YAML example:** + bindings: - members: - user:\ mike@example.com - + group:\ admins@example.com - domain:google.com - + serviceAccount:\ my-project-id@appspot.gserviceaccount.com + role: roles/resourcemanager.organizationAdmin - members: + - user:\ eve@example.com role: + roles/resourcemanager.organizationViewer condition: + title: expirable access description: Does not grant + access after Sep 2020 expression: request.time < + timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= + version: 3 For a description of IAM and its features, + see the [IAM + documentation](\ https://cloud.google.com/iam/docs/). + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([project, region, resource]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.GetIamPolicyRegionNetworkFirewallPolicyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance( + request, compute.GetIamPolicyRegionNetworkFirewallPolicyRequest + ): + request = compute.GetIamPolicyRegionNetworkFirewallPolicyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if region is not None: + request.region = region + if resource is not None: + request.resource = resource + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_iam_policy] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_rule( + self, + request: Union[compute.GetRuleRegionNetworkFirewallPolicyRequest, dict] = None, + *, + project: str = None, + region: str = None, + firewall_policy: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.FirewallPolicyRule: + r"""Gets a rule of the specified priority. + + Args: + request (Union[google.cloud.compute_v1.types.GetRuleRegionNetworkFirewallPolicyRequest, dict]): + The request object. A request message for + RegionNetworkFirewallPolicies.GetRule. See the method + description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + region (str): + Name of the region scoping this + request. + + This corresponds to the ``region`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + firewall_policy (str): + Name of the firewall policy to which + the queried rule belongs. + + This corresponds to the ``firewall_policy`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.FirewallPolicyRule: + Represents a rule that describes one + or more match conditions along with the + action to be taken when traffic matches + this condition (allow or deny). + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([project, region, firewall_policy]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.GetRuleRegionNetworkFirewallPolicyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, compute.GetRuleRegionNetworkFirewallPolicyRequest): + request = compute.GetRuleRegionNetworkFirewallPolicyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if region is not None: + request.region = region + if firewall_policy is not None: + request.firewall_policy = firewall_policy + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_rule] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def insert_unary( + self, + request: Union[compute.InsertRegionNetworkFirewallPolicyRequest, dict] = None, + *, + project: str = None, + region: str = None, + firewall_policy_resource: compute.FirewallPolicy = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Creates a new network firewall policy in the + specified project and region. + + Args: + request (Union[google.cloud.compute_v1.types.InsertRegionNetworkFirewallPolicyRequest, dict]): + The request object. A request message for + RegionNetworkFirewallPolicies.Insert. See the method + description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + region (str): + Name of the region scoping this + request. + + This corresponds to the ``region`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + firewall_policy_resource (google.cloud.compute_v1.types.FirewallPolicy): + The body resource for this request + This corresponds to the ``firewall_policy_resource`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + [Global](/compute/docs/reference/rest/v1/globalOperations) + \* + [Regional](/compute/docs/reference/rest/v1/regionOperations) + \* + [Zonal](/compute/docs/reference/rest/v1/zoneOperations) + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the globalOperations + resource. - For regional operations, use the + regionOperations resource. - For zonal operations, use + the zonalOperations resource. For more information, read + Global, Regional, and Zonal Resources. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([project, region, firewall_policy_resource]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.InsertRegionNetworkFirewallPolicyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, compute.InsertRegionNetworkFirewallPolicyRequest): + request = compute.InsertRegionNetworkFirewallPolicyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if region is not None: + request.region = region + if firewall_policy_resource is not None: + request.firewall_policy_resource = firewall_policy_resource + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.insert] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list( + self, + request: Union[compute.ListRegionNetworkFirewallPoliciesRequest, dict] = None, + *, + project: str = None, + region: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListPager: + r"""Lists all the network firewall policies that have + been configured for the specified project in the given + region. + + Args: + request (Union[google.cloud.compute_v1.types.ListRegionNetworkFirewallPoliciesRequest, dict]): + The request object. A request message for + RegionNetworkFirewallPolicies.List. See the method + description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + region (str): + Name of the region scoping this + request. + + This corresponds to the ``region`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.services.region_network_firewall_policies.pagers.ListPager: + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([project, region]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.ListRegionNetworkFirewallPoliciesRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, compute.ListRegionNetworkFirewallPoliciesRequest): + request = compute.ListRegionNetworkFirewallPoliciesRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if region is not None: + request.region = region + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def patch_unary( + self, + request: Union[compute.PatchRegionNetworkFirewallPolicyRequest, dict] = None, + *, + project: str = None, + region: str = None, + firewall_policy: str = None, + firewall_policy_resource: compute.FirewallPolicy = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Patches the specified network firewall policy. + + Args: + request (Union[google.cloud.compute_v1.types.PatchRegionNetworkFirewallPolicyRequest, dict]): + The request object. A request message for + RegionNetworkFirewallPolicies.Patch. See the method + description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + region (str): + Name of the region scoping this + request. + + This corresponds to the ``region`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + firewall_policy (str): + Name of the firewall policy to + update. + + This corresponds to the ``firewall_policy`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + firewall_policy_resource (google.cloud.compute_v1.types.FirewallPolicy): + The body resource for this request + This corresponds to the ``firewall_policy_resource`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + [Global](/compute/docs/reference/rest/v1/globalOperations) + \* + [Regional](/compute/docs/reference/rest/v1/regionOperations) + \* + [Zonal](/compute/docs/reference/rest/v1/zoneOperations) + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the globalOperations + resource. - For regional operations, use the + regionOperations resource. - For zonal operations, use + the zonalOperations resource. For more information, read + Global, Regional, and Zonal Resources. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any( + [project, region, firewall_policy, firewall_policy_resource] + ) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.PatchRegionNetworkFirewallPolicyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, compute.PatchRegionNetworkFirewallPolicyRequest): + request = compute.PatchRegionNetworkFirewallPolicyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if region is not None: + request.region = region + if firewall_policy is not None: + request.firewall_policy = firewall_policy + if firewall_policy_resource is not None: + request.firewall_policy_resource = firewall_policy_resource + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.patch] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def patch_rule_unary( + self, + request: Union[ + compute.PatchRuleRegionNetworkFirewallPolicyRequest, dict + ] = None, + *, + project: str = None, + region: str = None, + firewall_policy: str = None, + firewall_policy_rule_resource: compute.FirewallPolicyRule = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Patches a rule of the specified priority. + + Args: + request (Union[google.cloud.compute_v1.types.PatchRuleRegionNetworkFirewallPolicyRequest, dict]): + The request object. A request message for + RegionNetworkFirewallPolicies.PatchRule. See the method + description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + region (str): + Name of the region scoping this + request. + + This corresponds to the ``region`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + firewall_policy (str): + Name of the firewall policy to + update. + + This corresponds to the ``firewall_policy`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + firewall_policy_rule_resource (google.cloud.compute_v1.types.FirewallPolicyRule): + The body resource for this request + This corresponds to the ``firewall_policy_rule_resource`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + [Global](/compute/docs/reference/rest/v1/globalOperations) + \* + [Regional](/compute/docs/reference/rest/v1/regionOperations) + \* + [Zonal](/compute/docs/reference/rest/v1/zoneOperations) + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the globalOperations + resource. - For regional operations, use the + regionOperations resource. - For zonal operations, use + the zonalOperations resource. For more information, read + Global, Regional, and Zonal Resources. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any( + [project, region, firewall_policy, firewall_policy_rule_resource] + ) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.PatchRuleRegionNetworkFirewallPolicyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, compute.PatchRuleRegionNetworkFirewallPolicyRequest): + request = compute.PatchRuleRegionNetworkFirewallPolicyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if region is not None: + request.region = region + if firewall_policy is not None: + request.firewall_policy = firewall_policy + if firewall_policy_rule_resource is not None: + request.firewall_policy_rule_resource = firewall_policy_rule_resource + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.patch_rule] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def remove_association_unary( + self, + request: Union[ + compute.RemoveAssociationRegionNetworkFirewallPolicyRequest, dict + ] = None, + *, + project: str = None, + region: str = None, + firewall_policy: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Removes an association for the specified network + firewall policy. + + Args: + request (Union[google.cloud.compute_v1.types.RemoveAssociationRegionNetworkFirewallPolicyRequest, dict]): + The request object. A request message for + RegionNetworkFirewallPolicies.RemoveAssociation. See the + method description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + region (str): + Name of the region scoping this + request. + + This corresponds to the ``region`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + firewall_policy (str): + Name of the firewall policy to + update. + + This corresponds to the ``firewall_policy`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + [Global](/compute/docs/reference/rest/v1/globalOperations) + \* + [Regional](/compute/docs/reference/rest/v1/regionOperations) + \* + [Zonal](/compute/docs/reference/rest/v1/zoneOperations) + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the globalOperations + resource. - For regional operations, use the + regionOperations resource. - For zonal operations, use + the zonalOperations resource. For more information, read + Global, Regional, and Zonal Resources. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([project, region, firewall_policy]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.RemoveAssociationRegionNetworkFirewallPolicyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance( + request, compute.RemoveAssociationRegionNetworkFirewallPolicyRequest + ): + request = compute.RemoveAssociationRegionNetworkFirewallPolicyRequest( + request + ) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if region is not None: + request.region = region + if firewall_policy is not None: + request.firewall_policy = firewall_policy + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.remove_association] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def remove_rule_unary( + self, + request: Union[ + compute.RemoveRuleRegionNetworkFirewallPolicyRequest, dict + ] = None, + *, + project: str = None, + region: str = None, + firewall_policy: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Deletes a rule of the specified priority. + + Args: + request (Union[google.cloud.compute_v1.types.RemoveRuleRegionNetworkFirewallPolicyRequest, dict]): + The request object. A request message for + RegionNetworkFirewallPolicies.RemoveRule. See the method + description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + region (str): + Name of the region scoping this + request. + + This corresponds to the ``region`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + firewall_policy (str): + Name of the firewall policy to + update. + + This corresponds to the ``firewall_policy`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + [Global](/compute/docs/reference/rest/v1/globalOperations) + \* + [Regional](/compute/docs/reference/rest/v1/regionOperations) + \* + [Zonal](/compute/docs/reference/rest/v1/zoneOperations) + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the globalOperations + resource. - For regional operations, use the + regionOperations resource. - For zonal operations, use + the zonalOperations resource. For more information, read + Global, Regional, and Zonal Resources. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([project, region, firewall_policy]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.RemoveRuleRegionNetworkFirewallPolicyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance( + request, compute.RemoveRuleRegionNetworkFirewallPolicyRequest + ): + request = compute.RemoveRuleRegionNetworkFirewallPolicyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if region is not None: + request.region = region + if firewall_policy is not None: + request.firewall_policy = firewall_policy + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.remove_rule] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def set_iam_policy( + self, + request: Union[ + compute.SetIamPolicyRegionNetworkFirewallPolicyRequest, dict + ] = None, + *, + project: str = None, + region: str = None, + resource: str = None, + region_set_policy_request_resource: compute.RegionSetPolicyRequest = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Policy: + r"""Sets the access control policy on the specified + resource. Replaces any existing policy. + + Args: + request (Union[google.cloud.compute_v1.types.SetIamPolicyRegionNetworkFirewallPolicyRequest, dict]): + The request object. A request message for + RegionNetworkFirewallPolicies.SetIamPolicy. See the + method description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + region (str): + The name of the region for this + request. + + This corresponds to the ``region`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + resource (str): + Name or id of the resource for this + request. + + This corresponds to the ``resource`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + region_set_policy_request_resource (google.cloud.compute_v1.types.RegionSetPolicyRequest): + The body resource for this request + This corresponds to the ``region_set_policy_request_resource`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.Policy: + An Identity and Access Management (IAM) policy, which + specifies access controls for Google Cloud resources. A + Policy is a collection of bindings. A binding binds one + or more members, or principals, to a single role. + Principals can be user accounts, service accounts, + Google groups, and domains (such as G Suite). A role is + a named list of permissions; each role can be an IAM + predefined role or a user-created custom role. For some + types of Google Cloud resources, a binding can also + specify a condition, which is a logical expression that + allows access to a resource only if the expression + evaluates to true. A condition can add constraints based + on attributes of the request, the resource, or both. To + learn which resources support conditions in their IAM + policies, see the [IAM + documentation](\ https://cloud.google.com/iam/help/conditions/resource-policies). + **JSON example:** { "bindings": [ { "role": + "roles/resourcemanager.organizationAdmin", "members": [ + "user:mike@example.com", "group:admins@example.com", + "domain:google.com", + "serviceAccount:my-project-id@appspot.gserviceaccount.com" + ] }, { "role": + "roles/resourcemanager.organizationViewer", "members": [ + "user:eve@example.com" ], "condition": { "title": + "expirable access", "description": "Does not grant + access after Sep 2020", "expression": "request.time < + timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": + "BwWWja0YfJA=", "version": 3 } **YAML example:** + bindings: - members: - user:\ mike@example.com - + group:\ admins@example.com - domain:google.com - + serviceAccount:\ my-project-id@appspot.gserviceaccount.com + role: roles/resourcemanager.organizationAdmin - members: + - user:\ eve@example.com role: + roles/resourcemanager.organizationViewer condition: + title: expirable access description: Does not grant + access after Sep 2020 expression: request.time < + timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= + version: 3 For a description of IAM and its features, + see the [IAM + documentation](\ https://cloud.google.com/iam/docs/). + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any( + [project, region, resource, region_set_policy_request_resource] + ) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.SetIamPolicyRegionNetworkFirewallPolicyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance( + request, compute.SetIamPolicyRegionNetworkFirewallPolicyRequest + ): + request = compute.SetIamPolicyRegionNetworkFirewallPolicyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if region is not None: + request.region = region + if resource is not None: + request.resource = resource + if region_set_policy_request_resource is not None: + request.region_set_policy_request_resource = ( + region_set_policy_request_resource + ) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.set_iam_policy] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def test_iam_permissions( + self, + request: Union[ + compute.TestIamPermissionsRegionNetworkFirewallPolicyRequest, dict + ] = None, + *, + project: str = None, + region: str = None, + resource: str = None, + test_permissions_request_resource: compute.TestPermissionsRequest = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.TestPermissionsResponse: + r"""Returns permissions that a caller has on the + specified resource. + + Args: + request (Union[google.cloud.compute_v1.types.TestIamPermissionsRegionNetworkFirewallPolicyRequest, dict]): + The request object. A request message for + RegionNetworkFirewallPolicies.TestIamPermissions. See + the method description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + region (str): + The name of the region for this + request. + + This corresponds to the ``region`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + resource (str): + Name or id of the resource for this + request. + + This corresponds to the ``resource`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + test_permissions_request_resource (google.cloud.compute_v1.types.TestPermissionsRequest): + The body resource for this request + This corresponds to the ``test_permissions_request_resource`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.TestPermissionsResponse: + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any( + [project, region, resource, test_permissions_request_resource] + ) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.TestIamPermissionsRegionNetworkFirewallPolicyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance( + request, compute.TestIamPermissionsRegionNetworkFirewallPolicyRequest + ): + request = compute.TestIamPermissionsRegionNetworkFirewallPolicyRequest( + request + ) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if region is not None: + request.region = region + if resource is not None: + request.resource = resource + if test_permissions_request_resource is not None: + request.test_permissions_request_resource = ( + test_permissions_request_resource + ) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.test_iam_permissions] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def __enter__(self): + return self + + def __exit__(self, type, value, traceback): + """Releases underlying transport's resources. + + .. warning:: + ONLY use as a context manager if the transport is NOT shared + with other clients! Exiting the with block will CLOSE the transport + and may cause errors in other clients! + """ + self.transport.close() + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ("RegionNetworkFirewallPoliciesClient",) diff --git a/google/cloud/compute_v1/services/region_network_firewall_policies/pagers.py b/google/cloud/compute_v1/services/region_network_firewall_policies/pagers.py new file mode 100644 index 000000000..2bb051188 --- /dev/null +++ b/google/cloud/compute_v1/services/region_network_firewall_policies/pagers.py @@ -0,0 +1,89 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +from typing import ( + Any, + AsyncIterator, + Awaitable, + Callable, + Sequence, + Tuple, + Optional, + Iterator, +) + +from google.cloud.compute_v1.types import compute + + +class ListPager: + """A pager for iterating through ``list`` requests. + + This class thinly wraps an initial + :class:`google.cloud.compute_v1.types.FirewallPolicyList` object, and + provides an ``__iter__`` method to iterate through its + ``items`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``List`` requests and continue to iterate + through the ``items`` field on the + corresponding responses. + + All the usual :class:`google.cloud.compute_v1.types.FirewallPolicyList` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., compute.FirewallPolicyList], + request: compute.ListRegionNetworkFirewallPoliciesRequest, + response: compute.FirewallPolicyList, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.compute_v1.types.ListRegionNetworkFirewallPoliciesRequest): + The initial request object. + response (google.cloud.compute_v1.types.FirewallPolicyList): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = compute.ListRegionNetworkFirewallPoliciesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[compute.FirewallPolicyList]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[compute.FirewallPolicy]: + for page in self.pages: + yield from page.items + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/cloud/compute_v1/services/region_network_firewall_policies/transports/__init__.py b/google/cloud/compute_v1/services/region_network_firewall_policies/transports/__init__.py new file mode 100644 index 000000000..0cdd13a84 --- /dev/null +++ b/google/cloud/compute_v1/services/region_network_firewall_policies/transports/__init__.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +from collections import OrderedDict +from typing import Dict, Type + +from .base import RegionNetworkFirewallPoliciesTransport +from .rest import RegionNetworkFirewallPoliciesRestTransport +from .rest import RegionNetworkFirewallPoliciesRestInterceptor + + +# Compile a registry of transports. +_transport_registry = ( + OrderedDict() +) # type: Dict[str, Type[RegionNetworkFirewallPoliciesTransport]] +_transport_registry["rest"] = RegionNetworkFirewallPoliciesRestTransport + +__all__ = ( + "RegionNetworkFirewallPoliciesTransport", + "RegionNetworkFirewallPoliciesRestTransport", + "RegionNetworkFirewallPoliciesRestInterceptor", +) diff --git a/google/cloud/compute_v1/services/region_network_firewall_policies/transports/base.py b/google/cloud/compute_v1/services/region_network_firewall_policies/transports/base.py new file mode 100644 index 000000000..c6f22d6f6 --- /dev/null +++ b/google/cloud/compute_v1/services/region_network_firewall_policies/transports/base.py @@ -0,0 +1,386 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +import abc +from typing import Awaitable, Callable, Dict, Optional, Sequence, Union +import pkg_resources + +import google.auth # type: ignore +import google.api_core +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries +from google.auth import credentials as ga_credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.compute_v1.types import compute + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +class RegionNetworkFirewallPoliciesTransport(abc.ABC): + """Abstract transport class for RegionNetworkFirewallPolicies.""" + + AUTH_SCOPES = ( + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/cloud-platform", + ) + + DEFAULT_HOST: str = "compute.googleapis.com" + + def __init__( + self, + *, + host: str = DEFAULT_HOST, + credentials: ga_credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + **kwargs, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): + The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A list of scopes. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + + scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} + + # Save the scopes. + self._scopes = scopes + + # If no credentials are provided, then determine the appropriate + # defaults. + if credentials and credentials_file: + raise core_exceptions.DuplicateCredentialArgs( + "'credentials_file' and 'credentials' are mutually exclusive" + ) + + if credentials_file is not None: + credentials, _ = google.auth.load_credentials_from_file( + credentials_file, **scopes_kwargs, quota_project_id=quota_project_id + ) + elif credentials is None: + credentials, _ = google.auth.default( + **scopes_kwargs, quota_project_id=quota_project_id + ) + + # If the credentials are service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + + # Save the credentials. + self._credentials = credentials + + def _prep_wrapped_messages(self, client_info): + # Precompute the wrapped methods. + self._wrapped_methods = { + self.add_association: gapic_v1.method.wrap_method( + self.add_association, + default_timeout=None, + client_info=client_info, + ), + self.add_rule: gapic_v1.method.wrap_method( + self.add_rule, + default_timeout=None, + client_info=client_info, + ), + self.clone_rules: gapic_v1.method.wrap_method( + self.clone_rules, + default_timeout=None, + client_info=client_info, + ), + self.delete: gapic_v1.method.wrap_method( + self.delete, + default_timeout=None, + client_info=client_info, + ), + self.get: gapic_v1.method.wrap_method( + self.get, + default_timeout=None, + client_info=client_info, + ), + self.get_association: gapic_v1.method.wrap_method( + self.get_association, + default_timeout=None, + client_info=client_info, + ), + self.get_effective_firewalls: gapic_v1.method.wrap_method( + self.get_effective_firewalls, + default_timeout=None, + client_info=client_info, + ), + self.get_iam_policy: gapic_v1.method.wrap_method( + self.get_iam_policy, + default_timeout=None, + client_info=client_info, + ), + self.get_rule: gapic_v1.method.wrap_method( + self.get_rule, + default_timeout=None, + client_info=client_info, + ), + self.insert: gapic_v1.method.wrap_method( + self.insert, + default_timeout=None, + client_info=client_info, + ), + self.list: gapic_v1.method.wrap_method( + self.list, + default_timeout=None, + client_info=client_info, + ), + self.patch: gapic_v1.method.wrap_method( + self.patch, + default_timeout=None, + client_info=client_info, + ), + self.patch_rule: gapic_v1.method.wrap_method( + self.patch_rule, + default_timeout=None, + client_info=client_info, + ), + self.remove_association: gapic_v1.method.wrap_method( + self.remove_association, + default_timeout=None, + client_info=client_info, + ), + self.remove_rule: gapic_v1.method.wrap_method( + self.remove_rule, + default_timeout=None, + client_info=client_info, + ), + self.set_iam_policy: gapic_v1.method.wrap_method( + self.set_iam_policy, + default_timeout=None, + client_info=client_info, + ), + self.test_iam_permissions: gapic_v1.method.wrap_method( + self.test_iam_permissions, + default_timeout=None, + client_info=client_info, + ), + } + + def close(self): + """Closes resources associated with the transport. + + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! + """ + raise NotImplementedError() + + @property + def add_association( + self, + ) -> Callable[ + [compute.AddAssociationRegionNetworkFirewallPolicyRequest], + Union[compute.Operation, Awaitable[compute.Operation]], + ]: + raise NotImplementedError() + + @property + def add_rule( + self, + ) -> Callable[ + [compute.AddRuleRegionNetworkFirewallPolicyRequest], + Union[compute.Operation, Awaitable[compute.Operation]], + ]: + raise NotImplementedError() + + @property + def clone_rules( + self, + ) -> Callable[ + [compute.CloneRulesRegionNetworkFirewallPolicyRequest], + Union[compute.Operation, Awaitable[compute.Operation]], + ]: + raise NotImplementedError() + + @property + def delete( + self, + ) -> Callable[ + [compute.DeleteRegionNetworkFirewallPolicyRequest], + Union[compute.Operation, Awaitable[compute.Operation]], + ]: + raise NotImplementedError() + + @property + def get( + self, + ) -> Callable[ + [compute.GetRegionNetworkFirewallPolicyRequest], + Union[compute.FirewallPolicy, Awaitable[compute.FirewallPolicy]], + ]: + raise NotImplementedError() + + @property + def get_association( + self, + ) -> Callable[ + [compute.GetAssociationRegionNetworkFirewallPolicyRequest], + Union[ + compute.FirewallPolicyAssociation, + Awaitable[compute.FirewallPolicyAssociation], + ], + ]: + raise NotImplementedError() + + @property + def get_effective_firewalls( + self, + ) -> Callable[ + [compute.GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest], + Union[ + compute.RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse, + Awaitable[ + compute.RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse + ], + ], + ]: + raise NotImplementedError() + + @property + def get_iam_policy( + self, + ) -> Callable[ + [compute.GetIamPolicyRegionNetworkFirewallPolicyRequest], + Union[compute.Policy, Awaitable[compute.Policy]], + ]: + raise NotImplementedError() + + @property + def get_rule( + self, + ) -> Callable[ + [compute.GetRuleRegionNetworkFirewallPolicyRequest], + Union[compute.FirewallPolicyRule, Awaitable[compute.FirewallPolicyRule]], + ]: + raise NotImplementedError() + + @property + def insert( + self, + ) -> Callable[ + [compute.InsertRegionNetworkFirewallPolicyRequest], + Union[compute.Operation, Awaitable[compute.Operation]], + ]: + raise NotImplementedError() + + @property + def list( + self, + ) -> Callable[ + [compute.ListRegionNetworkFirewallPoliciesRequest], + Union[compute.FirewallPolicyList, Awaitable[compute.FirewallPolicyList]], + ]: + raise NotImplementedError() + + @property + def patch( + self, + ) -> Callable[ + [compute.PatchRegionNetworkFirewallPolicyRequest], + Union[compute.Operation, Awaitable[compute.Operation]], + ]: + raise NotImplementedError() + + @property + def patch_rule( + self, + ) -> Callable[ + [compute.PatchRuleRegionNetworkFirewallPolicyRequest], + Union[compute.Operation, Awaitable[compute.Operation]], + ]: + raise NotImplementedError() + + @property + def remove_association( + self, + ) -> Callable[ + [compute.RemoveAssociationRegionNetworkFirewallPolicyRequest], + Union[compute.Operation, Awaitable[compute.Operation]], + ]: + raise NotImplementedError() + + @property + def remove_rule( + self, + ) -> Callable[ + [compute.RemoveRuleRegionNetworkFirewallPolicyRequest], + Union[compute.Operation, Awaitable[compute.Operation]], + ]: + raise NotImplementedError() + + @property + def set_iam_policy( + self, + ) -> Callable[ + [compute.SetIamPolicyRegionNetworkFirewallPolicyRequest], + Union[compute.Policy, Awaitable[compute.Policy]], + ]: + raise NotImplementedError() + + @property + def test_iam_permissions( + self, + ) -> Callable[ + [compute.TestIamPermissionsRegionNetworkFirewallPolicyRequest], + Union[ + compute.TestPermissionsResponse, Awaitable[compute.TestPermissionsResponse] + ], + ]: + raise NotImplementedError() + + +__all__ = ("RegionNetworkFirewallPoliciesTransport",) diff --git a/google/cloud/compute_v1/services/region_network_firewall_policies/transports/rest.py b/google/cloud/compute_v1/services/region_network_firewall_policies/transports/rest.py new file mode 100644 index 000000000..c7846c043 --- /dev/null +++ b/google/cloud/compute_v1/services/region_network_firewall_policies/transports/rest.py @@ -0,0 +1,2826 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# + +from google.auth.transport.requests import AuthorizedSession # type: ignore +import json # type: ignore +import grpc # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.auth import credentials as ga_credentials # type: ignore +from google.api_core import exceptions as core_exceptions +from google.api_core import retry as retries +from google.api_core import rest_helpers +from google.api_core import rest_streaming +from google.api_core import path_template +from google.api_core import gapic_v1 + +from requests import __version__ as requests_version +import dataclasses +import re +from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +import warnings + +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore + + +from google.cloud.compute_v1.types import compute + +from .base import ( + RegionNetworkFirewallPoliciesTransport, + DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO, +) + + +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version, + grpc_version=None, + rest_version=requests_version, +) + + +class RegionNetworkFirewallPoliciesRestInterceptor: + """Interceptor for RegionNetworkFirewallPolicies. + + Interceptors are used to manipulate requests, request metadata, and responses + in arbitrary ways. + Example use cases include: + * Logging + * Verifying requests according to service or custom semantics + * Stripping extraneous information from responses + + These use cases and more can be enabled by injecting an + instance of a custom subclass when constructing the RegionNetworkFirewallPoliciesRestTransport. + + .. code-block:: python + class MyCustomRegionNetworkFirewallPoliciesInterceptor(RegionNetworkFirewallPoliciesRestInterceptor): + def pre_add_association(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_add_association(response): + logging.log(f"Received response: {response}") + + def pre_add_rule(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_add_rule(response): + logging.log(f"Received response: {response}") + + def pre_clone_rules(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_clone_rules(response): + logging.log(f"Received response: {response}") + + def pre_delete(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_delete(response): + logging.log(f"Received response: {response}") + + def pre_get(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_get(response): + logging.log(f"Received response: {response}") + + def pre_get_association(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_get_association(response): + logging.log(f"Received response: {response}") + + def pre_get_effective_firewalls(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_get_effective_firewalls(response): + logging.log(f"Received response: {response}") + + def pre_get_iam_policy(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_get_iam_policy(response): + logging.log(f"Received response: {response}") + + def pre_get_rule(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_get_rule(response): + logging.log(f"Received response: {response}") + + def pre_insert(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_insert(response): + logging.log(f"Received response: {response}") + + def pre_list(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_list(response): + logging.log(f"Received response: {response}") + + def pre_patch(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_patch(response): + logging.log(f"Received response: {response}") + + def pre_patch_rule(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_patch_rule(response): + logging.log(f"Received response: {response}") + + def pre_remove_association(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_remove_association(response): + logging.log(f"Received response: {response}") + + def pre_remove_rule(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_remove_rule(response): + logging.log(f"Received response: {response}") + + def pre_set_iam_policy(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_set_iam_policy(response): + logging.log(f"Received response: {response}") + + def pre_test_iam_permissions(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_test_iam_permissions(response): + logging.log(f"Received response: {response}") + + transport = RegionNetworkFirewallPoliciesRestTransport(interceptor=MyCustomRegionNetworkFirewallPoliciesInterceptor()) + client = RegionNetworkFirewallPoliciesClient(transport=transport) + + + """ + + def pre_add_association( + self, + request: compute.AddAssociationRegionNetworkFirewallPolicyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + compute.AddAssociationRegionNetworkFirewallPolicyRequest, + Sequence[Tuple[str, str]], + ]: + """Pre-rpc interceptor for add_association + + Override in a subclass to manipulate the request or metadata + before they are sent to the RegionNetworkFirewallPolicies server. + """ + return request, metadata + + def post_add_association(self, response: compute.Operation) -> compute.Operation: + """Post-rpc interceptor for add_association + + Override in a subclass to manipulate the response + after it is returned by the RegionNetworkFirewallPolicies server but before + it is returned to user code. + """ + return response + + def pre_add_rule( + self, + request: compute.AddRuleRegionNetworkFirewallPolicyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + compute.AddRuleRegionNetworkFirewallPolicyRequest, Sequence[Tuple[str, str]] + ]: + """Pre-rpc interceptor for add_rule + + Override in a subclass to manipulate the request or metadata + before they are sent to the RegionNetworkFirewallPolicies server. + """ + return request, metadata + + def post_add_rule(self, response: compute.Operation) -> compute.Operation: + """Post-rpc interceptor for add_rule + + Override in a subclass to manipulate the response + after it is returned by the RegionNetworkFirewallPolicies server but before + it is returned to user code. + """ + return response + + def pre_clone_rules( + self, + request: compute.CloneRulesRegionNetworkFirewallPolicyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + compute.CloneRulesRegionNetworkFirewallPolicyRequest, Sequence[Tuple[str, str]] + ]: + """Pre-rpc interceptor for clone_rules + + Override in a subclass to manipulate the request or metadata + before they are sent to the RegionNetworkFirewallPolicies server. + """ + return request, metadata + + def post_clone_rules(self, response: compute.Operation) -> compute.Operation: + """Post-rpc interceptor for clone_rules + + Override in a subclass to manipulate the response + after it is returned by the RegionNetworkFirewallPolicies server but before + it is returned to user code. + """ + return response + + def pre_delete( + self, + request: compute.DeleteRegionNetworkFirewallPolicyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + compute.DeleteRegionNetworkFirewallPolicyRequest, Sequence[Tuple[str, str]] + ]: + """Pre-rpc interceptor for delete + + Override in a subclass to manipulate the request or metadata + before they are sent to the RegionNetworkFirewallPolicies server. + """ + return request, metadata + + def post_delete(self, response: compute.Operation) -> compute.Operation: + """Post-rpc interceptor for delete + + Override in a subclass to manipulate the response + after it is returned by the RegionNetworkFirewallPolicies server but before + it is returned to user code. + """ + return response + + def pre_get( + self, + request: compute.GetRegionNetworkFirewallPolicyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + compute.GetRegionNetworkFirewallPolicyRequest, Sequence[Tuple[str, str]] + ]: + """Pre-rpc interceptor for get + + Override in a subclass to manipulate the request or metadata + before they are sent to the RegionNetworkFirewallPolicies server. + """ + return request, metadata + + def post_get(self, response: compute.FirewallPolicy) -> compute.FirewallPolicy: + """Post-rpc interceptor for get + + Override in a subclass to manipulate the response + after it is returned by the RegionNetworkFirewallPolicies server but before + it is returned to user code. + """ + return response + + def pre_get_association( + self, + request: compute.GetAssociationRegionNetworkFirewallPolicyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + compute.GetAssociationRegionNetworkFirewallPolicyRequest, + Sequence[Tuple[str, str]], + ]: + """Pre-rpc interceptor for get_association + + Override in a subclass to manipulate the request or metadata + before they are sent to the RegionNetworkFirewallPolicies server. + """ + return request, metadata + + def post_get_association( + self, response: compute.FirewallPolicyAssociation + ) -> compute.FirewallPolicyAssociation: + """Post-rpc interceptor for get_association + + Override in a subclass to manipulate the response + after it is returned by the RegionNetworkFirewallPolicies server but before + it is returned to user code. + """ + return response + + def pre_get_effective_firewalls( + self, + request: compute.GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + compute.GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest, + Sequence[Tuple[str, str]], + ]: + """Pre-rpc interceptor for get_effective_firewalls + + Override in a subclass to manipulate the request or metadata + before they are sent to the RegionNetworkFirewallPolicies server. + """ + return request, metadata + + def post_get_effective_firewalls( + self, + response: compute.RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse, + ) -> compute.RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse: + """Post-rpc interceptor for get_effective_firewalls + + Override in a subclass to manipulate the response + after it is returned by the RegionNetworkFirewallPolicies server but before + it is returned to user code. + """ + return response + + def pre_get_iam_policy( + self, + request: compute.GetIamPolicyRegionNetworkFirewallPolicyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + compute.GetIamPolicyRegionNetworkFirewallPolicyRequest, + Sequence[Tuple[str, str]], + ]: + """Pre-rpc interceptor for get_iam_policy + + Override in a subclass to manipulate the request or metadata + before they are sent to the RegionNetworkFirewallPolicies server. + """ + return request, metadata + + def post_get_iam_policy(self, response: compute.Policy) -> compute.Policy: + """Post-rpc interceptor for get_iam_policy + + Override in a subclass to manipulate the response + after it is returned by the RegionNetworkFirewallPolicies server but before + it is returned to user code. + """ + return response + + def pre_get_rule( + self, + request: compute.GetRuleRegionNetworkFirewallPolicyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + compute.GetRuleRegionNetworkFirewallPolicyRequest, Sequence[Tuple[str, str]] + ]: + """Pre-rpc interceptor for get_rule + + Override in a subclass to manipulate the request or metadata + before they are sent to the RegionNetworkFirewallPolicies server. + """ + return request, metadata + + def post_get_rule( + self, response: compute.FirewallPolicyRule + ) -> compute.FirewallPolicyRule: + """Post-rpc interceptor for get_rule + + Override in a subclass to manipulate the response + after it is returned by the RegionNetworkFirewallPolicies server but before + it is returned to user code. + """ + return response + + def pre_insert( + self, + request: compute.InsertRegionNetworkFirewallPolicyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + compute.InsertRegionNetworkFirewallPolicyRequest, Sequence[Tuple[str, str]] + ]: + """Pre-rpc interceptor for insert + + Override in a subclass to manipulate the request or metadata + before they are sent to the RegionNetworkFirewallPolicies server. + """ + return request, metadata + + def post_insert(self, response: compute.Operation) -> compute.Operation: + """Post-rpc interceptor for insert + + Override in a subclass to manipulate the response + after it is returned by the RegionNetworkFirewallPolicies server but before + it is returned to user code. + """ + return response + + def pre_list( + self, + request: compute.ListRegionNetworkFirewallPoliciesRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + compute.ListRegionNetworkFirewallPoliciesRequest, Sequence[Tuple[str, str]] + ]: + """Pre-rpc interceptor for list + + Override in a subclass to manipulate the request or metadata + before they are sent to the RegionNetworkFirewallPolicies server. + """ + return request, metadata + + def post_list( + self, response: compute.FirewallPolicyList + ) -> compute.FirewallPolicyList: + """Post-rpc interceptor for list + + Override in a subclass to manipulate the response + after it is returned by the RegionNetworkFirewallPolicies server but before + it is returned to user code. + """ + return response + + def pre_patch( + self, + request: compute.PatchRegionNetworkFirewallPolicyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + compute.PatchRegionNetworkFirewallPolicyRequest, Sequence[Tuple[str, str]] + ]: + """Pre-rpc interceptor for patch + + Override in a subclass to manipulate the request or metadata + before they are sent to the RegionNetworkFirewallPolicies server. + """ + return request, metadata + + def post_patch(self, response: compute.Operation) -> compute.Operation: + """Post-rpc interceptor for patch + + Override in a subclass to manipulate the response + after it is returned by the RegionNetworkFirewallPolicies server but before + it is returned to user code. + """ + return response + + def pre_patch_rule( + self, + request: compute.PatchRuleRegionNetworkFirewallPolicyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + compute.PatchRuleRegionNetworkFirewallPolicyRequest, Sequence[Tuple[str, str]] + ]: + """Pre-rpc interceptor for patch_rule + + Override in a subclass to manipulate the request or metadata + before they are sent to the RegionNetworkFirewallPolicies server. + """ + return request, metadata + + def post_patch_rule(self, response: compute.Operation) -> compute.Operation: + """Post-rpc interceptor for patch_rule + + Override in a subclass to manipulate the response + after it is returned by the RegionNetworkFirewallPolicies server but before + it is returned to user code. + """ + return response + + def pre_remove_association( + self, + request: compute.RemoveAssociationRegionNetworkFirewallPolicyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + compute.RemoveAssociationRegionNetworkFirewallPolicyRequest, + Sequence[Tuple[str, str]], + ]: + """Pre-rpc interceptor for remove_association + + Override in a subclass to manipulate the request or metadata + before they are sent to the RegionNetworkFirewallPolicies server. + """ + return request, metadata + + def post_remove_association(self, response: compute.Operation) -> compute.Operation: + """Post-rpc interceptor for remove_association + + Override in a subclass to manipulate the response + after it is returned by the RegionNetworkFirewallPolicies server but before + it is returned to user code. + """ + return response + + def pre_remove_rule( + self, + request: compute.RemoveRuleRegionNetworkFirewallPolicyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + compute.RemoveRuleRegionNetworkFirewallPolicyRequest, Sequence[Tuple[str, str]] + ]: + """Pre-rpc interceptor for remove_rule + + Override in a subclass to manipulate the request or metadata + before they are sent to the RegionNetworkFirewallPolicies server. + """ + return request, metadata + + def post_remove_rule(self, response: compute.Operation) -> compute.Operation: + """Post-rpc interceptor for remove_rule + + Override in a subclass to manipulate the response + after it is returned by the RegionNetworkFirewallPolicies server but before + it is returned to user code. + """ + return response + + def pre_set_iam_policy( + self, + request: compute.SetIamPolicyRegionNetworkFirewallPolicyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + compute.SetIamPolicyRegionNetworkFirewallPolicyRequest, + Sequence[Tuple[str, str]], + ]: + """Pre-rpc interceptor for set_iam_policy + + Override in a subclass to manipulate the request or metadata + before they are sent to the RegionNetworkFirewallPolicies server. + """ + return request, metadata + + def post_set_iam_policy(self, response: compute.Policy) -> compute.Policy: + """Post-rpc interceptor for set_iam_policy + + Override in a subclass to manipulate the response + after it is returned by the RegionNetworkFirewallPolicies server but before + it is returned to user code. + """ + return response + + def pre_test_iam_permissions( + self, + request: compute.TestIamPermissionsRegionNetworkFirewallPolicyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + compute.TestIamPermissionsRegionNetworkFirewallPolicyRequest, + Sequence[Tuple[str, str]], + ]: + """Pre-rpc interceptor for test_iam_permissions + + Override in a subclass to manipulate the request or metadata + before they are sent to the RegionNetworkFirewallPolicies server. + """ + return request, metadata + + def post_test_iam_permissions( + self, response: compute.TestPermissionsResponse + ) -> compute.TestPermissionsResponse: + """Post-rpc interceptor for test_iam_permissions + + Override in a subclass to manipulate the response + after it is returned by the RegionNetworkFirewallPolicies server but before + it is returned to user code. + """ + return response + + +@dataclasses.dataclass +class RegionNetworkFirewallPoliciesRestStub: + _session: AuthorizedSession + _host: str + _interceptor: RegionNetworkFirewallPoliciesRestInterceptor + + +class RegionNetworkFirewallPoliciesRestTransport( + RegionNetworkFirewallPoliciesTransport +): + """REST backend transport for RegionNetworkFirewallPolicies. + + The RegionNetworkFirewallPolicies API. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends JSON representations of protocol buffers over HTTP/1.1 + """ + + _STUBS: Dict[str, RegionNetworkFirewallPoliciesRestStub] = {} + + def __init__( + self, + *, + host: str = "compute.googleapis.com", + credentials: ga_credentials.Credentials = None, + credentials_file: str = None, + scopes: Sequence[str] = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + url_scheme: str = "https", + interceptor: Optional[RegionNetworkFirewallPoliciesRestInterceptor] = None, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): + The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client + certificate to configure mutual TLS HTTP channel. It is ignored + if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you are developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + url_scheme: the protocol scheme for the API endpoint. Normally + "https", but for testing or local servers, + "http" can be specified. + """ + # Run the base constructor + # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. + # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the + # credentials object + maybe_url_match = re.match("^(?Phttp(?:s)?://)?(?P.*)$", host) + if maybe_url_match is None: + raise ValueError( + f"Unexpected hostname structure: {host}" + ) # pragma: NO COVER + + url_match_items = maybe_url_match.groupdict() + + host = f"{url_scheme}://{host}" if not url_match_items["scheme"] else host + + super().__init__( + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, + ) + self._session = AuthorizedSession( + self._credentials, default_host=self.DEFAULT_HOST + ) + if client_cert_source_for_mtls: + self._session.configure_mtls_channel(client_cert_source_for_mtls) + self._interceptor = ( + interceptor or RegionNetworkFirewallPoliciesRestInterceptor() + ) + self._prep_wrapped_messages(client_info) + + class _AddAssociation(RegionNetworkFirewallPoliciesRestStub): + def __hash__(self): + return hash("AddAssociation") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.AddAssociationRegionNetworkFirewallPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Call the add association method over HTTP. + + Args: + request (~.compute.AddAssociationRegionNetworkFirewallPolicyRequest): + The request object. A request message for + RegionNetworkFirewallPolicies.AddAssociation. + See the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/compute/v1/projects/{project}/regions/{region}/firewallPolicies/{firewall_policy}/addAssociation", + "body": "firewall_policy_association_resource", + }, + ] + request, metadata = self._interceptor.pre_add_association(request, metadata) + request_kwargs = ( + compute.AddAssociationRegionNetworkFirewallPolicyRequest.to_dict( + request + ) + ) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + # Jsonify the request body + body = compute.FirewallPolicyAssociation.to_json( + compute.FirewallPolicyAssociation(transcoded_request["body"]), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.AddAssociationRegionNetworkFirewallPolicyRequest.to_json( + compute.AddAssociationRegionNetworkFirewallPolicyRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.Operation.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_add_association(resp) + return resp + + class _AddRule(RegionNetworkFirewallPoliciesRestStub): + def __hash__(self): + return hash("AddRule") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.AddRuleRegionNetworkFirewallPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Call the add rule method over HTTP. + + Args: + request (~.compute.AddRuleRegionNetworkFirewallPolicyRequest): + The request object. A request message for + RegionNetworkFirewallPolicies.AddRule. + See the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/compute/v1/projects/{project}/regions/{region}/firewallPolicies/{firewall_policy}/addRule", + "body": "firewall_policy_rule_resource", + }, + ] + request, metadata = self._interceptor.pre_add_rule(request, metadata) + request_kwargs = compute.AddRuleRegionNetworkFirewallPolicyRequest.to_dict( + request + ) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + # Jsonify the request body + body = compute.FirewallPolicyRule.to_json( + compute.FirewallPolicyRule(transcoded_request["body"]), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.AddRuleRegionNetworkFirewallPolicyRequest.to_json( + compute.AddRuleRegionNetworkFirewallPolicyRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.Operation.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_add_rule(resp) + return resp + + class _CloneRules(RegionNetworkFirewallPoliciesRestStub): + def __hash__(self): + return hash("CloneRules") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.CloneRulesRegionNetworkFirewallPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Call the clone rules method over HTTP. + + Args: + request (~.compute.CloneRulesRegionNetworkFirewallPolicyRequest): + The request object. A request message for + RegionNetworkFirewallPolicies.CloneRules. + See the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/compute/v1/projects/{project}/regions/{region}/firewallPolicies/{firewall_policy}/cloneRules", + }, + ] + request, metadata = self._interceptor.pre_clone_rules(request, metadata) + request_kwargs = ( + compute.CloneRulesRegionNetworkFirewallPolicyRequest.to_dict(request) + ) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.CloneRulesRegionNetworkFirewallPolicyRequest.to_json( + compute.CloneRulesRegionNetworkFirewallPolicyRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.Operation.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_clone_rules(resp) + return resp + + class _Delete(RegionNetworkFirewallPoliciesRestStub): + def __hash__(self): + return hash("Delete") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.DeleteRegionNetworkFirewallPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Call the delete method over HTTP. + + Args: + request (~.compute.DeleteRegionNetworkFirewallPolicyRequest): + The request object. A request message for + RegionNetworkFirewallPolicies.Delete. + See the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "delete", + "uri": "/compute/v1/projects/{project}/regions/{region}/firewallPolicies/{firewall_policy}", + }, + ] + request, metadata = self._interceptor.pre_delete(request, metadata) + request_kwargs = compute.DeleteRegionNetworkFirewallPolicyRequest.to_dict( + request + ) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.DeleteRegionNetworkFirewallPolicyRequest.to_json( + compute.DeleteRegionNetworkFirewallPolicyRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.Operation.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_delete(resp) + return resp + + class _Get(RegionNetworkFirewallPoliciesRestStub): + def __hash__(self): + return hash("Get") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.GetRegionNetworkFirewallPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.FirewallPolicy: + r"""Call the get method over HTTP. + + Args: + request (~.compute.GetRegionNetworkFirewallPolicyRequest): + The request object. A request message for + RegionNetworkFirewallPolicies.Get. See + the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.FirewallPolicy: + Represents a Firewall Policy + resource. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/compute/v1/projects/{project}/regions/{region}/firewallPolicies/{firewall_policy}", + }, + ] + request, metadata = self._interceptor.pre_get(request, metadata) + request_kwargs = compute.GetRegionNetworkFirewallPolicyRequest.to_dict( + request + ) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.GetRegionNetworkFirewallPolicyRequest.to_json( + compute.GetRegionNetworkFirewallPolicyRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.FirewallPolicy.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_get(resp) + return resp + + class _GetAssociation(RegionNetworkFirewallPoliciesRestStub): + def __hash__(self): + return hash("GetAssociation") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.GetAssociationRegionNetworkFirewallPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.FirewallPolicyAssociation: + r"""Call the get association method over HTTP. + + Args: + request (~.compute.GetAssociationRegionNetworkFirewallPolicyRequest): + The request object. A request message for + RegionNetworkFirewallPolicies.GetAssociation. + See the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.FirewallPolicyAssociation: + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/compute/v1/projects/{project}/regions/{region}/firewallPolicies/{firewall_policy}/getAssociation", + }, + ] + request, metadata = self._interceptor.pre_get_association(request, metadata) + request_kwargs = ( + compute.GetAssociationRegionNetworkFirewallPolicyRequest.to_dict( + request + ) + ) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.GetAssociationRegionNetworkFirewallPolicyRequest.to_json( + compute.GetAssociationRegionNetworkFirewallPolicyRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.FirewallPolicyAssociation.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_get_association(resp) + return resp + + class _GetEffectiveFirewalls(RegionNetworkFirewallPoliciesRestStub): + def __hash__(self): + return hash("GetEffectiveFirewalls") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + "network": "", + } + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse: + r"""Call the get effective firewalls method over HTTP. + + Args: + request (~.compute.GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest): + The request object. A request message for + RegionNetworkFirewallPolicies.GetEffectiveFirewalls. + See the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse: + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/compute/v1/projects/{project}/regions/{region}/firewallPolicies/getEffectiveFirewalls", + }, + ] + request, metadata = self._interceptor.pre_get_effective_firewalls( + request, metadata + ) + request_kwargs = ( + compute.GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest.to_dict( + request + ) + ) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest.to_json( + compute.GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_get_effective_firewalls(resp) + return resp + + class _GetIamPolicy(RegionNetworkFirewallPoliciesRestStub): + def __hash__(self): + return hash("GetIamPolicy") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.GetIamPolicyRegionNetworkFirewallPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Policy: + r"""Call the get iam policy method over HTTP. + + Args: + request (~.compute.GetIamPolicyRegionNetworkFirewallPolicyRequest): + The request object. A request message for + RegionNetworkFirewallPolicies.GetIamPolicy. + See the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Policy: + An Identity and Access Management (IAM) policy, which + specifies access controls for Google Cloud resources. A + ``Policy`` is a collection of ``bindings``. A + ``binding`` binds one or more ``members``, or + principals, to a single ``role``. Principals can be user + accounts, service accounts, Google groups, and domains + (such as G Suite). A ``role`` is a named list of + permissions; each ``role`` can be an IAM predefined role + or a user-created custom role. For some types of Google + Cloud resources, a ``binding`` can also specify a + ``condition``, which is a logical expression that allows + access to a resource only if the expression evaluates to + ``true``. A condition can add constraints based on + attributes of the request, the resource, or both. To + learn which resources support conditions in their IAM + policies, see the `IAM + documentation `__. + **JSON example:** { "bindings": [ { "role": + "roles/resourcemanager.organizationAdmin", "members": [ + "user:mike@example.com", "group:admins@example.com", + "domain:google.com", + "serviceAccount:my-project-id@appspot.gserviceaccount.com" + ] }, { "role": + "roles/resourcemanager.organizationViewer", "members": [ + "user:eve@example.com" ], "condition": { "title": + "expirable access", "description": "Does not grant + access after Sep 2020", "expression": "request.time < + timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": + "BwWWja0YfJA=", "version": 3 } **YAML example:** + bindings: - members: - user:mike@example.com - + group:admins@example.com - domain:google.com - + serviceAccount:my-project-id@appspot.gserviceaccount.com + role: roles/resourcemanager.organizationAdmin - members: + - user:eve@example.com role: + roles/resourcemanager.organizationViewer condition: + title: expirable access description: Does not grant + access after Sep 2020 expression: request.time < + timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= + version: 3 For a description of IAM and its features, + see the `IAM + documentation `__. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/compute/v1/projects/{project}/regions/{region}/firewallPolicies/{resource}/getIamPolicy", + }, + ] + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) + request_kwargs = ( + compute.GetIamPolicyRegionNetworkFirewallPolicyRequest.to_dict(request) + ) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.GetIamPolicyRegionNetworkFirewallPolicyRequest.to_json( + compute.GetIamPolicyRegionNetworkFirewallPolicyRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.Policy.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_get_iam_policy(resp) + return resp + + class _GetRule(RegionNetworkFirewallPoliciesRestStub): + def __hash__(self): + return hash("GetRule") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.GetRuleRegionNetworkFirewallPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.FirewallPolicyRule: + r"""Call the get rule method over HTTP. + + Args: + request (~.compute.GetRuleRegionNetworkFirewallPolicyRequest): + The request object. A request message for + RegionNetworkFirewallPolicies.GetRule. + See the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.FirewallPolicyRule: + Represents a rule that describes one + or more match conditions along with the + action to be taken when traffic matches + this condition (allow or deny). + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/compute/v1/projects/{project}/regions/{region}/firewallPolicies/{firewall_policy}/getRule", + }, + ] + request, metadata = self._interceptor.pre_get_rule(request, metadata) + request_kwargs = compute.GetRuleRegionNetworkFirewallPolicyRequest.to_dict( + request + ) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.GetRuleRegionNetworkFirewallPolicyRequest.to_json( + compute.GetRuleRegionNetworkFirewallPolicyRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.FirewallPolicyRule.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_get_rule(resp) + return resp + + class _Insert(RegionNetworkFirewallPoliciesRestStub): + def __hash__(self): + return hash("Insert") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.InsertRegionNetworkFirewallPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Call the insert method over HTTP. + + Args: + request (~.compute.InsertRegionNetworkFirewallPolicyRequest): + The request object. A request message for + RegionNetworkFirewallPolicies.Insert. + See the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/compute/v1/projects/{project}/regions/{region}/firewallPolicies", + "body": "firewall_policy_resource", + }, + ] + request, metadata = self._interceptor.pre_insert(request, metadata) + request_kwargs = compute.InsertRegionNetworkFirewallPolicyRequest.to_dict( + request + ) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + # Jsonify the request body + body = compute.FirewallPolicy.to_json( + compute.FirewallPolicy(transcoded_request["body"]), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.InsertRegionNetworkFirewallPolicyRequest.to_json( + compute.InsertRegionNetworkFirewallPolicyRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.Operation.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_insert(resp) + return resp + + class _List(RegionNetworkFirewallPoliciesRestStub): + def __hash__(self): + return hash("List") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.ListRegionNetworkFirewallPoliciesRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.FirewallPolicyList: + r"""Call the list method over HTTP. + + Args: + request (~.compute.ListRegionNetworkFirewallPoliciesRequest): + The request object. A request message for + RegionNetworkFirewallPolicies.List. See + the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.FirewallPolicyList: + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/compute/v1/projects/{project}/regions/{region}/firewallPolicies", + }, + ] + request, metadata = self._interceptor.pre_list(request, metadata) + request_kwargs = compute.ListRegionNetworkFirewallPoliciesRequest.to_dict( + request + ) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.ListRegionNetworkFirewallPoliciesRequest.to_json( + compute.ListRegionNetworkFirewallPoliciesRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.FirewallPolicyList.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_list(resp) + return resp + + class _Patch(RegionNetworkFirewallPoliciesRestStub): + def __hash__(self): + return hash("Patch") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.PatchRegionNetworkFirewallPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Call the patch method over HTTP. + + Args: + request (~.compute.PatchRegionNetworkFirewallPolicyRequest): + The request object. A request message for + RegionNetworkFirewallPolicies.Patch. See + the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "patch", + "uri": "/compute/v1/projects/{project}/regions/{region}/firewallPolicies/{firewall_policy}", + "body": "firewall_policy_resource", + }, + ] + request, metadata = self._interceptor.pre_patch(request, metadata) + request_kwargs = compute.PatchRegionNetworkFirewallPolicyRequest.to_dict( + request + ) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + # Jsonify the request body + body = compute.FirewallPolicy.to_json( + compute.FirewallPolicy(transcoded_request["body"]), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.PatchRegionNetworkFirewallPolicyRequest.to_json( + compute.PatchRegionNetworkFirewallPolicyRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.Operation.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_patch(resp) + return resp + + class _PatchRule(RegionNetworkFirewallPoliciesRestStub): + def __hash__(self): + return hash("PatchRule") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.PatchRuleRegionNetworkFirewallPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Call the patch rule method over HTTP. + + Args: + request (~.compute.PatchRuleRegionNetworkFirewallPolicyRequest): + The request object. A request message for + RegionNetworkFirewallPolicies.PatchRule. + See the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/compute/v1/projects/{project}/regions/{region}/firewallPolicies/{firewall_policy}/patchRule", + "body": "firewall_policy_rule_resource", + }, + ] + request, metadata = self._interceptor.pre_patch_rule(request, metadata) + request_kwargs = ( + compute.PatchRuleRegionNetworkFirewallPolicyRequest.to_dict(request) + ) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + # Jsonify the request body + body = compute.FirewallPolicyRule.to_json( + compute.FirewallPolicyRule(transcoded_request["body"]), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.PatchRuleRegionNetworkFirewallPolicyRequest.to_json( + compute.PatchRuleRegionNetworkFirewallPolicyRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.Operation.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_patch_rule(resp) + return resp + + class _RemoveAssociation(RegionNetworkFirewallPoliciesRestStub): + def __hash__(self): + return hash("RemoveAssociation") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.RemoveAssociationRegionNetworkFirewallPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Call the remove association method over HTTP. + + Args: + request (~.compute.RemoveAssociationRegionNetworkFirewallPolicyRequest): + The request object. A request message for + RegionNetworkFirewallPolicies.RemoveAssociation. + See the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/compute/v1/projects/{project}/regions/{region}/firewallPolicies/{firewall_policy}/removeAssociation", + }, + ] + request, metadata = self._interceptor.pre_remove_association( + request, metadata + ) + request_kwargs = ( + compute.RemoveAssociationRegionNetworkFirewallPolicyRequest.to_dict( + request + ) + ) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.RemoveAssociationRegionNetworkFirewallPolicyRequest.to_json( + compute.RemoveAssociationRegionNetworkFirewallPolicyRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.Operation.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_remove_association(resp) + return resp + + class _RemoveRule(RegionNetworkFirewallPoliciesRestStub): + def __hash__(self): + return hash("RemoveRule") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.RemoveRuleRegionNetworkFirewallPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Call the remove rule method over HTTP. + + Args: + request (~.compute.RemoveRuleRegionNetworkFirewallPolicyRequest): + The request object. A request message for + RegionNetworkFirewallPolicies.RemoveRule. + See the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/compute/v1/projects/{project}/regions/{region}/firewallPolicies/{firewall_policy}/removeRule", + }, + ] + request, metadata = self._interceptor.pre_remove_rule(request, metadata) + request_kwargs = ( + compute.RemoveRuleRegionNetworkFirewallPolicyRequest.to_dict(request) + ) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.RemoveRuleRegionNetworkFirewallPolicyRequest.to_json( + compute.RemoveRuleRegionNetworkFirewallPolicyRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.Operation.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_remove_rule(resp) + return resp + + class _SetIamPolicy(RegionNetworkFirewallPoliciesRestStub): + def __hash__(self): + return hash("SetIamPolicy") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.SetIamPolicyRegionNetworkFirewallPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Policy: + r"""Call the set iam policy method over HTTP. + + Args: + request (~.compute.SetIamPolicyRegionNetworkFirewallPolicyRequest): + The request object. A request message for + RegionNetworkFirewallPolicies.SetIamPolicy. + See the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Policy: + An Identity and Access Management (IAM) policy, which + specifies access controls for Google Cloud resources. A + ``Policy`` is a collection of ``bindings``. A + ``binding`` binds one or more ``members``, or + principals, to a single ``role``. Principals can be user + accounts, service accounts, Google groups, and domains + (such as G Suite). A ``role`` is a named list of + permissions; each ``role`` can be an IAM predefined role + or a user-created custom role. For some types of Google + Cloud resources, a ``binding`` can also specify a + ``condition``, which is a logical expression that allows + access to a resource only if the expression evaluates to + ``true``. A condition can add constraints based on + attributes of the request, the resource, or both. To + learn which resources support conditions in their IAM + policies, see the `IAM + documentation `__. + **JSON example:** { "bindings": [ { "role": + "roles/resourcemanager.organizationAdmin", "members": [ + "user:mike@example.com", "group:admins@example.com", + "domain:google.com", + "serviceAccount:my-project-id@appspot.gserviceaccount.com" + ] }, { "role": + "roles/resourcemanager.organizationViewer", "members": [ + "user:eve@example.com" ], "condition": { "title": + "expirable access", "description": "Does not grant + access after Sep 2020", "expression": "request.time < + timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": + "BwWWja0YfJA=", "version": 3 } **YAML example:** + bindings: - members: - user:mike@example.com - + group:admins@example.com - domain:google.com - + serviceAccount:my-project-id@appspot.gserviceaccount.com + role: roles/resourcemanager.organizationAdmin - members: + - user:eve@example.com role: + roles/resourcemanager.organizationViewer condition: + title: expirable access description: Does not grant + access after Sep 2020 expression: request.time < + timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= + version: 3 For a description of IAM and its features, + see the `IAM + documentation `__. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/compute/v1/projects/{project}/regions/{region}/firewallPolicies/{resource}/setIamPolicy", + "body": "region_set_policy_request_resource", + }, + ] + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) + request_kwargs = ( + compute.SetIamPolicyRegionNetworkFirewallPolicyRequest.to_dict(request) + ) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + # Jsonify the request body + body = compute.RegionSetPolicyRequest.to_json( + compute.RegionSetPolicyRequest(transcoded_request["body"]), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.SetIamPolicyRegionNetworkFirewallPolicyRequest.to_json( + compute.SetIamPolicyRegionNetworkFirewallPolicyRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.Policy.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_set_iam_policy(resp) + return resp + + class _TestIamPermissions(RegionNetworkFirewallPoliciesRestStub): + def __hash__(self): + return hash("TestIamPermissions") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.TestIamPermissionsRegionNetworkFirewallPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.TestPermissionsResponse: + r"""Call the test iam permissions method over HTTP. + + Args: + request (~.compute.TestIamPermissionsRegionNetworkFirewallPolicyRequest): + The request object. A request message for + RegionNetworkFirewallPolicies.TestIamPermissions. + See the method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.TestPermissionsResponse: + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/compute/v1/projects/{project}/regions/{region}/firewallPolicies/{resource}/testIamPermissions", + "body": "test_permissions_request_resource", + }, + ] + request, metadata = self._interceptor.pre_test_iam_permissions( + request, metadata + ) + request_kwargs = ( + compute.TestIamPermissionsRegionNetworkFirewallPolicyRequest.to_dict( + request + ) + ) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + # Jsonify the request body + body = compute.TestPermissionsRequest.to_json( + compute.TestPermissionsRequest(transcoded_request["body"]), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.TestIamPermissionsRegionNetworkFirewallPolicyRequest.to_json( + compute.TestIamPermissionsRegionNetworkFirewallPolicyRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.TestPermissionsResponse.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_test_iam_permissions(resp) + return resp + + @property + def add_association( + self, + ) -> Callable[ + [compute.AddAssociationRegionNetworkFirewallPolicyRequest], compute.Operation + ]: + stub = self._STUBS.get("add_association") + if not stub: + stub = self._STUBS["add_association"] = self._AddAssociation( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def add_rule( + self, + ) -> Callable[ + [compute.AddRuleRegionNetworkFirewallPolicyRequest], compute.Operation + ]: + stub = self._STUBS.get("add_rule") + if not stub: + stub = self._STUBS["add_rule"] = self._AddRule( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def clone_rules( + self, + ) -> Callable[ + [compute.CloneRulesRegionNetworkFirewallPolicyRequest], compute.Operation + ]: + stub = self._STUBS.get("clone_rules") + if not stub: + stub = self._STUBS["clone_rules"] = self._CloneRules( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def delete( + self, + ) -> Callable[ + [compute.DeleteRegionNetworkFirewallPolicyRequest], compute.Operation + ]: + stub = self._STUBS.get("delete") + if not stub: + stub = self._STUBS["delete"] = self._Delete( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def get( + self, + ) -> Callable[ + [compute.GetRegionNetworkFirewallPolicyRequest], compute.FirewallPolicy + ]: + stub = self._STUBS.get("get") + if not stub: + stub = self._STUBS["get"] = self._Get( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def get_association( + self, + ) -> Callable[ + [compute.GetAssociationRegionNetworkFirewallPolicyRequest], + compute.FirewallPolicyAssociation, + ]: + stub = self._STUBS.get("get_association") + if not stub: + stub = self._STUBS["get_association"] = self._GetAssociation( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def get_effective_firewalls( + self, + ) -> Callable[ + [compute.GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest], + compute.RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse, + ]: + stub = self._STUBS.get("get_effective_firewalls") + if not stub: + stub = self._STUBS["get_effective_firewalls"] = self._GetEffectiveFirewalls( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def get_iam_policy( + self, + ) -> Callable[ + [compute.GetIamPolicyRegionNetworkFirewallPolicyRequest], compute.Policy + ]: + stub = self._STUBS.get("get_iam_policy") + if not stub: + stub = self._STUBS["get_iam_policy"] = self._GetIamPolicy( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def get_rule( + self, + ) -> Callable[ + [compute.GetRuleRegionNetworkFirewallPolicyRequest], compute.FirewallPolicyRule + ]: + stub = self._STUBS.get("get_rule") + if not stub: + stub = self._STUBS["get_rule"] = self._GetRule( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def insert( + self, + ) -> Callable[ + [compute.InsertRegionNetworkFirewallPolicyRequest], compute.Operation + ]: + stub = self._STUBS.get("insert") + if not stub: + stub = self._STUBS["insert"] = self._Insert( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def list( + self, + ) -> Callable[ + [compute.ListRegionNetworkFirewallPoliciesRequest], compute.FirewallPolicyList + ]: + stub = self._STUBS.get("list") + if not stub: + stub = self._STUBS["list"] = self._List( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def patch( + self, + ) -> Callable[[compute.PatchRegionNetworkFirewallPolicyRequest], compute.Operation]: + stub = self._STUBS.get("patch") + if not stub: + stub = self._STUBS["patch"] = self._Patch( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def patch_rule( + self, + ) -> Callable[ + [compute.PatchRuleRegionNetworkFirewallPolicyRequest], compute.Operation + ]: + stub = self._STUBS.get("patch_rule") + if not stub: + stub = self._STUBS["patch_rule"] = self._PatchRule( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def remove_association( + self, + ) -> Callable[ + [compute.RemoveAssociationRegionNetworkFirewallPolicyRequest], compute.Operation + ]: + stub = self._STUBS.get("remove_association") + if not stub: + stub = self._STUBS["remove_association"] = self._RemoveAssociation( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def remove_rule( + self, + ) -> Callable[ + [compute.RemoveRuleRegionNetworkFirewallPolicyRequest], compute.Operation + ]: + stub = self._STUBS.get("remove_rule") + if not stub: + stub = self._STUBS["remove_rule"] = self._RemoveRule( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def set_iam_policy( + self, + ) -> Callable[ + [compute.SetIamPolicyRegionNetworkFirewallPolicyRequest], compute.Policy + ]: + stub = self._STUBS.get("set_iam_policy") + if not stub: + stub = self._STUBS["set_iam_policy"] = self._SetIamPolicy( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def test_iam_permissions( + self, + ) -> Callable[ + [compute.TestIamPermissionsRegionNetworkFirewallPolicyRequest], + compute.TestPermissionsResponse, + ]: + stub = self._STUBS.get("test_iam_permissions") + if not stub: + stub = self._STUBS["test_iam_permissions"] = self._TestIamPermissions( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + def close(self): + self._session.close() + + +__all__ = ("RegionNetworkFirewallPoliciesRestTransport",) diff --git a/google/cloud/compute_v1/services/region_security_policies/__init__.py b/google/cloud/compute_v1/services/region_security_policies/__init__.py new file mode 100644 index 000000000..bd29dd86d --- /dev/null +++ b/google/cloud/compute_v1/services/region_security_policies/__init__.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +from .client import RegionSecurityPoliciesClient + +__all__ = ("RegionSecurityPoliciesClient",) diff --git a/google/cloud/compute_v1/services/region_security_policies/client.py b/google/cloud/compute_v1/services/region_security_policies/client.py new file mode 100644 index 000000000..1cd602d99 --- /dev/null +++ b/google/cloud/compute_v1/services/region_security_policies/client.py @@ -0,0 +1,927 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +from collections import OrderedDict +import os +import re +from typing import Dict, Optional, Sequence, Tuple, Type, Union +import pkg_resources + +from google.api_core import client_options as client_options_lib +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries +from google.auth import credentials as ga_credentials # type: ignore +from google.auth.transport import mtls # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore +from google.oauth2 import service_account # type: ignore + +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore + +from google.cloud.compute_v1.services.region_security_policies import pagers +from google.cloud.compute_v1.types import compute +from .transports.base import RegionSecurityPoliciesTransport, DEFAULT_CLIENT_INFO +from .transports.rest import RegionSecurityPoliciesRestTransport + + +class RegionSecurityPoliciesClientMeta(type): + """Metaclass for the RegionSecurityPolicies client. + + This provides class-level methods for building and retrieving + support objects (e.g. transport) without polluting the client instance + objects. + """ + + _transport_registry = ( + OrderedDict() + ) # type: Dict[str, Type[RegionSecurityPoliciesTransport]] + _transport_registry["rest"] = RegionSecurityPoliciesRestTransport + + def get_transport_class( + cls, + label: str = None, + ) -> Type[RegionSecurityPoliciesTransport]: + """Returns an appropriate transport class. + + Args: + label: The name of the desired transport. If none is + provided, then the first transport in the registry is used. + + Returns: + The transport class to use. + """ + # If a specific transport is requested, return that one. + if label: + return cls._transport_registry[label] + + # No transport is requested; return the default (that is, the first one + # in the dictionary). + return next(iter(cls._transport_registry.values())) + + +class RegionSecurityPoliciesClient(metaclass=RegionSecurityPoliciesClientMeta): + """The RegionSecurityPolicies API.""" + + @staticmethod + def _get_default_mtls_endpoint(api_endpoint): + """Converts api endpoint to mTLS endpoint. + + Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to + "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. + Args: + api_endpoint (Optional[str]): the api endpoint to convert. + Returns: + str: converted mTLS api endpoint. + """ + if not api_endpoint: + return api_endpoint + + mtls_endpoint_re = re.compile( + r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" + ) + + m = mtls_endpoint_re.match(api_endpoint) + name, mtls, sandbox, googledomain = m.groups() + if mtls or not googledomain: + return api_endpoint + + if sandbox: + return api_endpoint.replace( + "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" + ) + + return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") + + DEFAULT_ENDPOINT = "compute.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials + info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + RegionSecurityPoliciesClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + RegionSecurityPoliciesClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file(filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + @property + def transport(self) -> RegionSecurityPoliciesTransport: + """Returns the transport used by the client instance. + + Returns: + RegionSecurityPoliciesTransport: The transport used by the client + instance. + """ + return self._transport + + @staticmethod + def common_billing_account_path( + billing_account: str, + ) -> str: + """Returns a fully-qualified billing_account string.""" + return "billingAccounts/{billing_account}".format( + billing_account=billing_account, + ) + + @staticmethod + def parse_common_billing_account_path(path: str) -> Dict[str, str]: + """Parse a billing_account path into its component segments.""" + m = re.match(r"^billingAccounts/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_folder_path( + folder: str, + ) -> str: + """Returns a fully-qualified folder string.""" + return "folders/{folder}".format( + folder=folder, + ) + + @staticmethod + def parse_common_folder_path(path: str) -> Dict[str, str]: + """Parse a folder path into its component segments.""" + m = re.match(r"^folders/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_organization_path( + organization: str, + ) -> str: + """Returns a fully-qualified organization string.""" + return "organizations/{organization}".format( + organization=organization, + ) + + @staticmethod + def parse_common_organization_path(path: str) -> Dict[str, str]: + """Parse a organization path into its component segments.""" + m = re.match(r"^organizations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_project_path( + project: str, + ) -> str: + """Returns a fully-qualified project string.""" + return "projects/{project}".format( + project=project, + ) + + @staticmethod + def parse_common_project_path(path: str) -> Dict[str, str]: + """Parse a project path into its component segments.""" + m = re.match(r"^projects/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_location_path( + project: str, + location: str, + ) -> str: + """Returns a fully-qualified location string.""" + return "projects/{project}/locations/{location}".format( + project=project, + location=location, + ) + + @staticmethod + def parse_common_location_path(path: str) -> Dict[str, str]: + """Parse a location path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @classmethod + def get_mtls_endpoint_and_cert_source( + cls, client_options: Optional[client_options_lib.ClientOptions] = None + ): + """Return the API endpoint and client cert source for mutual TLS. + + The client cert source is determined in the following order: + (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the + client cert source is None. + (2) if `client_options.client_cert_source` is provided, use the provided one; if the + default client cert source exists, use the default one; otherwise the client cert + source is None. + + The API endpoint is determined in the following order: + (1) if `client_options.api_endpoint` if provided, use the provided one. + (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the + default mTLS endpoint; if the environment variabel is "never", use the default API + endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise + use the default API endpoint. + + More details can be found at https://google.aip.dev/auth/4114. + + Args: + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. Only the `api_endpoint` and `client_cert_source` properties may be used + in this method. + + Returns: + Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the + client cert source to use. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If any errors happen. + """ + if client_options is None: + client_options = client_options_lib.ClientOptions() + use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") + use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") + if use_client_cert not in ("true", "false"): + raise ValueError( + "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + ) + if use_mtls_endpoint not in ("auto", "never", "always"): + raise MutualTLSChannelError( + "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" + ) + + # Figure out the client cert source to use. + client_cert_source = None + if use_client_cert == "true": + if client_options.client_cert_source: + client_cert_source = client_options.client_cert_source + elif mtls.has_default_client_cert_source(): + client_cert_source = mtls.default_client_cert_source() + + # Figure out which api endpoint to use. + if client_options.api_endpoint is not None: + api_endpoint = client_options.api_endpoint + elif use_mtls_endpoint == "always" or ( + use_mtls_endpoint == "auto" and client_cert_source + ): + api_endpoint = cls.DEFAULT_MTLS_ENDPOINT + else: + api_endpoint = cls.DEFAULT_ENDPOINT + + return api_endpoint, client_cert_source + + def __init__( + self, + *, + credentials: Optional[ga_credentials.Credentials] = None, + transport: Union[str, RegionSecurityPoliciesTransport, None] = None, + client_options: Optional[client_options_lib.ClientOptions] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiates the region security policies client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, RegionSecurityPoliciesTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. It won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + """ + if isinstance(client_options, dict): + client_options = client_options_lib.from_dict(client_options) + if client_options is None: + client_options = client_options_lib.ClientOptions() + + api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( + client_options + ) + + api_key_value = getattr(client_options, "api_key", None) + if api_key_value and credentials: + raise ValueError( + "client_options.api_key and credentials are mutually exclusive" + ) + + # Save or instantiate the transport. + # Ordinarily, we provide the transport, but allowing a custom transport + # instance provides an extensibility point for unusual situations. + if isinstance(transport, RegionSecurityPoliciesTransport): + # transport is a RegionSecurityPoliciesTransport instance. + if credentials or client_options.credentials_file or api_key_value: + raise ValueError( + "When providing a transport instance, " + "provide its credentials directly." + ) + if client_options.scopes: + raise ValueError( + "When providing a transport instance, provide its scopes " + "directly." + ) + self._transport = transport + else: + import google.auth._default # type: ignore + + if api_key_value and hasattr( + google.auth._default, "get_api_key_credentials" + ): + credentials = google.auth._default.get_api_key_credentials( + api_key_value + ) + + Transport = type(self).get_transport_class(transport) + self._transport = Transport( + credentials=credentials, + credentials_file=client_options.credentials_file, + host=api_endpoint, + scopes=client_options.scopes, + client_cert_source_for_mtls=client_cert_source_func, + quota_project_id=client_options.quota_project_id, + client_info=client_info, + always_use_jwt_access=True, + ) + + def delete_unary( + self, + request: Union[compute.DeleteRegionSecurityPolicyRequest, dict] = None, + *, + project: str = None, + region: str = None, + security_policy: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Deletes the specified policy. + + Args: + request (Union[google.cloud.compute_v1.types.DeleteRegionSecurityPolicyRequest, dict]): + The request object. A request message for + RegionSecurityPolicies.Delete. See the method + description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + region (str): + Name of the region scoping this + request. + + This corresponds to the ``region`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + security_policy (str): + Name of the security policy to + delete. + + This corresponds to the ``security_policy`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + [Global](/compute/docs/reference/rest/v1/globalOperations) + \* + [Regional](/compute/docs/reference/rest/v1/regionOperations) + \* + [Zonal](/compute/docs/reference/rest/v1/zoneOperations) + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the globalOperations + resource. - For regional operations, use the + regionOperations resource. - For zonal operations, use + the zonalOperations resource. For more information, read + Global, Regional, and Zonal Resources. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([project, region, security_policy]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.DeleteRegionSecurityPolicyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, compute.DeleteRegionSecurityPolicyRequest): + request = compute.DeleteRegionSecurityPolicyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if region is not None: + request.region = region + if security_policy is not None: + request.security_policy = security_policy + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get( + self, + request: Union[compute.GetRegionSecurityPolicyRequest, dict] = None, + *, + project: str = None, + region: str = None, + security_policy: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.SecurityPolicy: + r"""List all of the ordered rules present in a single + specified policy. + + Args: + request (Union[google.cloud.compute_v1.types.GetRegionSecurityPolicyRequest, dict]): + The request object. A request message for + RegionSecurityPolicies.Get. See the method description + for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + region (str): + Name of the region scoping this + request. + + This corresponds to the ``region`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + security_policy (str): + Name of the security policy to get. + This corresponds to the ``security_policy`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.SecurityPolicy: + Represents a Google Cloud Armor + security policy resource. Only external + backend services that use load balancers + can reference a security policy. For + more information, see Google Cloud Armor + security policy overview. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([project, region, security_policy]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.GetRegionSecurityPolicyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, compute.GetRegionSecurityPolicyRequest): + request = compute.GetRegionSecurityPolicyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if region is not None: + request.region = region + if security_policy is not None: + request.security_policy = security_policy + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def insert_unary( + self, + request: Union[compute.InsertRegionSecurityPolicyRequest, dict] = None, + *, + project: str = None, + region: str = None, + security_policy_resource: compute.SecurityPolicy = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Creates a new policy in the specified project using + the data included in the request. + + Args: + request (Union[google.cloud.compute_v1.types.InsertRegionSecurityPolicyRequest, dict]): + The request object. A request message for + RegionSecurityPolicies.Insert. See the method + description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + region (str): + Name of the region scoping this + request. + + This corresponds to the ``region`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + security_policy_resource (google.cloud.compute_v1.types.SecurityPolicy): + The body resource for this request + This corresponds to the ``security_policy_resource`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + [Global](/compute/docs/reference/rest/v1/globalOperations) + \* + [Regional](/compute/docs/reference/rest/v1/regionOperations) + \* + [Zonal](/compute/docs/reference/rest/v1/zoneOperations) + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the globalOperations + resource. - For regional operations, use the + regionOperations resource. - For zonal operations, use + the zonalOperations resource. For more information, read + Global, Regional, and Zonal Resources. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([project, region, security_policy_resource]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.InsertRegionSecurityPolicyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, compute.InsertRegionSecurityPolicyRequest): + request = compute.InsertRegionSecurityPolicyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if region is not None: + request.region = region + if security_policy_resource is not None: + request.security_policy_resource = security_policy_resource + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.insert] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list( + self, + request: Union[compute.ListRegionSecurityPoliciesRequest, dict] = None, + *, + project: str = None, + region: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListPager: + r"""List all the policies that have been configured for + the specified project and region. + + Args: + request (Union[google.cloud.compute_v1.types.ListRegionSecurityPoliciesRequest, dict]): + The request object. A request message for + RegionSecurityPolicies.List. See the method description + for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + region (str): + Name of the region scoping this + request. + + This corresponds to the ``region`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.services.region_security_policies.pagers.ListPager: + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([project, region]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.ListRegionSecurityPoliciesRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, compute.ListRegionSecurityPoliciesRequest): + request = compute.ListRegionSecurityPoliciesRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if region is not None: + request.region = region + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def patch_unary( + self, + request: Union[compute.PatchRegionSecurityPolicyRequest, dict] = None, + *, + project: str = None, + region: str = None, + security_policy: str = None, + security_policy_resource: compute.SecurityPolicy = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Patches the specified policy with the data included + in the request. + + Args: + request (Union[google.cloud.compute_v1.types.PatchRegionSecurityPolicyRequest, dict]): + The request object. A request message for + RegionSecurityPolicies.Patch. See the method description + for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + region (str): + Name of the region scoping this + request. + + This corresponds to the ``region`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + security_policy (str): + Name of the security policy to + update. + + This corresponds to the ``security_policy`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + security_policy_resource (google.cloud.compute_v1.types.SecurityPolicy): + The body resource for this request + This corresponds to the ``security_policy_resource`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + [Global](/compute/docs/reference/rest/v1/globalOperations) + \* + [Regional](/compute/docs/reference/rest/v1/regionOperations) + \* + [Zonal](/compute/docs/reference/rest/v1/zoneOperations) + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the globalOperations + resource. - For regional operations, use the + regionOperations resource. - For zonal operations, use + the zonalOperations resource. For more information, read + Global, Regional, and Zonal Resources. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any( + [project, region, security_policy, security_policy_resource] + ) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.PatchRegionSecurityPolicyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, compute.PatchRegionSecurityPolicyRequest): + request = compute.PatchRegionSecurityPolicyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if region is not None: + request.region = region + if security_policy is not None: + request.security_policy = security_policy + if security_policy_resource is not None: + request.security_policy_resource = security_policy_resource + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.patch] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def __enter__(self): + return self + + def __exit__(self, type, value, traceback): + """Releases underlying transport's resources. + + .. warning:: + ONLY use as a context manager if the transport is NOT shared + with other clients! Exiting the with block will CLOSE the transport + and may cause errors in other clients! + """ + self.transport.close() + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ("RegionSecurityPoliciesClient",) diff --git a/google/cloud/compute_v1/services/region_security_policies/pagers.py b/google/cloud/compute_v1/services/region_security_policies/pagers.py new file mode 100644 index 000000000..067c695f6 --- /dev/null +++ b/google/cloud/compute_v1/services/region_security_policies/pagers.py @@ -0,0 +1,89 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +from typing import ( + Any, + AsyncIterator, + Awaitable, + Callable, + Sequence, + Tuple, + Optional, + Iterator, +) + +from google.cloud.compute_v1.types import compute + + +class ListPager: + """A pager for iterating through ``list`` requests. + + This class thinly wraps an initial + :class:`google.cloud.compute_v1.types.SecurityPolicyList` object, and + provides an ``__iter__`` method to iterate through its + ``items`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``List`` requests and continue to iterate + through the ``items`` field on the + corresponding responses. + + All the usual :class:`google.cloud.compute_v1.types.SecurityPolicyList` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., compute.SecurityPolicyList], + request: compute.ListRegionSecurityPoliciesRequest, + response: compute.SecurityPolicyList, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.compute_v1.types.ListRegionSecurityPoliciesRequest): + The initial request object. + response (google.cloud.compute_v1.types.SecurityPolicyList): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = compute.ListRegionSecurityPoliciesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[compute.SecurityPolicyList]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[compute.SecurityPolicy]: + for page in self.pages: + yield from page.items + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/cloud/compute_v1/services/region_security_policies/transports/__init__.py b/google/cloud/compute_v1/services/region_security_policies/transports/__init__.py new file mode 100644 index 000000000..5fd1b88ee --- /dev/null +++ b/google/cloud/compute_v1/services/region_security_policies/transports/__init__.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +from collections import OrderedDict +from typing import Dict, Type + +from .base import RegionSecurityPoliciesTransport +from .rest import RegionSecurityPoliciesRestTransport +from .rest import RegionSecurityPoliciesRestInterceptor + + +# Compile a registry of transports. +_transport_registry = ( + OrderedDict() +) # type: Dict[str, Type[RegionSecurityPoliciesTransport]] +_transport_registry["rest"] = RegionSecurityPoliciesRestTransport + +__all__ = ( + "RegionSecurityPoliciesTransport", + "RegionSecurityPoliciesRestTransport", + "RegionSecurityPoliciesRestInterceptor", +) diff --git a/google/cloud/compute_v1/services/region_security_policies/transports/base.py b/google/cloud/compute_v1/services/region_security_policies/transports/base.py new file mode 100644 index 000000000..da0e94071 --- /dev/null +++ b/google/cloud/compute_v1/services/region_security_policies/transports/base.py @@ -0,0 +1,208 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +import abc +from typing import Awaitable, Callable, Dict, Optional, Sequence, Union +import pkg_resources + +import google.auth # type: ignore +import google.api_core +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries +from google.auth import credentials as ga_credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.compute_v1.types import compute + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-compute", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +class RegionSecurityPoliciesTransport(abc.ABC): + """Abstract transport class for RegionSecurityPolicies.""" + + AUTH_SCOPES = ( + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/cloud-platform", + ) + + DEFAULT_HOST: str = "compute.googleapis.com" + + def __init__( + self, + *, + host: str = DEFAULT_HOST, + credentials: ga_credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + **kwargs, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): + The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A list of scopes. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + + scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} + + # Save the scopes. + self._scopes = scopes + + # If no credentials are provided, then determine the appropriate + # defaults. + if credentials and credentials_file: + raise core_exceptions.DuplicateCredentialArgs( + "'credentials_file' and 'credentials' are mutually exclusive" + ) + + if credentials_file is not None: + credentials, _ = google.auth.load_credentials_from_file( + credentials_file, **scopes_kwargs, quota_project_id=quota_project_id + ) + elif credentials is None: + credentials, _ = google.auth.default( + **scopes_kwargs, quota_project_id=quota_project_id + ) + + # If the credentials are service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + + # Save the credentials. + self._credentials = credentials + + def _prep_wrapped_messages(self, client_info): + # Precompute the wrapped methods. + self._wrapped_methods = { + self.delete: gapic_v1.method.wrap_method( + self.delete, + default_timeout=None, + client_info=client_info, + ), + self.get: gapic_v1.method.wrap_method( + self.get, + default_timeout=None, + client_info=client_info, + ), + self.insert: gapic_v1.method.wrap_method( + self.insert, + default_timeout=None, + client_info=client_info, + ), + self.list: gapic_v1.method.wrap_method( + self.list, + default_timeout=None, + client_info=client_info, + ), + self.patch: gapic_v1.method.wrap_method( + self.patch, + default_timeout=None, + client_info=client_info, + ), + } + + def close(self): + """Closes resources associated with the transport. + + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! + """ + raise NotImplementedError() + + @property + def delete( + self, + ) -> Callable[ + [compute.DeleteRegionSecurityPolicyRequest], + Union[compute.Operation, Awaitable[compute.Operation]], + ]: + raise NotImplementedError() + + @property + def get( + self, + ) -> Callable[ + [compute.GetRegionSecurityPolicyRequest], + Union[compute.SecurityPolicy, Awaitable[compute.SecurityPolicy]], + ]: + raise NotImplementedError() + + @property + def insert( + self, + ) -> Callable[ + [compute.InsertRegionSecurityPolicyRequest], + Union[compute.Operation, Awaitable[compute.Operation]], + ]: + raise NotImplementedError() + + @property + def list( + self, + ) -> Callable[ + [compute.ListRegionSecurityPoliciesRequest], + Union[compute.SecurityPolicyList, Awaitable[compute.SecurityPolicyList]], + ]: + raise NotImplementedError() + + @property + def patch( + self, + ) -> Callable[ + [compute.PatchRegionSecurityPolicyRequest], + Union[compute.Operation, Awaitable[compute.Operation]], + ]: + raise NotImplementedError() + + +__all__ = ("RegionSecurityPoliciesTransport",) diff --git a/google/cloud/compute_v1/services/region_security_policies/transports/rest.py b/google/cloud/compute_v1/services/region_security_policies/transports/rest.py new file mode 100644 index 000000000..71cb5fae5 --- /dev/null +++ b/google/cloud/compute_v1/services/region_security_policies/transports/rest.py @@ -0,0 +1,903 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# + +from google.auth.transport.requests import AuthorizedSession # type: ignore +import json # type: ignore +import grpc # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.auth import credentials as ga_credentials # type: ignore +from google.api_core import exceptions as core_exceptions +from google.api_core import retry as retries +from google.api_core import rest_helpers +from google.api_core import rest_streaming +from google.api_core import path_template +from google.api_core import gapic_v1 + +from requests import __version__ as requests_version +import dataclasses +import re +from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +import warnings + +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore + + +from google.cloud.compute_v1.types import compute + +from .base import ( + RegionSecurityPoliciesTransport, + DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO, +) + + +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version, + grpc_version=None, + rest_version=requests_version, +) + + +class RegionSecurityPoliciesRestInterceptor: + """Interceptor for RegionSecurityPolicies. + + Interceptors are used to manipulate requests, request metadata, and responses + in arbitrary ways. + Example use cases include: + * Logging + * Verifying requests according to service or custom semantics + * Stripping extraneous information from responses + + These use cases and more can be enabled by injecting an + instance of a custom subclass when constructing the RegionSecurityPoliciesRestTransport. + + .. code-block:: python + class MyCustomRegionSecurityPoliciesInterceptor(RegionSecurityPoliciesRestInterceptor): + def pre_delete(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_delete(response): + logging.log(f"Received response: {response}") + + def pre_get(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_get(response): + logging.log(f"Received response: {response}") + + def pre_insert(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_insert(response): + logging.log(f"Received response: {response}") + + def pre_list(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_list(response): + logging.log(f"Received response: {response}") + + def pre_patch(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_patch(response): + logging.log(f"Received response: {response}") + + transport = RegionSecurityPoliciesRestTransport(interceptor=MyCustomRegionSecurityPoliciesInterceptor()) + client = RegionSecurityPoliciesClient(transport=transport) + + + """ + + def pre_delete( + self, + request: compute.DeleteRegionSecurityPolicyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[compute.DeleteRegionSecurityPolicyRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for delete + + Override in a subclass to manipulate the request or metadata + before they are sent to the RegionSecurityPolicies server. + """ + return request, metadata + + def post_delete(self, response: compute.Operation) -> compute.Operation: + """Post-rpc interceptor for delete + + Override in a subclass to manipulate the response + after it is returned by the RegionSecurityPolicies server but before + it is returned to user code. + """ + return response + + def pre_get( + self, + request: compute.GetRegionSecurityPolicyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[compute.GetRegionSecurityPolicyRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for get + + Override in a subclass to manipulate the request or metadata + before they are sent to the RegionSecurityPolicies server. + """ + return request, metadata + + def post_get(self, response: compute.SecurityPolicy) -> compute.SecurityPolicy: + """Post-rpc interceptor for get + + Override in a subclass to manipulate the response + after it is returned by the RegionSecurityPolicies server but before + it is returned to user code. + """ + return response + + def pre_insert( + self, + request: compute.InsertRegionSecurityPolicyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[compute.InsertRegionSecurityPolicyRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for insert + + Override in a subclass to manipulate the request or metadata + before they are sent to the RegionSecurityPolicies server. + """ + return request, metadata + + def post_insert(self, response: compute.Operation) -> compute.Operation: + """Post-rpc interceptor for insert + + Override in a subclass to manipulate the response + after it is returned by the RegionSecurityPolicies server but before + it is returned to user code. + """ + return response + + def pre_list( + self, + request: compute.ListRegionSecurityPoliciesRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[compute.ListRegionSecurityPoliciesRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for list + + Override in a subclass to manipulate the request or metadata + before they are sent to the RegionSecurityPolicies server. + """ + return request, metadata + + def post_list( + self, response: compute.SecurityPolicyList + ) -> compute.SecurityPolicyList: + """Post-rpc interceptor for list + + Override in a subclass to manipulate the response + after it is returned by the RegionSecurityPolicies server but before + it is returned to user code. + """ + return response + + def pre_patch( + self, + request: compute.PatchRegionSecurityPolicyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[compute.PatchRegionSecurityPolicyRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for patch + + Override in a subclass to manipulate the request or metadata + before they are sent to the RegionSecurityPolicies server. + """ + return request, metadata + + def post_patch(self, response: compute.Operation) -> compute.Operation: + """Post-rpc interceptor for patch + + Override in a subclass to manipulate the response + after it is returned by the RegionSecurityPolicies server but before + it is returned to user code. + """ + return response + + +@dataclasses.dataclass +class RegionSecurityPoliciesRestStub: + _session: AuthorizedSession + _host: str + _interceptor: RegionSecurityPoliciesRestInterceptor + + +class RegionSecurityPoliciesRestTransport(RegionSecurityPoliciesTransport): + """REST backend transport for RegionSecurityPolicies. + + The RegionSecurityPolicies API. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends JSON representations of protocol buffers over HTTP/1.1 + """ + + _STUBS: Dict[str, RegionSecurityPoliciesRestStub] = {} + + def __init__( + self, + *, + host: str = "compute.googleapis.com", + credentials: ga_credentials.Credentials = None, + credentials_file: str = None, + scopes: Sequence[str] = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + url_scheme: str = "https", + interceptor: Optional[RegionSecurityPoliciesRestInterceptor] = None, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): + The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client + certificate to configure mutual TLS HTTP channel. It is ignored + if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you are developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + url_scheme: the protocol scheme for the API endpoint. Normally + "https", but for testing or local servers, + "http" can be specified. + """ + # Run the base constructor + # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. + # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the + # credentials object + maybe_url_match = re.match("^(?Phttp(?:s)?://)?(?P.*)$", host) + if maybe_url_match is None: + raise ValueError( + f"Unexpected hostname structure: {host}" + ) # pragma: NO COVER + + url_match_items = maybe_url_match.groupdict() + + host = f"{url_scheme}://{host}" if not url_match_items["scheme"] else host + + super().__init__( + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, + ) + self._session = AuthorizedSession( + self._credentials, default_host=self.DEFAULT_HOST + ) + if client_cert_source_for_mtls: + self._session.configure_mtls_channel(client_cert_source_for_mtls) + self._interceptor = interceptor or RegionSecurityPoliciesRestInterceptor() + self._prep_wrapped_messages(client_info) + + class _Delete(RegionSecurityPoliciesRestStub): + def __hash__(self): + return hash("Delete") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.DeleteRegionSecurityPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Call the delete method over HTTP. + + Args: + request (~.compute.DeleteRegionSecurityPolicyRequest): + The request object. A request message for + RegionSecurityPolicies.Delete. See the + method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "delete", + "uri": "/compute/v1/projects/{project}/regions/{region}/securityPolicies/{security_policy}", + }, + ] + request, metadata = self._interceptor.pre_delete(request, metadata) + request_kwargs = compute.DeleteRegionSecurityPolicyRequest.to_dict(request) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.DeleteRegionSecurityPolicyRequest.to_json( + compute.DeleteRegionSecurityPolicyRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.Operation.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_delete(resp) + return resp + + class _Get(RegionSecurityPoliciesRestStub): + def __hash__(self): + return hash("Get") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.GetRegionSecurityPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.SecurityPolicy: + r"""Call the get method over HTTP. + + Args: + request (~.compute.GetRegionSecurityPolicyRequest): + The request object. A request message for + RegionSecurityPolicies.Get. See the + method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.SecurityPolicy: + Represents a Google Cloud Armor + security policy resource. Only external + backend services that use load balancers + can reference a security policy. For + more information, see Google Cloud Armor + security policy overview. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/compute/v1/projects/{project}/regions/{region}/securityPolicies/{security_policy}", + }, + ] + request, metadata = self._interceptor.pre_get(request, metadata) + request_kwargs = compute.GetRegionSecurityPolicyRequest.to_dict(request) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.GetRegionSecurityPolicyRequest.to_json( + compute.GetRegionSecurityPolicyRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.SecurityPolicy.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_get(resp) + return resp + + class _Insert(RegionSecurityPoliciesRestStub): + def __hash__(self): + return hash("Insert") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.InsertRegionSecurityPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Call the insert method over HTTP. + + Args: + request (~.compute.InsertRegionSecurityPolicyRequest): + The request object. A request message for + RegionSecurityPolicies.Insert. See the + method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/compute/v1/projects/{project}/regions/{region}/securityPolicies", + "body": "security_policy_resource", + }, + ] + request, metadata = self._interceptor.pre_insert(request, metadata) + request_kwargs = compute.InsertRegionSecurityPolicyRequest.to_dict(request) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + # Jsonify the request body + body = compute.SecurityPolicy.to_json( + compute.SecurityPolicy(transcoded_request["body"]), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.InsertRegionSecurityPolicyRequest.to_json( + compute.InsertRegionSecurityPolicyRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.Operation.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_insert(resp) + return resp + + class _List(RegionSecurityPoliciesRestStub): + def __hash__(self): + return hash("List") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.ListRegionSecurityPoliciesRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.SecurityPolicyList: + r"""Call the list method over HTTP. + + Args: + request (~.compute.ListRegionSecurityPoliciesRequest): + The request object. A request message for + RegionSecurityPolicies.List. See the + method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.SecurityPolicyList: + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/compute/v1/projects/{project}/regions/{region}/securityPolicies", + }, + ] + request, metadata = self._interceptor.pre_list(request, metadata) + request_kwargs = compute.ListRegionSecurityPoliciesRequest.to_dict(request) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.ListRegionSecurityPoliciesRequest.to_json( + compute.ListRegionSecurityPoliciesRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.SecurityPolicyList.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_list(resp) + return resp + + class _Patch(RegionSecurityPoliciesRestStub): + def __hash__(self): + return hash("Patch") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.PatchRegionSecurityPolicyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Call the patch method over HTTP. + + Args: + request (~.compute.PatchRegionSecurityPolicyRequest): + The request object. A request message for + RegionSecurityPolicies.Patch. See the + method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "patch", + "uri": "/compute/v1/projects/{project}/regions/{region}/securityPolicies/{security_policy}", + "body": "security_policy_resource", + }, + ] + request, metadata = self._interceptor.pre_patch(request, metadata) + request_kwargs = compute.PatchRegionSecurityPolicyRequest.to_dict(request) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + # Jsonify the request body + body = compute.SecurityPolicy.to_json( + compute.SecurityPolicy(transcoded_request["body"]), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.PatchRegionSecurityPolicyRequest.to_json( + compute.PatchRegionSecurityPolicyRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.Operation.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_patch(resp) + return resp + + @property + def delete( + self, + ) -> Callable[[compute.DeleteRegionSecurityPolicyRequest], compute.Operation]: + stub = self._STUBS.get("delete") + if not stub: + stub = self._STUBS["delete"] = self._Delete( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def get( + self, + ) -> Callable[[compute.GetRegionSecurityPolicyRequest], compute.SecurityPolicy]: + stub = self._STUBS.get("get") + if not stub: + stub = self._STUBS["get"] = self._Get( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def insert( + self, + ) -> Callable[[compute.InsertRegionSecurityPolicyRequest], compute.Operation]: + stub = self._STUBS.get("insert") + if not stub: + stub = self._STUBS["insert"] = self._Insert( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def list( + self, + ) -> Callable[ + [compute.ListRegionSecurityPoliciesRequest], compute.SecurityPolicyList + ]: + stub = self._STUBS.get("list") + if not stub: + stub = self._STUBS["list"] = self._List( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + @property + def patch( + self, + ) -> Callable[[compute.PatchRegionSecurityPolicyRequest], compute.Operation]: + stub = self._STUBS.get("patch") + if not stub: + stub = self._STUBS["patch"] = self._Patch( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + + def close(self): + self._session.close() + + +__all__ = ("RegionSecurityPoliciesRestTransport",) diff --git a/google/cloud/compute_v1/services/region_target_https_proxies/client.py b/google/cloud/compute_v1/services/region_target_https_proxies/client.py index 39f9ab4b8..98e6f0dd7 100644 --- a/google/cloud/compute_v1/services/region_target_https_proxies/client.py +++ b/google/cloud/compute_v1/services/region_target_https_proxies/client.py @@ -800,6 +800,119 @@ def list( # Done; return the response. return response + def patch_unary( + self, + request: Union[compute.PatchRegionTargetHttpsProxyRequest, dict] = None, + *, + project: str = None, + region: str = None, + target_https_proxy: str = None, + target_https_proxy_resource: compute.TargetHttpsProxy = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Patches the specified regional TargetHttpsProxy + resource with the data included in the request. This + method supports PATCH semantics and uses JSON merge + patch format and processing rules. + + Args: + request (Union[google.cloud.compute_v1.types.PatchRegionTargetHttpsProxyRequest, dict]): + The request object. A request message for + RegionTargetHttpsProxies.Patch. See the method + description for details. + project (str): + Project ID for this request. + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + region (str): + Name of the region for this request. + This corresponds to the ``region`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + target_https_proxy (str): + Name of the TargetHttpsProxy resource + to patch. + + This corresponds to the ``target_https_proxy`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + target_https_proxy_resource (google.cloud.compute_v1.types.TargetHttpsProxy): + The body resource for this request + This corresponds to the ``target_https_proxy_resource`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.types.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + [Global](/compute/docs/reference/rest/v1/globalOperations) + \* + [Regional](/compute/docs/reference/rest/v1/regionOperations) + \* + [Zonal](/compute/docs/reference/rest/v1/zoneOperations) + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the globalOperations + resource. - For regional operations, use the + regionOperations resource. - For zonal operations, use + the zonalOperations resource. For more information, read + Global, Regional, and Zonal Resources. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any( + [project, region, target_https_proxy, target_https_proxy_resource] + ) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.PatchRegionTargetHttpsProxyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, compute.PatchRegionTargetHttpsProxyRequest): + request = compute.PatchRegionTargetHttpsProxyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + if region is not None: + request.region = region + if target_https_proxy is not None: + request.target_https_proxy = target_https_proxy + if target_https_proxy_resource is not None: + request.target_https_proxy_resource = target_https_proxy_resource + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.patch] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + def set_ssl_certificates_unary( self, request: Union[ diff --git a/google/cloud/compute_v1/services/region_target_https_proxies/transports/base.py b/google/cloud/compute_v1/services/region_target_https_proxies/transports/base.py index 119e025e8..b54453137 100644 --- a/google/cloud/compute_v1/services/region_target_https_proxies/transports/base.py +++ b/google/cloud/compute_v1/services/region_target_https_proxies/transports/base.py @@ -143,6 +143,11 @@ def _prep_wrapped_messages(self, client_info): default_timeout=None, client_info=client_info, ), + self.patch: gapic_v1.method.wrap_method( + self.patch, + default_timeout=None, + client_info=client_info, + ), self.set_ssl_certificates: gapic_v1.method.wrap_method( self.set_ssl_certificates, default_timeout=None, @@ -200,6 +205,15 @@ def list( ]: raise NotImplementedError() + @property + def patch( + self, + ) -> Callable[ + [compute.PatchRegionTargetHttpsProxyRequest], + Union[compute.Operation, Awaitable[compute.Operation]], + ]: + raise NotImplementedError() + @property def set_ssl_certificates( self, diff --git a/google/cloud/compute_v1/services/region_target_https_proxies/transports/rest.py b/google/cloud/compute_v1/services/region_target_https_proxies/transports/rest.py index 025619fab..289d7fa83 100644 --- a/google/cloud/compute_v1/services/region_target_https_proxies/transports/rest.py +++ b/google/cloud/compute_v1/services/region_target_https_proxies/transports/rest.py @@ -96,6 +96,13 @@ def pre_list(request, metadata): def post_list(response): logging.log(f"Received response: {response}") + def pre_patch(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_patch(response): + logging.log(f"Received response: {response}") + def pre_set_ssl_certificates(request, metadata): logging.log(f"Received request: {request}") return request, metadata @@ -202,6 +209,27 @@ def post_list( """ return response + def pre_patch( + self, + request: compute.PatchRegionTargetHttpsProxyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[compute.PatchRegionTargetHttpsProxyRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for patch + + Override in a subclass to manipulate the request or metadata + before they are sent to the RegionTargetHttpsProxies server. + """ + return request, metadata + + def post_patch(self, response: compute.Operation) -> compute.Operation: + """Post-rpc interceptor for patch + + Override in a subclass to manipulate the response + after it is returned by the RegionTargetHttpsProxies server but before + it is returned to user code. + """ + return response + def pre_set_ssl_certificates( self, request: compute.SetSslCertificatesRegionTargetHttpsProxyRequest, @@ -761,6 +789,118 @@ def __call__( resp = self._interceptor.post_list(resp) return resp + class _Patch(RegionTargetHttpsProxiesRestStub): + def __hash__(self): + return hash("Patch") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.PatchRegionTargetHttpsProxyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.Operation: + r"""Call the patch method over HTTP. + + Args: + request (~.compute.PatchRegionTargetHttpsProxyRequest): + The request object. A request message for + RegionTargetHttpsProxies.Patch. See the + method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.Operation: + Represents an Operation resource. Google Compute Engine + has three Operation resources: \* + `Global `__ + \* + `Regional `__ + \* + `Zonal `__ + You can use an operation resource to manage asynchronous + API requests. For more information, read Handling API + responses. Operations can be global, regional or zonal. + - For global operations, use the ``globalOperations`` + resource. - For regional operations, use the + ``regionOperations`` resource. - For zonal operations, + use the ``zonalOperations`` resource. For more + information, read Global, Regional, and Zonal Resources. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "patch", + "uri": "/compute/v1/projects/{project}/regions/{region}/targetHttpsProxies/{target_https_proxy}", + "body": "target_https_proxy_resource", + }, + ] + request, metadata = self._interceptor.pre_patch(request, metadata) + request_kwargs = compute.PatchRegionTargetHttpsProxyRequest.to_dict(request) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + # Jsonify the request body + body = compute.TargetHttpsProxy.to_json( + compute.TargetHttpsProxy(transcoded_request["body"]), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.PatchRegionTargetHttpsProxyRequest.to_json( + compute.PatchRegionTargetHttpsProxyRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.Operation.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_patch(resp) + return resp + class _SetSslCertificates(RegionTargetHttpsProxiesRestStub): def __hash__(self): return hash("SetSslCertificates") @@ -1051,6 +1191,20 @@ def list( # In C++ this would require a dynamic_cast return stub # type: ignore + @property + def patch( + self, + ) -> Callable[[compute.PatchRegionTargetHttpsProxyRequest], compute.Operation]: + stub = self._STUBS.get("patch") + if not stub: + stub = self._STUBS["patch"] = self._Patch( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + @property def set_ssl_certificates( self, diff --git a/google/cloud/compute_v1/services/security_policies/client.py b/google/cloud/compute_v1/services/security_policies/client.py index 4f8246b91..e966031e9 100644 --- a/google/cloud/compute_v1/services/security_policies/client.py +++ b/google/cloud/compute_v1/services/security_policies/client.py @@ -504,6 +504,88 @@ def add_rule_unary( # Done; return the response. return response + def aggregated_list( + self, + request: Union[compute.AggregatedListSecurityPoliciesRequest, dict] = None, + *, + project: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.AggregatedListPager: + r"""Retrieves the list of all SecurityPolicy resources, + regional and global, available to the specified project. + + Args: + request (Union[google.cloud.compute_v1.types.AggregatedListSecurityPoliciesRequest, dict]): + The request object. A request message for + SecurityPolicies.AggregatedList. See the method + description for details. + project (str): + Name of the project scoping this + request. + + This corresponds to the ``project`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.compute_v1.services.security_policies.pagers.AggregatedListPager: + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([project]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a compute.AggregatedListSecurityPoliciesRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, compute.AggregatedListSecurityPoliciesRequest): + request = compute.AggregatedListSecurityPoliciesRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project is not None: + request.project = project + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.aggregated_list] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.AggregatedListPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + def delete_unary( self, request: Union[compute.DeleteSecurityPolicyRequest, dict] = None, diff --git a/google/cloud/compute_v1/services/security_policies/pagers.py b/google/cloud/compute_v1/services/security_policies/pagers.py index 2493f5265..5e29a1e19 100644 --- a/google/cloud/compute_v1/services/security_policies/pagers.py +++ b/google/cloud/compute_v1/services/security_policies/pagers.py @@ -27,6 +27,71 @@ from google.cloud.compute_v1.types import compute +class AggregatedListPager: + """A pager for iterating through ``aggregated_list`` requests. + + This class thinly wraps an initial + :class:`google.cloud.compute_v1.types.SecurityPoliciesAggregatedList` object, and + provides an ``__iter__`` method to iterate through its + ``items`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``AggregatedList`` requests and continue to iterate + through the ``items`` field on the + corresponding responses. + + All the usual :class:`google.cloud.compute_v1.types.SecurityPoliciesAggregatedList` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., compute.SecurityPoliciesAggregatedList], + request: compute.AggregatedListSecurityPoliciesRequest, + response: compute.SecurityPoliciesAggregatedList, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.compute_v1.types.AggregatedListSecurityPoliciesRequest): + The initial request object. + response (google.cloud.compute_v1.types.SecurityPoliciesAggregatedList): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = compute.AggregatedListSecurityPoliciesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[compute.SecurityPoliciesAggregatedList]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[Tuple[str, compute.SecurityPoliciesScopedList]]: + for page in self.pages: + yield from page.items.items() + + def get(self, key: str) -> Optional[compute.SecurityPoliciesScopedList]: + return self._response.items.get(key) + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + class ListPager: """A pager for iterating through ``list`` requests. diff --git a/google/cloud/compute_v1/services/security_policies/transports/base.py b/google/cloud/compute_v1/services/security_policies/transports/base.py index 9aab08c50..8d580ed16 100644 --- a/google/cloud/compute_v1/services/security_policies/transports/base.py +++ b/google/cloud/compute_v1/services/security_policies/transports/base.py @@ -128,6 +128,11 @@ def _prep_wrapped_messages(self, client_info): default_timeout=None, client_info=client_info, ), + self.aggregated_list: gapic_v1.method.wrap_method( + self.aggregated_list, + default_timeout=None, + client_info=client_info, + ), self.delete: gapic_v1.method.wrap_method( self.delete, default_timeout=None, @@ -193,6 +198,18 @@ def add_rule( ]: raise NotImplementedError() + @property + def aggregated_list( + self, + ) -> Callable[ + [compute.AggregatedListSecurityPoliciesRequest], + Union[ + compute.SecurityPoliciesAggregatedList, + Awaitable[compute.SecurityPoliciesAggregatedList], + ], + ]: + raise NotImplementedError() + @property def delete( self, diff --git a/google/cloud/compute_v1/services/security_policies/transports/rest.py b/google/cloud/compute_v1/services/security_policies/transports/rest.py index c99d6177e..3952a9796 100644 --- a/google/cloud/compute_v1/services/security_policies/transports/rest.py +++ b/google/cloud/compute_v1/services/security_policies/transports/rest.py @@ -75,6 +75,13 @@ def pre_add_rule(request, metadata): def post_add_rule(response): logging.log(f"Received response: {response}") + def pre_aggregated_list(request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_aggregated_list(response): + logging.log(f"Received response: {response}") + def pre_delete(request, metadata): logging.log(f"Received request: {request}") return request, metadata @@ -165,6 +172,31 @@ def post_add_rule(self, response: compute.Operation) -> compute.Operation: """ return response + def pre_aggregated_list( + self, + request: compute.AggregatedListSecurityPoliciesRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + compute.AggregatedListSecurityPoliciesRequest, Sequence[Tuple[str, str]] + ]: + """Pre-rpc interceptor for aggregated_list + + Override in a subclass to manipulate the request or metadata + before they are sent to the SecurityPolicies server. + """ + return request, metadata + + def post_aggregated_list( + self, response: compute.SecurityPoliciesAggregatedList + ) -> compute.SecurityPoliciesAggregatedList: + """Post-rpc interceptor for aggregated_list + + Override in a subclass to manipulate the response + after it is returned by the SecurityPolicies server but before + it is returned to user code. + """ + return response + def pre_delete( self, request: compute.DeleteSecurityPolicyRequest, @@ -571,6 +603,97 @@ def __call__( resp = self._interceptor.post_add_rule(resp) return resp + class _AggregatedList(SecurityPoliciesRestStub): + def __hash__(self): + return hash("AggregatedList") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: compute.AggregatedListSecurityPoliciesRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> compute.SecurityPoliciesAggregatedList: + r"""Call the aggregated list method over HTTP. + + Args: + request (~.compute.AggregatedListSecurityPoliciesRequest): + The request object. A request message for + SecurityPolicies.AggregatedList. See the + method description for details. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.compute.SecurityPoliciesAggregatedList: + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/compute/v1/projects/{project}/aggregated/securityPolicies", + }, + ] + request, metadata = self._interceptor.pre_aggregated_list(request, metadata) + request_kwargs = compute.AggregatedListSecurityPoliciesRequest.to_dict( + request + ) + transcoded_request = path_template.transcode(http_options, **request_kwargs) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + compute.AggregatedListSecurityPoliciesRequest.to_json( + compute.AggregatedListSecurityPoliciesRequest( + transcoded_request["query_params"] + ), + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + query_params.update(self._get_unset_required_fields(query_params)) + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = compute.SecurityPoliciesAggregatedList.from_json( + response.content, ignore_unknown_fields=True + ) + resp = self._interceptor.post_aggregated_list(resp) + return resp + class _Delete(SecurityPoliciesRestStub): def __hash__(self): return hash("Delete") @@ -1505,6 +1628,23 @@ def add_rule( # In C++ this would require a dynamic_cast return stub # type: ignore + @property + def aggregated_list( + self, + ) -> Callable[ + [compute.AggregatedListSecurityPoliciesRequest], + compute.SecurityPoliciesAggregatedList, + ]: + stub = self._STUBS.get("aggregated_list") + if not stub: + stub = self._STUBS["aggregated_list"] = self._AggregatedList( + self._session, self._host, self._interceptor + ) + + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return stub # type: ignore + @property def delete( self, diff --git a/google/cloud/compute_v1/types/__init__.py b/google/cloud/compute_v1/types/__init__.py index 582c57a93..5cac0d165 100644 --- a/google/cloud/compute_v1/types/__init__.py +++ b/google/cloud/compute_v1/types/__init__.py @@ -25,6 +25,8 @@ AccessConfig, AddAccessConfigInstanceRequest, AddAssociationFirewallPolicyRequest, + AddAssociationNetworkFirewallPolicyRequest, + AddAssociationRegionNetworkFirewallPolicyRequest, AddHealthCheckTargetPoolRequest, AddInstancesInstanceGroupRequest, AddInstanceTargetPoolRequest, @@ -38,6 +40,8 @@ AddressesScopedList, AddressList, AddRuleFirewallPolicyRequest, + AddRuleNetworkFirewallPolicyRequest, + AddRuleRegionNetworkFirewallPolicyRequest, AddRuleSecurityPolicyRequest, AddSignedUrlKeyBackendBucketRequest, AddSignedUrlKeyBackendServiceRequest, @@ -56,6 +60,7 @@ AggregatedListInstancesRequest, AggregatedListInterconnectAttachmentsRequest, AggregatedListMachineTypesRequest, + AggregatedListNetworkEdgeSecurityServicesRequest, AggregatedListNetworkEndpointGroupsRequest, AggregatedListNodeGroupsRequest, AggregatedListNodeTemplatesRequest, @@ -66,6 +71,7 @@ AggregatedListReservationsRequest, AggregatedListResourcePoliciesRequest, AggregatedListRoutersRequest, + AggregatedListSecurityPoliciesRequest, AggregatedListServiceAttachmentsRequest, AggregatedListSslCertificatesRequest, AggregatedListSubnetworksRequest, @@ -120,6 +126,9 @@ BackendServiceGroupHealth, BackendServiceIAP, BackendServiceList, + BackendServiceLocalityLoadBalancingPolicyConfig, + BackendServiceLocalityLoadBalancingPolicyConfigCustomPolicy, + BackendServiceLocalityLoadBalancingPolicyConfigPolicy, BackendServiceLogConfig, BackendServiceReference, BackendServicesScopedList, @@ -135,6 +144,8 @@ CacheKeyPolicy, CircuitBreakers, CloneRulesFirewallPolicyRequest, + CloneRulesNetworkFirewallPolicyRequest, + CloneRulesRegionNetworkFirewallPolicyRequest, Commitment, CommitmentAggregatedList, CommitmentList, @@ -182,7 +193,9 @@ DeleteInterconnectRequest, DeleteLicenseRequest, DeleteMachineImageRequest, + DeleteNetworkEdgeSecurityServiceRequest, DeleteNetworkEndpointGroupRequest, + DeleteNetworkFirewallPolicyRequest, DeleteNetworkRequest, DeleteNodeGroupRequest, DeleteNodesNodeGroupRequest, @@ -199,9 +212,11 @@ DeleteRegionHealthCheckServiceRequest, DeleteRegionInstanceGroupManagerRequest, DeleteRegionNetworkEndpointGroupRequest, + DeleteRegionNetworkFirewallPolicyRequest, DeleteRegionNotificationEndpointRequest, DeleteRegionOperationRequest, DeleteRegionOperationResponse, + DeleteRegionSecurityPolicyRequest, DeleteRegionSslCertificateRequest, DeleteRegionTargetHttpProxyRequest, DeleteRegionTargetHttpsProxyRequest, @@ -278,6 +293,7 @@ FirewallPolicyRule, FirewallPolicyRuleMatcher, FirewallPolicyRuleMatcherLayer4Config, + FirewallPolicyRuleSecureTag, FixedOrPercent, ForwardingRule, ForwardingRuleAggregatedList, @@ -288,6 +304,8 @@ GetAcceleratorTypeRequest, GetAddressRequest, GetAssociationFirewallPolicyRequest, + GetAssociationNetworkFirewallPolicyRequest, + GetAssociationRegionNetworkFirewallPolicyRequest, GetAutoscalerRequest, GetBackendBucketRequest, GetBackendServiceRequest, @@ -296,6 +314,7 @@ GetDiskTypeRequest, GetEffectiveFirewallsInstanceRequest, GetEffectiveFirewallsNetworkRequest, + GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest, GetExternalVpnGatewayRequest, GetFirewallPolicyRequest, GetFirewallRequest, @@ -319,9 +338,11 @@ GetIamPolicyInstanceTemplateRequest, GetIamPolicyLicenseRequest, GetIamPolicyMachineImageRequest, + GetIamPolicyNetworkFirewallPolicyRequest, GetIamPolicyNodeGroupRequest, GetIamPolicyNodeTemplateRequest, GetIamPolicyRegionDiskRequest, + GetIamPolicyRegionNetworkFirewallPolicyRequest, GetIamPolicyReservationRequest, GetIamPolicyResourcePolicyRequest, GetIamPolicyServiceAttachmentRequest, @@ -341,7 +362,9 @@ GetMachineImageRequest, GetMachineTypeRequest, GetNatMappingInfoRoutersRequest, + GetNetworkEdgeSecurityServiceRequest, GetNetworkEndpointGroupRequest, + GetNetworkFirewallPolicyRequest, GetNetworkRequest, GetNodeGroupRequest, GetNodeTemplateRequest, @@ -360,9 +383,11 @@ GetRegionInstanceGroupManagerRequest, GetRegionInstanceGroupRequest, GetRegionNetworkEndpointGroupRequest, + GetRegionNetworkFirewallPolicyRequest, GetRegionNotificationEndpointRequest, GetRegionOperationRequest, GetRegionRequest, + GetRegionSecurityPolicyRequest, GetRegionSslCertificateRequest, GetRegionTargetHttpProxyRequest, GetRegionTargetHttpsProxyRequest, @@ -373,6 +398,8 @@ GetRouterRequest, GetRouterStatusRouterRequest, GetRuleFirewallPolicyRequest, + GetRuleNetworkFirewallPolicyRequest, + GetRuleRegionNetworkFirewallPolicyRequest, GetRuleSecurityPolicyRequest, GetScreenshotInstanceRequest, GetSecurityPolicyRequest, @@ -463,7 +490,9 @@ InsertInterconnectRequest, InsertLicenseRequest, InsertMachineImageRequest, + InsertNetworkEdgeSecurityServiceRequest, InsertNetworkEndpointGroupRequest, + InsertNetworkFirewallPolicyRequest, InsertNetworkRequest, InsertNodeGroupRequest, InsertNodeTemplateRequest, @@ -478,7 +507,9 @@ InsertRegionHealthCheckServiceRequest, InsertRegionInstanceGroupManagerRequest, InsertRegionNetworkEndpointGroupRequest, + InsertRegionNetworkFirewallPolicyRequest, InsertRegionNotificationEndpointRequest, + InsertRegionSecurityPolicyRequest, InsertRegionSslCertificateRequest, InsertRegionTargetHttpProxyRequest, InsertRegionTargetHttpsProxyRequest, @@ -546,6 +577,7 @@ InstanceManagedByIgmErrorInstanceActionDetails, InstanceManagedByIgmErrorManagedInstanceError, InstanceMoveRequest, + InstanceParams, InstanceProperties, InstanceReference, InstancesAddResourcePoliciesRequest, @@ -630,6 +662,7 @@ ListNetworkEndpointGroupsRequest, ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest, ListNetworkEndpointsNetworkEndpointGroupsRequest, + ListNetworkFirewallPoliciesRequest, ListNetworksRequest, ListNodeGroupsRequest, ListNodesNodeGroupsRequest, @@ -653,8 +686,10 @@ ListRegionInstanceGroupManagersRequest, ListRegionInstanceGroupsRequest, ListRegionNetworkEndpointGroupsRequest, + ListRegionNetworkFirewallPoliciesRequest, ListRegionNotificationEndpointsRequest, ListRegionOperationsRequest, + ListRegionSecurityPoliciesRequest, ListRegionsRequest, ListRegionSslCertificatesRequest, ListRegionTargetHttpProxiesRequest, @@ -711,6 +746,9 @@ MoveInstanceProjectRequest, NamedPort, Network, + NetworkEdgeSecurityService, + NetworkEdgeSecurityServiceAggregatedList, + NetworkEdgeSecurityServicesScopedList, NetworkEndpoint, NetworkEndpointGroup, NetworkEndpointGroupAggregatedList, @@ -786,6 +824,8 @@ PatchInstanceGroupManagerRequest, PatchInterconnectAttachmentRequest, PatchInterconnectRequest, + PatchNetworkEdgeSecurityServiceRequest, + PatchNetworkFirewallPolicyRequest, PatchNetworkRequest, PatchNodeGroupRequest, PatchPacketMirroringRequest, @@ -798,9 +838,14 @@ PatchRegionHealthCheckRequest, PatchRegionHealthCheckServiceRequest, PatchRegionInstanceGroupManagerRequest, + PatchRegionNetworkFirewallPolicyRequest, + PatchRegionSecurityPolicyRequest, + PatchRegionTargetHttpsProxyRequest, PatchRegionUrlMapRequest, PatchRouterRequest, PatchRuleFirewallPolicyRequest, + PatchRuleNetworkFirewallPolicyRequest, + PatchRuleRegionNetworkFirewallPolicyRequest, PatchRuleSecurityPolicyRequest, PatchSecurityPolicyRequest, PatchServiceAttachmentRequest, @@ -862,11 +907,15 @@ RegionInstanceGroupsListInstancesRequest, RegionInstanceGroupsSetNamedPortsRequest, RegionList, + RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse, + RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponseEffectiveFirewallPolicy, RegionSetLabelsRequest, RegionSetPolicyRequest, RegionTargetHttpsProxiesSetSslCertificatesRequest, RegionUrlMapsValidateRequest, RemoveAssociationFirewallPolicyRequest, + RemoveAssociationNetworkFirewallPolicyRequest, + RemoveAssociationRegionNetworkFirewallPolicyRequest, RemoveHealthCheckTargetPoolRequest, RemoveInstancesInstanceGroupRequest, RemoveInstanceTargetPoolRequest, @@ -875,6 +924,8 @@ RemoveResourcePoliciesInstanceRequest, RemoveResourcePoliciesRegionDiskRequest, RemoveRuleFirewallPolicyRequest, + RemoveRuleNetworkFirewallPolicyRequest, + RemoveRuleRegionNetworkFirewallPolicyRequest, RemoveRuleSecurityPolicyRequest, RequestMirrorPolicy, Reservation, @@ -940,12 +991,15 @@ SchedulingNodeAffinity, ScratchDisks, Screenshot, + SecurityPoliciesAggregatedList, SecurityPoliciesListPreconfiguredExpressionSetsResponse, + SecurityPoliciesScopedList, SecurityPoliciesWafConfig, SecurityPolicy, SecurityPolicyAdaptiveProtectionConfig, SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfig, SecurityPolicyAdvancedOptionsConfig, + SecurityPolicyDdosProtectionConfig, SecurityPolicyList, SecurityPolicyRecaptchaOptionsConfig, SecurityPolicyReference, @@ -985,9 +1039,11 @@ SetIamPolicyInstanceTemplateRequest, SetIamPolicyLicenseRequest, SetIamPolicyMachineImageRequest, + SetIamPolicyNetworkFirewallPolicyRequest, SetIamPolicyNodeGroupRequest, SetIamPolicyNodeTemplateRequest, SetIamPolicyRegionDiskRequest, + SetIamPolicyRegionNetworkFirewallPolicyRequest, SetIamPolicyReservationRequest, SetIamPolicyResourcePolicyRequest, SetIamPolicyServiceAttachmentRequest, @@ -1127,10 +1183,12 @@ TestIamPermissionsLicenseRequest, TestIamPermissionsMachineImageRequest, TestIamPermissionsNetworkEndpointGroupRequest, + TestIamPermissionsNetworkFirewallPolicyRequest, TestIamPermissionsNodeGroupRequest, TestIamPermissionsNodeTemplateRequest, TestIamPermissionsPacketMirroringRequest, TestIamPermissionsRegionDiskRequest, + TestIamPermissionsRegionNetworkFirewallPolicyRequest, TestIamPermissionsReservationRequest, TestIamPermissionsResourcePolicyRequest, TestIamPermissionsServiceAttachmentRequest, @@ -1223,6 +1281,8 @@ "AccessConfig", "AddAccessConfigInstanceRequest", "AddAssociationFirewallPolicyRequest", + "AddAssociationNetworkFirewallPolicyRequest", + "AddAssociationRegionNetworkFirewallPolicyRequest", "AddHealthCheckTargetPoolRequest", "AddInstancesInstanceGroupRequest", "AddInstanceTargetPoolRequest", @@ -1236,6 +1296,8 @@ "AddressesScopedList", "AddressList", "AddRuleFirewallPolicyRequest", + "AddRuleNetworkFirewallPolicyRequest", + "AddRuleRegionNetworkFirewallPolicyRequest", "AddRuleSecurityPolicyRequest", "AddSignedUrlKeyBackendBucketRequest", "AddSignedUrlKeyBackendServiceRequest", @@ -1254,6 +1316,7 @@ "AggregatedListInstancesRequest", "AggregatedListInterconnectAttachmentsRequest", "AggregatedListMachineTypesRequest", + "AggregatedListNetworkEdgeSecurityServicesRequest", "AggregatedListNetworkEndpointGroupsRequest", "AggregatedListNodeGroupsRequest", "AggregatedListNodeTemplatesRequest", @@ -1264,6 +1327,7 @@ "AggregatedListReservationsRequest", "AggregatedListResourcePoliciesRequest", "AggregatedListRoutersRequest", + "AggregatedListSecurityPoliciesRequest", "AggregatedListServiceAttachmentsRequest", "AggregatedListSslCertificatesRequest", "AggregatedListSubnetworksRequest", @@ -1318,6 +1382,9 @@ "BackendServiceGroupHealth", "BackendServiceIAP", "BackendServiceList", + "BackendServiceLocalityLoadBalancingPolicyConfig", + "BackendServiceLocalityLoadBalancingPolicyConfigCustomPolicy", + "BackendServiceLocalityLoadBalancingPolicyConfigPolicy", "BackendServiceLogConfig", "BackendServiceReference", "BackendServicesScopedList", @@ -1333,6 +1400,8 @@ "CacheKeyPolicy", "CircuitBreakers", "CloneRulesFirewallPolicyRequest", + "CloneRulesNetworkFirewallPolicyRequest", + "CloneRulesRegionNetworkFirewallPolicyRequest", "Commitment", "CommitmentAggregatedList", "CommitmentList", @@ -1380,7 +1449,9 @@ "DeleteInterconnectRequest", "DeleteLicenseRequest", "DeleteMachineImageRequest", + "DeleteNetworkEdgeSecurityServiceRequest", "DeleteNetworkEndpointGroupRequest", + "DeleteNetworkFirewallPolicyRequest", "DeleteNetworkRequest", "DeleteNodeGroupRequest", "DeleteNodesNodeGroupRequest", @@ -1397,9 +1468,11 @@ "DeleteRegionHealthCheckServiceRequest", "DeleteRegionInstanceGroupManagerRequest", "DeleteRegionNetworkEndpointGroupRequest", + "DeleteRegionNetworkFirewallPolicyRequest", "DeleteRegionNotificationEndpointRequest", "DeleteRegionOperationRequest", "DeleteRegionOperationResponse", + "DeleteRegionSecurityPolicyRequest", "DeleteRegionSslCertificateRequest", "DeleteRegionTargetHttpProxyRequest", "DeleteRegionTargetHttpsProxyRequest", @@ -1476,6 +1549,7 @@ "FirewallPolicyRule", "FirewallPolicyRuleMatcher", "FirewallPolicyRuleMatcherLayer4Config", + "FirewallPolicyRuleSecureTag", "FixedOrPercent", "ForwardingRule", "ForwardingRuleAggregatedList", @@ -1486,6 +1560,8 @@ "GetAcceleratorTypeRequest", "GetAddressRequest", "GetAssociationFirewallPolicyRequest", + "GetAssociationNetworkFirewallPolicyRequest", + "GetAssociationRegionNetworkFirewallPolicyRequest", "GetAutoscalerRequest", "GetBackendBucketRequest", "GetBackendServiceRequest", @@ -1494,6 +1570,7 @@ "GetDiskTypeRequest", "GetEffectiveFirewallsInstanceRequest", "GetEffectiveFirewallsNetworkRequest", + "GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest", "GetExternalVpnGatewayRequest", "GetFirewallPolicyRequest", "GetFirewallRequest", @@ -1517,9 +1594,11 @@ "GetIamPolicyInstanceTemplateRequest", "GetIamPolicyLicenseRequest", "GetIamPolicyMachineImageRequest", + "GetIamPolicyNetworkFirewallPolicyRequest", "GetIamPolicyNodeGroupRequest", "GetIamPolicyNodeTemplateRequest", "GetIamPolicyRegionDiskRequest", + "GetIamPolicyRegionNetworkFirewallPolicyRequest", "GetIamPolicyReservationRequest", "GetIamPolicyResourcePolicyRequest", "GetIamPolicyServiceAttachmentRequest", @@ -1539,7 +1618,9 @@ "GetMachineImageRequest", "GetMachineTypeRequest", "GetNatMappingInfoRoutersRequest", + "GetNetworkEdgeSecurityServiceRequest", "GetNetworkEndpointGroupRequest", + "GetNetworkFirewallPolicyRequest", "GetNetworkRequest", "GetNodeGroupRequest", "GetNodeTemplateRequest", @@ -1558,9 +1639,11 @@ "GetRegionInstanceGroupManagerRequest", "GetRegionInstanceGroupRequest", "GetRegionNetworkEndpointGroupRequest", + "GetRegionNetworkFirewallPolicyRequest", "GetRegionNotificationEndpointRequest", "GetRegionOperationRequest", "GetRegionRequest", + "GetRegionSecurityPolicyRequest", "GetRegionSslCertificateRequest", "GetRegionTargetHttpProxyRequest", "GetRegionTargetHttpsProxyRequest", @@ -1571,6 +1654,8 @@ "GetRouterRequest", "GetRouterStatusRouterRequest", "GetRuleFirewallPolicyRequest", + "GetRuleNetworkFirewallPolicyRequest", + "GetRuleRegionNetworkFirewallPolicyRequest", "GetRuleSecurityPolicyRequest", "GetScreenshotInstanceRequest", "GetSecurityPolicyRequest", @@ -1661,7 +1746,9 @@ "InsertInterconnectRequest", "InsertLicenseRequest", "InsertMachineImageRequest", + "InsertNetworkEdgeSecurityServiceRequest", "InsertNetworkEndpointGroupRequest", + "InsertNetworkFirewallPolicyRequest", "InsertNetworkRequest", "InsertNodeGroupRequest", "InsertNodeTemplateRequest", @@ -1676,7 +1763,9 @@ "InsertRegionHealthCheckServiceRequest", "InsertRegionInstanceGroupManagerRequest", "InsertRegionNetworkEndpointGroupRequest", + "InsertRegionNetworkFirewallPolicyRequest", "InsertRegionNotificationEndpointRequest", + "InsertRegionSecurityPolicyRequest", "InsertRegionSslCertificateRequest", "InsertRegionTargetHttpProxyRequest", "InsertRegionTargetHttpsProxyRequest", @@ -1744,6 +1833,7 @@ "InstanceManagedByIgmErrorInstanceActionDetails", "InstanceManagedByIgmErrorManagedInstanceError", "InstanceMoveRequest", + "InstanceParams", "InstanceProperties", "InstanceReference", "InstancesAddResourcePoliciesRequest", @@ -1828,6 +1918,7 @@ "ListNetworkEndpointGroupsRequest", "ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest", "ListNetworkEndpointsNetworkEndpointGroupsRequest", + "ListNetworkFirewallPoliciesRequest", "ListNetworksRequest", "ListNodeGroupsRequest", "ListNodesNodeGroupsRequest", @@ -1851,8 +1942,10 @@ "ListRegionInstanceGroupManagersRequest", "ListRegionInstanceGroupsRequest", "ListRegionNetworkEndpointGroupsRequest", + "ListRegionNetworkFirewallPoliciesRequest", "ListRegionNotificationEndpointsRequest", "ListRegionOperationsRequest", + "ListRegionSecurityPoliciesRequest", "ListRegionsRequest", "ListRegionSslCertificatesRequest", "ListRegionTargetHttpProxiesRequest", @@ -1909,6 +2002,9 @@ "MoveInstanceProjectRequest", "NamedPort", "Network", + "NetworkEdgeSecurityService", + "NetworkEdgeSecurityServiceAggregatedList", + "NetworkEdgeSecurityServicesScopedList", "NetworkEndpoint", "NetworkEndpointGroup", "NetworkEndpointGroupAggregatedList", @@ -1984,6 +2080,8 @@ "PatchInstanceGroupManagerRequest", "PatchInterconnectAttachmentRequest", "PatchInterconnectRequest", + "PatchNetworkEdgeSecurityServiceRequest", + "PatchNetworkFirewallPolicyRequest", "PatchNetworkRequest", "PatchNodeGroupRequest", "PatchPacketMirroringRequest", @@ -1996,9 +2094,14 @@ "PatchRegionHealthCheckRequest", "PatchRegionHealthCheckServiceRequest", "PatchRegionInstanceGroupManagerRequest", + "PatchRegionNetworkFirewallPolicyRequest", + "PatchRegionSecurityPolicyRequest", + "PatchRegionTargetHttpsProxyRequest", "PatchRegionUrlMapRequest", "PatchRouterRequest", "PatchRuleFirewallPolicyRequest", + "PatchRuleNetworkFirewallPolicyRequest", + "PatchRuleRegionNetworkFirewallPolicyRequest", "PatchRuleSecurityPolicyRequest", "PatchSecurityPolicyRequest", "PatchServiceAttachmentRequest", @@ -2060,11 +2163,15 @@ "RegionInstanceGroupsListInstancesRequest", "RegionInstanceGroupsSetNamedPortsRequest", "RegionList", + "RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse", + "RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponseEffectiveFirewallPolicy", "RegionSetLabelsRequest", "RegionSetPolicyRequest", "RegionTargetHttpsProxiesSetSslCertificatesRequest", "RegionUrlMapsValidateRequest", "RemoveAssociationFirewallPolicyRequest", + "RemoveAssociationNetworkFirewallPolicyRequest", + "RemoveAssociationRegionNetworkFirewallPolicyRequest", "RemoveHealthCheckTargetPoolRequest", "RemoveInstancesInstanceGroupRequest", "RemoveInstanceTargetPoolRequest", @@ -2073,6 +2180,8 @@ "RemoveResourcePoliciesInstanceRequest", "RemoveResourcePoliciesRegionDiskRequest", "RemoveRuleFirewallPolicyRequest", + "RemoveRuleNetworkFirewallPolicyRequest", + "RemoveRuleRegionNetworkFirewallPolicyRequest", "RemoveRuleSecurityPolicyRequest", "RequestMirrorPolicy", "Reservation", @@ -2138,12 +2247,15 @@ "SchedulingNodeAffinity", "ScratchDisks", "Screenshot", + "SecurityPoliciesAggregatedList", "SecurityPoliciesListPreconfiguredExpressionSetsResponse", + "SecurityPoliciesScopedList", "SecurityPoliciesWafConfig", "SecurityPolicy", "SecurityPolicyAdaptiveProtectionConfig", "SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfig", "SecurityPolicyAdvancedOptionsConfig", + "SecurityPolicyDdosProtectionConfig", "SecurityPolicyList", "SecurityPolicyRecaptchaOptionsConfig", "SecurityPolicyReference", @@ -2183,9 +2295,11 @@ "SetIamPolicyInstanceTemplateRequest", "SetIamPolicyLicenseRequest", "SetIamPolicyMachineImageRequest", + "SetIamPolicyNetworkFirewallPolicyRequest", "SetIamPolicyNodeGroupRequest", "SetIamPolicyNodeTemplateRequest", "SetIamPolicyRegionDiskRequest", + "SetIamPolicyRegionNetworkFirewallPolicyRequest", "SetIamPolicyReservationRequest", "SetIamPolicyResourcePolicyRequest", "SetIamPolicyServiceAttachmentRequest", @@ -2325,10 +2439,12 @@ "TestIamPermissionsLicenseRequest", "TestIamPermissionsMachineImageRequest", "TestIamPermissionsNetworkEndpointGroupRequest", + "TestIamPermissionsNetworkFirewallPolicyRequest", "TestIamPermissionsNodeGroupRequest", "TestIamPermissionsNodeTemplateRequest", "TestIamPermissionsPacketMirroringRequest", "TestIamPermissionsRegionDiskRequest", + "TestIamPermissionsRegionNetworkFirewallPolicyRequest", "TestIamPermissionsReservationRequest", "TestIamPermissionsResourcePolicyRequest", "TestIamPermissionsServiceAttachmentRequest", diff --git a/google/cloud/compute_v1/types/compute.py b/google/cloud/compute_v1/types/compute.py index bd618af4e..05fc80163 100644 --- a/google/cloud/compute_v1/types/compute.py +++ b/google/cloud/compute_v1/types/compute.py @@ -30,6 +30,8 @@ "AccessConfig", "AddAccessConfigInstanceRequest", "AddAssociationFirewallPolicyRequest", + "AddAssociationNetworkFirewallPolicyRequest", + "AddAssociationRegionNetworkFirewallPolicyRequest", "AddHealthCheckTargetPoolRequest", "AddInstanceTargetPoolRequest", "AddInstancesInstanceGroupRequest", @@ -39,6 +41,8 @@ "AddResourcePoliciesInstanceRequest", "AddResourcePoliciesRegionDiskRequest", "AddRuleFirewallPolicyRequest", + "AddRuleNetworkFirewallPolicyRequest", + "AddRuleRegionNetworkFirewallPolicyRequest", "AddRuleSecurityPolicyRequest", "AddSignedUrlKeyBackendBucketRequest", "AddSignedUrlKeyBackendServiceRequest", @@ -61,6 +65,7 @@ "AggregatedListInstancesRequest", "AggregatedListInterconnectAttachmentsRequest", "AggregatedListMachineTypesRequest", + "AggregatedListNetworkEdgeSecurityServicesRequest", "AggregatedListNetworkEndpointGroupsRequest", "AggregatedListNodeGroupsRequest", "AggregatedListNodeTemplatesRequest", @@ -71,6 +76,7 @@ "AggregatedListReservationsRequest", "AggregatedListResourcePoliciesRequest", "AggregatedListRoutersRequest", + "AggregatedListSecurityPoliciesRequest", "AggregatedListServiceAttachmentsRequest", "AggregatedListSslCertificatesRequest", "AggregatedListSubnetworksRequest", @@ -125,6 +131,9 @@ "BackendServiceGroupHealth", "BackendServiceIAP", "BackendServiceList", + "BackendServiceLocalityLoadBalancingPolicyConfig", + "BackendServiceLocalityLoadBalancingPolicyConfigCustomPolicy", + "BackendServiceLocalityLoadBalancingPolicyConfigPolicy", "BackendServiceLogConfig", "BackendServiceReference", "BackendServicesScopedList", @@ -140,6 +149,8 @@ "CacheKeyPolicy", "CircuitBreakers", "CloneRulesFirewallPolicyRequest", + "CloneRulesNetworkFirewallPolicyRequest", + "CloneRulesRegionNetworkFirewallPolicyRequest", "Commitment", "CommitmentAggregatedList", "CommitmentList", @@ -187,7 +198,9 @@ "DeleteInterconnectRequest", "DeleteLicenseRequest", "DeleteMachineImageRequest", + "DeleteNetworkEdgeSecurityServiceRequest", "DeleteNetworkEndpointGroupRequest", + "DeleteNetworkFirewallPolicyRequest", "DeleteNetworkRequest", "DeleteNodeGroupRequest", "DeleteNodeTemplateRequest", @@ -204,9 +217,11 @@ "DeleteRegionHealthCheckServiceRequest", "DeleteRegionInstanceGroupManagerRequest", "DeleteRegionNetworkEndpointGroupRequest", + "DeleteRegionNetworkFirewallPolicyRequest", "DeleteRegionNotificationEndpointRequest", "DeleteRegionOperationRequest", "DeleteRegionOperationResponse", + "DeleteRegionSecurityPolicyRequest", "DeleteRegionSslCertificateRequest", "DeleteRegionTargetHttpProxyRequest", "DeleteRegionTargetHttpsProxyRequest", @@ -283,6 +298,7 @@ "FirewallPolicyRule", "FirewallPolicyRuleMatcher", "FirewallPolicyRuleMatcherLayer4Config", + "FirewallPolicyRuleSecureTag", "FixedOrPercent", "ForwardingRule", "ForwardingRuleAggregatedList", @@ -294,6 +310,8 @@ "GetAcceleratorTypeRequest", "GetAddressRequest", "GetAssociationFirewallPolicyRequest", + "GetAssociationNetworkFirewallPolicyRequest", + "GetAssociationRegionNetworkFirewallPolicyRequest", "GetAutoscalerRequest", "GetBackendBucketRequest", "GetBackendServiceRequest", @@ -302,6 +320,7 @@ "GetDiskTypeRequest", "GetEffectiveFirewallsInstanceRequest", "GetEffectiveFirewallsNetworkRequest", + "GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest", "GetExternalVpnGatewayRequest", "GetFirewallPolicyRequest", "GetFirewallRequest", @@ -325,9 +344,11 @@ "GetIamPolicyInstanceTemplateRequest", "GetIamPolicyLicenseRequest", "GetIamPolicyMachineImageRequest", + "GetIamPolicyNetworkFirewallPolicyRequest", "GetIamPolicyNodeGroupRequest", "GetIamPolicyNodeTemplateRequest", "GetIamPolicyRegionDiskRequest", + "GetIamPolicyRegionNetworkFirewallPolicyRequest", "GetIamPolicyReservationRequest", "GetIamPolicyResourcePolicyRequest", "GetIamPolicyServiceAttachmentRequest", @@ -347,7 +368,9 @@ "GetMachineImageRequest", "GetMachineTypeRequest", "GetNatMappingInfoRoutersRequest", + "GetNetworkEdgeSecurityServiceRequest", "GetNetworkEndpointGroupRequest", + "GetNetworkFirewallPolicyRequest", "GetNetworkRequest", "GetNodeGroupRequest", "GetNodeTemplateRequest", @@ -366,9 +389,11 @@ "GetRegionInstanceGroupManagerRequest", "GetRegionInstanceGroupRequest", "GetRegionNetworkEndpointGroupRequest", + "GetRegionNetworkFirewallPolicyRequest", "GetRegionNotificationEndpointRequest", "GetRegionOperationRequest", "GetRegionRequest", + "GetRegionSecurityPolicyRequest", "GetRegionSslCertificateRequest", "GetRegionTargetHttpProxyRequest", "GetRegionTargetHttpsProxyRequest", @@ -379,6 +404,8 @@ "GetRouterRequest", "GetRouterStatusRouterRequest", "GetRuleFirewallPolicyRequest", + "GetRuleNetworkFirewallPolicyRequest", + "GetRuleRegionNetworkFirewallPolicyRequest", "GetRuleSecurityPolicyRequest", "GetScreenshotInstanceRequest", "GetSecurityPolicyRequest", @@ -468,7 +495,9 @@ "InsertInterconnectRequest", "InsertLicenseRequest", "InsertMachineImageRequest", + "InsertNetworkEdgeSecurityServiceRequest", "InsertNetworkEndpointGroupRequest", + "InsertNetworkFirewallPolicyRequest", "InsertNetworkRequest", "InsertNodeGroupRequest", "InsertNodeTemplateRequest", @@ -483,7 +512,9 @@ "InsertRegionHealthCheckServiceRequest", "InsertRegionInstanceGroupManagerRequest", "InsertRegionNetworkEndpointGroupRequest", + "InsertRegionNetworkFirewallPolicyRequest", "InsertRegionNotificationEndpointRequest", + "InsertRegionSecurityPolicyRequest", "InsertRegionSslCertificateRequest", "InsertRegionTargetHttpProxyRequest", "InsertRegionTargetHttpsProxyRequest", @@ -551,6 +582,7 @@ "InstanceManagedByIgmErrorInstanceActionDetails", "InstanceManagedByIgmErrorManagedInstanceError", "InstanceMoveRequest", + "InstanceParams", "InstanceProperties", "InstanceReference", "InstanceTemplate", @@ -635,6 +667,7 @@ "ListNetworkEndpointGroupsRequest", "ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest", "ListNetworkEndpointsNetworkEndpointGroupsRequest", + "ListNetworkFirewallPoliciesRequest", "ListNetworksRequest", "ListNodeGroupsRequest", "ListNodeTemplatesRequest", @@ -658,8 +691,10 @@ "ListRegionInstanceGroupManagersRequest", "ListRegionInstanceGroupsRequest", "ListRegionNetworkEndpointGroupsRequest", + "ListRegionNetworkFirewallPoliciesRequest", "ListRegionNotificationEndpointsRequest", "ListRegionOperationsRequest", + "ListRegionSecurityPoliciesRequest", "ListRegionSslCertificatesRequest", "ListRegionTargetHttpProxiesRequest", "ListRegionTargetHttpsProxiesRequest", @@ -716,6 +751,9 @@ "MoveInstanceProjectRequest", "NamedPort", "Network", + "NetworkEdgeSecurityService", + "NetworkEdgeSecurityServiceAggregatedList", + "NetworkEdgeSecurityServicesScopedList", "NetworkEndpoint", "NetworkEndpointGroup", "NetworkEndpointGroupAggregatedList", @@ -791,6 +829,8 @@ "PatchInstanceGroupManagerRequest", "PatchInterconnectAttachmentRequest", "PatchInterconnectRequest", + "PatchNetworkEdgeSecurityServiceRequest", + "PatchNetworkFirewallPolicyRequest", "PatchNetworkRequest", "PatchNodeGroupRequest", "PatchPacketMirroringRequest", @@ -803,9 +843,14 @@ "PatchRegionHealthCheckRequest", "PatchRegionHealthCheckServiceRequest", "PatchRegionInstanceGroupManagerRequest", + "PatchRegionNetworkFirewallPolicyRequest", + "PatchRegionSecurityPolicyRequest", + "PatchRegionTargetHttpsProxyRequest", "PatchRegionUrlMapRequest", "PatchRouterRequest", "PatchRuleFirewallPolicyRequest", + "PatchRuleNetworkFirewallPolicyRequest", + "PatchRuleRegionNetworkFirewallPolicyRequest", "PatchRuleSecurityPolicyRequest", "PatchSecurityPolicyRequest", "PatchServiceAttachmentRequest", @@ -867,11 +912,15 @@ "RegionInstanceGroupsListInstancesRequest", "RegionInstanceGroupsSetNamedPortsRequest", "RegionList", + "RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse", + "RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponseEffectiveFirewallPolicy", "RegionSetLabelsRequest", "RegionSetPolicyRequest", "RegionTargetHttpsProxiesSetSslCertificatesRequest", "RegionUrlMapsValidateRequest", "RemoveAssociationFirewallPolicyRequest", + "RemoveAssociationNetworkFirewallPolicyRequest", + "RemoveAssociationRegionNetworkFirewallPolicyRequest", "RemoveHealthCheckTargetPoolRequest", "RemoveInstanceTargetPoolRequest", "RemoveInstancesInstanceGroupRequest", @@ -880,6 +929,8 @@ "RemoveResourcePoliciesInstanceRequest", "RemoveResourcePoliciesRegionDiskRequest", "RemoveRuleFirewallPolicyRequest", + "RemoveRuleNetworkFirewallPolicyRequest", + "RemoveRuleRegionNetworkFirewallPolicyRequest", "RemoveRuleSecurityPolicyRequest", "RequestMirrorPolicy", "Reservation", @@ -946,12 +997,15 @@ "SchedulingNodeAffinity", "ScratchDisks", "Screenshot", + "SecurityPoliciesAggregatedList", "SecurityPoliciesListPreconfiguredExpressionSetsResponse", + "SecurityPoliciesScopedList", "SecurityPoliciesWafConfig", "SecurityPolicy", "SecurityPolicyAdaptiveProtectionConfig", "SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfig", "SecurityPolicyAdvancedOptionsConfig", + "SecurityPolicyDdosProtectionConfig", "SecurityPolicyList", "SecurityPolicyRecaptchaOptionsConfig", "SecurityPolicyReference", @@ -991,9 +1045,11 @@ "SetIamPolicyInstanceTemplateRequest", "SetIamPolicyLicenseRequest", "SetIamPolicyMachineImageRequest", + "SetIamPolicyNetworkFirewallPolicyRequest", "SetIamPolicyNodeGroupRequest", "SetIamPolicyNodeTemplateRequest", "SetIamPolicyRegionDiskRequest", + "SetIamPolicyRegionNetworkFirewallPolicyRequest", "SetIamPolicyReservationRequest", "SetIamPolicyResourcePolicyRequest", "SetIamPolicyServiceAttachmentRequest", @@ -1132,10 +1188,12 @@ "TestIamPermissionsLicenseRequest", "TestIamPermissionsMachineImageRequest", "TestIamPermissionsNetworkEndpointGroupRequest", + "TestIamPermissionsNetworkFirewallPolicyRequest", "TestIamPermissionsNodeGroupRequest", "TestIamPermissionsNodeTemplateRequest", "TestIamPermissionsPacketMirroringRequest", "TestIamPermissionsRegionDiskRequest", + "TestIamPermissionsRegionNetworkFirewallPolicyRequest", "TestIamPermissionsReservationRequest", "TestIamPermissionsResourcePolicyRequest", "TestIamPermissionsServiceAttachmentRequest", @@ -1484,7 +1542,7 @@ class AcceleratorTypeAggregatedList(proto.Message): the server. This field is a member of `oneof`_ ``_id``. - items (Sequence[google.cloud.compute_v1.types.AcceleratorTypeAggregatedList.ItemsEntry]): + items (Mapping[str, google.cloud.compute_v1.types.AcceleratorTypesScopedList]): A list of AcceleratorTypesScopedList resources. kind (str): @@ -1955,6 +2013,140 @@ class AddAssociationFirewallPolicyRequest(proto.Message): ) +class AddAssociationNetworkFirewallPolicyRequest(proto.Message): + r"""A request message for NetworkFirewallPolicies.AddAssociation. + See the method description for details. + + Attributes: + firewall_policy (str): + Name of the firewall policy to update. + firewall_policy_association_resource (google.cloud.compute_v1.types.FirewallPolicyAssociation): + The body resource for this request + project (str): + Project ID for this request. + replace_existing_association (bool): + Indicates whether or not to replace it if an + association of the attachment already exists. + This is false by default, in which case an error + will be returned if an association already + exists. + + This field is a member of `oneof`_ ``_replace_existing_association``. + request_id (str): + An optional request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. For example, consider a situation + where you make an initial request and the + request times out. If you make the request again + with the same request ID, the server can check + if original operation with the same request ID + was received, and if so, will ignore the second + request. This prevents clients from accidentally + creating duplicate commitments. The request ID + must be a valid UUID with the exception that + zero UUID is not supported ( + 00000000-0000-0000-0000-000000000000). + + This field is a member of `oneof`_ ``_request_id``. + """ + + firewall_policy = proto.Field( + proto.STRING, + number=498173265, + ) + firewall_policy_association_resource = proto.Field( + proto.MESSAGE, + number=259546170, + message="FirewallPolicyAssociation", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + replace_existing_association = proto.Field( + proto.BOOL, + number=209541240, + optional=True, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + + +class AddAssociationRegionNetworkFirewallPolicyRequest(proto.Message): + r"""A request message for + RegionNetworkFirewallPolicies.AddAssociation. See the method + description for details. + + Attributes: + firewall_policy (str): + Name of the firewall policy to update. + firewall_policy_association_resource (google.cloud.compute_v1.types.FirewallPolicyAssociation): + The body resource for this request + project (str): + Project ID for this request. + region (str): + Name of the region scoping this request. + replace_existing_association (bool): + Indicates whether or not to replace it if an + association already exists. This is false by + default, in which case an error will be returned + if an association already exists. + + This field is a member of `oneof`_ ``_replace_existing_association``. + request_id (str): + An optional request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. For example, consider a situation + where you make an initial request and the + request times out. If you make the request again + with the same request ID, the server can check + if original operation with the same request ID + was received, and if so, will ignore the second + request. This prevents clients from accidentally + creating duplicate commitments. The request ID + must be a valid UUID with the exception that + zero UUID is not supported ( + 00000000-0000-0000-0000-000000000000). + + This field is a member of `oneof`_ ``_request_id``. + """ + + firewall_policy = proto.Field( + proto.STRING, + number=498173265, + ) + firewall_policy_association_resource = proto.Field( + proto.MESSAGE, + number=259546170, + message="FirewallPolicyAssociation", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + replace_existing_association = proto.Field( + proto.BOOL, + number=209541240, + optional=True, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + + class AddHealthCheckTargetPoolRequest(proto.Message): r"""A request message for TargetPools.AddHealthCheck. See the method description for details. @@ -2455,6 +2647,162 @@ class AddRuleFirewallPolicyRequest(proto.Message): ) +class AddRuleNetworkFirewallPolicyRequest(proto.Message): + r"""A request message for NetworkFirewallPolicies.AddRule. See + the method description for details. + + Attributes: + firewall_policy (str): + Name of the firewall policy to update. + firewall_policy_rule_resource (google.cloud.compute_v1.types.FirewallPolicyRule): + The body resource for this request + max_priority (int): + When rule.priority is not specified, auto + choose a unused priority between minPriority and + maxPriority>. This field is exclusive with + rule.priority. + + This field is a member of `oneof`_ ``_max_priority``. + min_priority (int): + When rule.priority is not specified, auto + choose a unused priority between minPriority and + maxPriority>. This field is exclusive with + rule.priority. + + This field is a member of `oneof`_ ``_min_priority``. + project (str): + Project ID for this request. + request_id (str): + An optional request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. For example, consider a situation + where you make an initial request and the + request times out. If you make the request again + with the same request ID, the server can check + if original operation with the same request ID + was received, and if so, will ignore the second + request. This prevents clients from accidentally + creating duplicate commitments. The request ID + must be a valid UUID with the exception that + zero UUID is not supported ( + 00000000-0000-0000-0000-000000000000). + + This field is a member of `oneof`_ ``_request_id``. + """ + + firewall_policy = proto.Field( + proto.STRING, + number=498173265, + ) + firewall_policy_rule_resource = proto.Field( + proto.MESSAGE, + number=250523523, + message="FirewallPolicyRule", + ) + max_priority = proto.Field( + proto.INT32, + number=329635359, + optional=True, + ) + min_priority = proto.Field( + proto.INT32, + number=267190513, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + + +class AddRuleRegionNetworkFirewallPolicyRequest(proto.Message): + r"""A request message for RegionNetworkFirewallPolicies.AddRule. + See the method description for details. + + Attributes: + firewall_policy (str): + Name of the firewall policy to update. + firewall_policy_rule_resource (google.cloud.compute_v1.types.FirewallPolicyRule): + The body resource for this request + max_priority (int): + When rule.priority is not specified, auto + choose a unused priority between minPriority and + maxPriority>. This field is exclusive with + rule.priority. + + This field is a member of `oneof`_ ``_max_priority``. + min_priority (int): + When rule.priority is not specified, auto + choose a unused priority between minPriority and + maxPriority>. This field is exclusive with + rule.priority. + + This field is a member of `oneof`_ ``_min_priority``. + project (str): + Project ID for this request. + region (str): + Name of the region scoping this request. + request_id (str): + An optional request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. For example, consider a situation + where you make an initial request and the + request times out. If you make the request again + with the same request ID, the server can check + if original operation with the same request ID + was received, and if so, will ignore the second + request. This prevents clients from accidentally + creating duplicate commitments. The request ID + must be a valid UUID with the exception that + zero UUID is not supported ( + 00000000-0000-0000-0000-000000000000). + + This field is a member of `oneof`_ ``_request_id``. + """ + + firewall_policy = proto.Field( + proto.STRING, + number=498173265, + ) + firewall_policy_rule_resource = proto.Field( + proto.MESSAGE, + number=250523523, + message="FirewallPolicyRule", + ) + max_priority = proto.Field( + proto.INT32, + number=329635359, + optional=True, + ) + min_priority = proto.Field( + proto.INT32, + number=267190513, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + + class AddRuleSecurityPolicyRequest(proto.Message): r"""A request message for SecurityPolicies.AddRule. See the method description for details. @@ -2898,7 +3246,7 @@ class AddressAggregatedList(proto.Message): the server. This field is a member of `oneof`_ ``_id``. - items (Sequence[google.cloud.compute_v1.types.AddressAggregatedList.ItemsEntry]): + items (Mapping[str, google.cloud.compute_v1.types.AddressesScopedList]): A list of AddressesScopedList resources. kind (str): [Output Only] Type of resource. Always @@ -4793,9 +5141,10 @@ class AggregatedListMachineTypesRequest(proto.Message): ) -class AggregatedListNetworkEndpointGroupsRequest(proto.Message): - r"""A request message for NetworkEndpointGroups.AggregatedList. - See the method description for details. +class AggregatedListNetworkEdgeSecurityServicesRequest(proto.Message): + r"""A request message for + NetworkEdgeSecurityServices.AggregatedList. See the method + description for details. Attributes: filter (str): @@ -4868,7 +5217,7 @@ class AggregatedListNetworkEndpointGroupsRequest(proto.Message): This field is a member of `oneof`_ ``_page_token``. project (str): - Project ID for this request. + Name of the project scoping this request. return_partial_success (bool): Opt-in for partial success behavior which provides partial results in case of failure. The @@ -4913,9 +5262,9 @@ class AggregatedListNetworkEndpointGroupsRequest(proto.Message): ) -class AggregatedListNodeGroupsRequest(proto.Message): - r"""A request message for NodeGroups.AggregatedList. See the - method description for details. +class AggregatedListNetworkEndpointGroupsRequest(proto.Message): + r"""A request message for NetworkEndpointGroups.AggregatedList. + See the method description for details. Attributes: filter (str): @@ -5033,8 +5382,8 @@ class AggregatedListNodeGroupsRequest(proto.Message): ) -class AggregatedListNodeTemplatesRequest(proto.Message): - r"""A request message for NodeTemplates.AggregatedList. See the +class AggregatedListNodeGroupsRequest(proto.Message): + r"""A request message for NodeGroups.AggregatedList. See the method description for details. Attributes: @@ -5153,8 +5502,8 @@ class AggregatedListNodeTemplatesRequest(proto.Message): ) -class AggregatedListNodeTypesRequest(proto.Message): - r"""A request message for NodeTypes.AggregatedList. See the +class AggregatedListNodeTemplatesRequest(proto.Message): + r"""A request message for NodeTemplates.AggregatedList. See the method description for details. Attributes: @@ -5273,9 +5622,9 @@ class AggregatedListNodeTypesRequest(proto.Message): ) -class AggregatedListPacketMirroringsRequest(proto.Message): - r"""A request message for PacketMirrorings.AggregatedList. See - the method description for details. +class AggregatedListNodeTypesRequest(proto.Message): + r"""A request message for NodeTypes.AggregatedList. See the + method description for details. Attributes: filter (str): @@ -5393,128 +5742,8 @@ class AggregatedListPacketMirroringsRequest(proto.Message): ) -class AggregatedListPublicDelegatedPrefixesRequest(proto.Message): - r"""A request message for PublicDelegatedPrefixes.AggregatedList. - See the method description for details. - - Attributes: - filter (str): - A filter expression that filters resources listed in the - response. The expression must specify the field name, an - operator, and the value that you want to use for filtering. - The value must be a string, a number, or a boolean. The - operator must be either ``=``, ``!=``, ``>``, ``<``, ``<=``, - ``>=`` or ``:``. For example, if you are filtering Compute - Engine instances, you can exclude instances named - ``example-instance`` by specifying - ``name != example-instance``. The ``:`` operator can be used - with string fields to match substrings. For non-string - fields it is equivalent to the ``=`` operator. The ``:*`` - comparison can be used to test whether a key has been - defined. For example, to find all objects with ``owner`` - label use: ``labels.owner:*`` You can also filter nested - fields. For example, you could specify - ``scheduling.automaticRestart = false`` to include instances - only if they are not scheduled for automatic restarts. You - can use filtering on nested fields to filter based on - resource labels. To filter on multiple expressions, provide - each separate expression within parentheses. For example: - ``(scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake")`` - By default, each expression is an ``AND`` expression. - However, you can include ``AND`` and ``OR`` expressions - explicitly. For example: - ``(cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true)`` - - This field is a member of `oneof`_ ``_filter``. - include_all_scopes (bool): - Indicates whether every visible scope for - each scope type (zone, region, global) should be - included in the response. For new resource types - added after this field, the flag has no effect - as new resource types will always include every - visible scope for each scope type in response. - For resource types which predate this field, if - this flag is omitted or false, only scopes of - the scope types where the resource type is - expected to be found will be included. - - This field is a member of `oneof`_ ``_include_all_scopes``. - max_results (int): - The maximum number of results per page that should be - returned. If the number of available results is larger than - ``maxResults``, Compute Engine returns a ``nextPageToken`` - that can be used to get the next page of results in - subsequent list requests. Acceptable values are ``0`` to - ``500``, inclusive. (Default: ``500``) - - This field is a member of `oneof`_ ``_max_results``. - order_by (str): - Sorts list results by a certain order. By default, results - are returned in alphanumerical order based on the resource - name. You can also sort results in descending order based on - the creation timestamp using - ``orderBy="creationTimestamp desc"``. This sorts results - based on the ``creationTimestamp`` field in reverse - chronological order (newest result first). Use this to sort - resources like operations so that the newest operation is - returned first. Currently, only sorting by ``name`` or - ``creationTimestamp desc`` is supported. - - This field is a member of `oneof`_ ``_order_by``. - page_token (str): - Specifies a page token to use. Set ``pageToken`` to the - ``nextPageToken`` returned by a previous list request to get - the next page of results. - - This field is a member of `oneof`_ ``_page_token``. - project (str): - Name of the project scoping this request. - return_partial_success (bool): - Opt-in for partial success behavior which - provides partial results in case of failure. The - default value is false. - - This field is a member of `oneof`_ ``_return_partial_success``. - """ - - filter = proto.Field( - proto.STRING, - number=336120696, - optional=True, - ) - include_all_scopes = proto.Field( - proto.BOOL, - number=391327988, - optional=True, - ) - max_results = proto.Field( - proto.UINT32, - number=54715419, - optional=True, - ) - order_by = proto.Field( - proto.STRING, - number=160562920, - optional=True, - ) - page_token = proto.Field( - proto.STRING, - number=19994697, - optional=True, - ) - project = proto.Field( - proto.STRING, - number=227560217, - ) - return_partial_success = proto.Field( - proto.BOOL, - number=517198390, - optional=True, - ) - - -class AggregatedListRegionCommitmentsRequest(proto.Message): - r"""A request message for RegionCommitments.AggregatedList. See +class AggregatedListPacketMirroringsRequest(proto.Message): + r"""A request message for PacketMirrorings.AggregatedList. See the method description for details. Attributes: @@ -5633,9 +5862,9 @@ class AggregatedListRegionCommitmentsRequest(proto.Message): ) -class AggregatedListReservationsRequest(proto.Message): - r"""A request message for Reservations.AggregatedList. See the - method description for details. +class AggregatedListPublicDelegatedPrefixesRequest(proto.Message): + r"""A request message for PublicDelegatedPrefixes.AggregatedList. + See the method description for details. Attributes: filter (str): @@ -5708,7 +5937,7 @@ class AggregatedListReservationsRequest(proto.Message): This field is a member of `oneof`_ ``_page_token``. project (str): - Project ID for this request. + Name of the project scoping this request. return_partial_success (bool): Opt-in for partial success behavior which provides partial results in case of failure. The @@ -5753,8 +5982,8 @@ class AggregatedListReservationsRequest(proto.Message): ) -class AggregatedListResourcePoliciesRequest(proto.Message): - r"""A request message for ResourcePolicies.AggregatedList. See +class AggregatedListRegionCommitmentsRequest(proto.Message): + r"""A request message for RegionCommitments.AggregatedList. See the method description for details. Attributes: @@ -5873,9 +6102,9 @@ class AggregatedListResourcePoliciesRequest(proto.Message): ) -class AggregatedListRoutersRequest(proto.Message): - r"""A request message for Routers.AggregatedList. See the method - description for details. +class AggregatedListReservationsRequest(proto.Message): + r"""A request message for Reservations.AggregatedList. See the + method description for details. Attributes: filter (str): @@ -5993,129 +6222,9 @@ class AggregatedListRoutersRequest(proto.Message): ) -class AggregatedListServiceAttachmentsRequest(proto.Message): - r"""A request message for ServiceAttachments.AggregatedList. See - the method description for details. - - Attributes: - filter (str): - A filter expression that filters resources listed in the - response. The expression must specify the field name, an - operator, and the value that you want to use for filtering. - The value must be a string, a number, or a boolean. The - operator must be either ``=``, ``!=``, ``>``, ``<``, ``<=``, - ``>=`` or ``:``. For example, if you are filtering Compute - Engine instances, you can exclude instances named - ``example-instance`` by specifying - ``name != example-instance``. The ``:`` operator can be used - with string fields to match substrings. For non-string - fields it is equivalent to the ``=`` operator. The ``:*`` - comparison can be used to test whether a key has been - defined. For example, to find all objects with ``owner`` - label use: ``labels.owner:*`` You can also filter nested - fields. For example, you could specify - ``scheduling.automaticRestart = false`` to include instances - only if they are not scheduled for automatic restarts. You - can use filtering on nested fields to filter based on - resource labels. To filter on multiple expressions, provide - each separate expression within parentheses. For example: - ``(scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake")`` - By default, each expression is an ``AND`` expression. - However, you can include ``AND`` and ``OR`` expressions - explicitly. For example: - ``(cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true)`` - - This field is a member of `oneof`_ ``_filter``. - include_all_scopes (bool): - Indicates whether every visible scope for - each scope type (zone, region, global) should be - included in the response. For new resource types - added after this field, the flag has no effect - as new resource types will always include every - visible scope for each scope type in response. - For resource types which predate this field, if - this flag is omitted or false, only scopes of - the scope types where the resource type is - expected to be found will be included. - - This field is a member of `oneof`_ ``_include_all_scopes``. - max_results (int): - The maximum number of results per page that should be - returned. If the number of available results is larger than - ``maxResults``, Compute Engine returns a ``nextPageToken`` - that can be used to get the next page of results in - subsequent list requests. Acceptable values are ``0`` to - ``500``, inclusive. (Default: ``500``) - - This field is a member of `oneof`_ ``_max_results``. - order_by (str): - Sorts list results by a certain order. By default, results - are returned in alphanumerical order based on the resource - name. You can also sort results in descending order based on - the creation timestamp using - ``orderBy="creationTimestamp desc"``. This sorts results - based on the ``creationTimestamp`` field in reverse - chronological order (newest result first). Use this to sort - resources like operations so that the newest operation is - returned first. Currently, only sorting by ``name`` or - ``creationTimestamp desc`` is supported. - - This field is a member of `oneof`_ ``_order_by``. - page_token (str): - Specifies a page token to use. Set ``pageToken`` to the - ``nextPageToken`` returned by a previous list request to get - the next page of results. - - This field is a member of `oneof`_ ``_page_token``. - project (str): - Name of the project scoping this request. - return_partial_success (bool): - Opt-in for partial success behavior which - provides partial results in case of failure. The - default value is false. - - This field is a member of `oneof`_ ``_return_partial_success``. - """ - - filter = proto.Field( - proto.STRING, - number=336120696, - optional=True, - ) - include_all_scopes = proto.Field( - proto.BOOL, - number=391327988, - optional=True, - ) - max_results = proto.Field( - proto.UINT32, - number=54715419, - optional=True, - ) - order_by = proto.Field( - proto.STRING, - number=160562920, - optional=True, - ) - page_token = proto.Field( - proto.STRING, - number=19994697, - optional=True, - ) - project = proto.Field( - proto.STRING, - number=227560217, - ) - return_partial_success = proto.Field( - proto.BOOL, - number=517198390, - optional=True, - ) - - -class AggregatedListSslCertificatesRequest(proto.Message): - r"""A request message for SslCertificates.AggregatedList. See the - method description for details. +class AggregatedListResourcePoliciesRequest(proto.Message): + r"""A request message for ResourcePolicies.AggregatedList. See + the method description for details. Attributes: filter (str): @@ -6188,7 +6297,7 @@ class AggregatedListSslCertificatesRequest(proto.Message): This field is a member of `oneof`_ ``_page_token``. project (str): - Name of the project scoping this request. + Project ID for this request. return_partial_success (bool): Opt-in for partial success behavior which provides partial results in case of failure. The @@ -6233,9 +6342,9 @@ class AggregatedListSslCertificatesRequest(proto.Message): ) -class AggregatedListSubnetworksRequest(proto.Message): - r"""A request message for Subnetworks.AggregatedList. See the - method description for details. +class AggregatedListRoutersRequest(proto.Message): + r"""A request message for Routers.AggregatedList. See the method + description for details. Attributes: filter (str): @@ -6353,8 +6462,8 @@ class AggregatedListSubnetworksRequest(proto.Message): ) -class AggregatedListTargetHttpProxiesRequest(proto.Message): - r"""A request message for TargetHttpProxies.AggregatedList. See +class AggregatedListSecurityPoliciesRequest(proto.Message): + r"""A request message for SecurityPolicies.AggregatedList. See the method description for details. Attributes: @@ -6473,8 +6582,8 @@ class AggregatedListTargetHttpProxiesRequest(proto.Message): ) -class AggregatedListTargetHttpsProxiesRequest(proto.Message): - r"""A request message for TargetHttpsProxies.AggregatedList. See +class AggregatedListServiceAttachmentsRequest(proto.Message): + r"""A request message for ServiceAttachments.AggregatedList. See the method description for details. Attributes: @@ -6593,8 +6702,8 @@ class AggregatedListTargetHttpsProxiesRequest(proto.Message): ) -class AggregatedListTargetInstancesRequest(proto.Message): - r"""A request message for TargetInstances.AggregatedList. See the +class AggregatedListSslCertificatesRequest(proto.Message): + r"""A request message for SslCertificates.AggregatedList. See the method description for details. Attributes: @@ -6668,7 +6777,7 @@ class AggregatedListTargetInstancesRequest(proto.Message): This field is a member of `oneof`_ ``_page_token``. project (str): - Project ID for this request. + Name of the project scoping this request. return_partial_success (bool): Opt-in for partial success behavior which provides partial results in case of failure. The @@ -6713,8 +6822,8 @@ class AggregatedListTargetInstancesRequest(proto.Message): ) -class AggregatedListTargetPoolsRequest(proto.Message): - r"""A request message for TargetPools.AggregatedList. See the +class AggregatedListSubnetworksRequest(proto.Message): + r"""A request message for Subnetworks.AggregatedList. See the method description for details. Attributes: @@ -6833,8 +6942,488 @@ class AggregatedListTargetPoolsRequest(proto.Message): ) -class AggregatedListTargetVpnGatewaysRequest(proto.Message): - r"""A request message for TargetVpnGateways.AggregatedList. See +class AggregatedListTargetHttpProxiesRequest(proto.Message): + r"""A request message for TargetHttpProxies.AggregatedList. See + the method description for details. + + Attributes: + filter (str): + A filter expression that filters resources listed in the + response. The expression must specify the field name, an + operator, and the value that you want to use for filtering. + The value must be a string, a number, or a boolean. The + operator must be either ``=``, ``!=``, ``>``, ``<``, ``<=``, + ``>=`` or ``:``. For example, if you are filtering Compute + Engine instances, you can exclude instances named + ``example-instance`` by specifying + ``name != example-instance``. The ``:`` operator can be used + with string fields to match substrings. For non-string + fields it is equivalent to the ``=`` operator. The ``:*`` + comparison can be used to test whether a key has been + defined. For example, to find all objects with ``owner`` + label use: ``labels.owner:*`` You can also filter nested + fields. For example, you could specify + ``scheduling.automaticRestart = false`` to include instances + only if they are not scheduled for automatic restarts. You + can use filtering on nested fields to filter based on + resource labels. To filter on multiple expressions, provide + each separate expression within parentheses. For example: + ``(scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake")`` + By default, each expression is an ``AND`` expression. + However, you can include ``AND`` and ``OR`` expressions + explicitly. For example: + ``(cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true)`` + + This field is a member of `oneof`_ ``_filter``. + include_all_scopes (bool): + Indicates whether every visible scope for + each scope type (zone, region, global) should be + included in the response. For new resource types + added after this field, the flag has no effect + as new resource types will always include every + visible scope for each scope type in response. + For resource types which predate this field, if + this flag is omitted or false, only scopes of + the scope types where the resource type is + expected to be found will be included. + + This field is a member of `oneof`_ ``_include_all_scopes``. + max_results (int): + The maximum number of results per page that should be + returned. If the number of available results is larger than + ``maxResults``, Compute Engine returns a ``nextPageToken`` + that can be used to get the next page of results in + subsequent list requests. Acceptable values are ``0`` to + ``500``, inclusive. (Default: ``500``) + + This field is a member of `oneof`_ ``_max_results``. + order_by (str): + Sorts list results by a certain order. By default, results + are returned in alphanumerical order based on the resource + name. You can also sort results in descending order based on + the creation timestamp using + ``orderBy="creationTimestamp desc"``. This sorts results + based on the ``creationTimestamp`` field in reverse + chronological order (newest result first). Use this to sort + resources like operations so that the newest operation is + returned first. Currently, only sorting by ``name`` or + ``creationTimestamp desc`` is supported. + + This field is a member of `oneof`_ ``_order_by``. + page_token (str): + Specifies a page token to use. Set ``pageToken`` to the + ``nextPageToken`` returned by a previous list request to get + the next page of results. + + This field is a member of `oneof`_ ``_page_token``. + project (str): + Name of the project scoping this request. + return_partial_success (bool): + Opt-in for partial success behavior which + provides partial results in case of failure. The + default value is false. + + This field is a member of `oneof`_ ``_return_partial_success``. + """ + + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) + + +class AggregatedListTargetHttpsProxiesRequest(proto.Message): + r"""A request message for TargetHttpsProxies.AggregatedList. See + the method description for details. + + Attributes: + filter (str): + A filter expression that filters resources listed in the + response. The expression must specify the field name, an + operator, and the value that you want to use for filtering. + The value must be a string, a number, or a boolean. The + operator must be either ``=``, ``!=``, ``>``, ``<``, ``<=``, + ``>=`` or ``:``. For example, if you are filtering Compute + Engine instances, you can exclude instances named + ``example-instance`` by specifying + ``name != example-instance``. The ``:`` operator can be used + with string fields to match substrings. For non-string + fields it is equivalent to the ``=`` operator. The ``:*`` + comparison can be used to test whether a key has been + defined. For example, to find all objects with ``owner`` + label use: ``labels.owner:*`` You can also filter nested + fields. For example, you could specify + ``scheduling.automaticRestart = false`` to include instances + only if they are not scheduled for automatic restarts. You + can use filtering on nested fields to filter based on + resource labels. To filter on multiple expressions, provide + each separate expression within parentheses. For example: + ``(scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake")`` + By default, each expression is an ``AND`` expression. + However, you can include ``AND`` and ``OR`` expressions + explicitly. For example: + ``(cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true)`` + + This field is a member of `oneof`_ ``_filter``. + include_all_scopes (bool): + Indicates whether every visible scope for + each scope type (zone, region, global) should be + included in the response. For new resource types + added after this field, the flag has no effect + as new resource types will always include every + visible scope for each scope type in response. + For resource types which predate this field, if + this flag is omitted or false, only scopes of + the scope types where the resource type is + expected to be found will be included. + + This field is a member of `oneof`_ ``_include_all_scopes``. + max_results (int): + The maximum number of results per page that should be + returned. If the number of available results is larger than + ``maxResults``, Compute Engine returns a ``nextPageToken`` + that can be used to get the next page of results in + subsequent list requests. Acceptable values are ``0`` to + ``500``, inclusive. (Default: ``500``) + + This field is a member of `oneof`_ ``_max_results``. + order_by (str): + Sorts list results by a certain order. By default, results + are returned in alphanumerical order based on the resource + name. You can also sort results in descending order based on + the creation timestamp using + ``orderBy="creationTimestamp desc"``. This sorts results + based on the ``creationTimestamp`` field in reverse + chronological order (newest result first). Use this to sort + resources like operations so that the newest operation is + returned first. Currently, only sorting by ``name`` or + ``creationTimestamp desc`` is supported. + + This field is a member of `oneof`_ ``_order_by``. + page_token (str): + Specifies a page token to use. Set ``pageToken`` to the + ``nextPageToken`` returned by a previous list request to get + the next page of results. + + This field is a member of `oneof`_ ``_page_token``. + project (str): + Name of the project scoping this request. + return_partial_success (bool): + Opt-in for partial success behavior which + provides partial results in case of failure. The + default value is false. + + This field is a member of `oneof`_ ``_return_partial_success``. + """ + + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) + + +class AggregatedListTargetInstancesRequest(proto.Message): + r"""A request message for TargetInstances.AggregatedList. See the + method description for details. + + Attributes: + filter (str): + A filter expression that filters resources listed in the + response. The expression must specify the field name, an + operator, and the value that you want to use for filtering. + The value must be a string, a number, or a boolean. The + operator must be either ``=``, ``!=``, ``>``, ``<``, ``<=``, + ``>=`` or ``:``. For example, if you are filtering Compute + Engine instances, you can exclude instances named + ``example-instance`` by specifying + ``name != example-instance``. The ``:`` operator can be used + with string fields to match substrings. For non-string + fields it is equivalent to the ``=`` operator. The ``:*`` + comparison can be used to test whether a key has been + defined. For example, to find all objects with ``owner`` + label use: ``labels.owner:*`` You can also filter nested + fields. For example, you could specify + ``scheduling.automaticRestart = false`` to include instances + only if they are not scheduled for automatic restarts. You + can use filtering on nested fields to filter based on + resource labels. To filter on multiple expressions, provide + each separate expression within parentheses. For example: + ``(scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake")`` + By default, each expression is an ``AND`` expression. + However, you can include ``AND`` and ``OR`` expressions + explicitly. For example: + ``(cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true)`` + + This field is a member of `oneof`_ ``_filter``. + include_all_scopes (bool): + Indicates whether every visible scope for + each scope type (zone, region, global) should be + included in the response. For new resource types + added after this field, the flag has no effect + as new resource types will always include every + visible scope for each scope type in response. + For resource types which predate this field, if + this flag is omitted or false, only scopes of + the scope types where the resource type is + expected to be found will be included. + + This field is a member of `oneof`_ ``_include_all_scopes``. + max_results (int): + The maximum number of results per page that should be + returned. If the number of available results is larger than + ``maxResults``, Compute Engine returns a ``nextPageToken`` + that can be used to get the next page of results in + subsequent list requests. Acceptable values are ``0`` to + ``500``, inclusive. (Default: ``500``) + + This field is a member of `oneof`_ ``_max_results``. + order_by (str): + Sorts list results by a certain order. By default, results + are returned in alphanumerical order based on the resource + name. You can also sort results in descending order based on + the creation timestamp using + ``orderBy="creationTimestamp desc"``. This sorts results + based on the ``creationTimestamp`` field in reverse + chronological order (newest result first). Use this to sort + resources like operations so that the newest operation is + returned first. Currently, only sorting by ``name`` or + ``creationTimestamp desc`` is supported. + + This field is a member of `oneof`_ ``_order_by``. + page_token (str): + Specifies a page token to use. Set ``pageToken`` to the + ``nextPageToken`` returned by a previous list request to get + the next page of results. + + This field is a member of `oneof`_ ``_page_token``. + project (str): + Project ID for this request. + return_partial_success (bool): + Opt-in for partial success behavior which + provides partial results in case of failure. The + default value is false. + + This field is a member of `oneof`_ ``_return_partial_success``. + """ + + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) + + +class AggregatedListTargetPoolsRequest(proto.Message): + r"""A request message for TargetPools.AggregatedList. See the + method description for details. + + Attributes: + filter (str): + A filter expression that filters resources listed in the + response. The expression must specify the field name, an + operator, and the value that you want to use for filtering. + The value must be a string, a number, or a boolean. The + operator must be either ``=``, ``!=``, ``>``, ``<``, ``<=``, + ``>=`` or ``:``. For example, if you are filtering Compute + Engine instances, you can exclude instances named + ``example-instance`` by specifying + ``name != example-instance``. The ``:`` operator can be used + with string fields to match substrings. For non-string + fields it is equivalent to the ``=`` operator. The ``:*`` + comparison can be used to test whether a key has been + defined. For example, to find all objects with ``owner`` + label use: ``labels.owner:*`` You can also filter nested + fields. For example, you could specify + ``scheduling.automaticRestart = false`` to include instances + only if they are not scheduled for automatic restarts. You + can use filtering on nested fields to filter based on + resource labels. To filter on multiple expressions, provide + each separate expression within parentheses. For example: + ``(scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake")`` + By default, each expression is an ``AND`` expression. + However, you can include ``AND`` and ``OR`` expressions + explicitly. For example: + ``(cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true)`` + + This field is a member of `oneof`_ ``_filter``. + include_all_scopes (bool): + Indicates whether every visible scope for + each scope type (zone, region, global) should be + included in the response. For new resource types + added after this field, the flag has no effect + as new resource types will always include every + visible scope for each scope type in response. + For resource types which predate this field, if + this flag is omitted or false, only scopes of + the scope types where the resource type is + expected to be found will be included. + + This field is a member of `oneof`_ ``_include_all_scopes``. + max_results (int): + The maximum number of results per page that should be + returned. If the number of available results is larger than + ``maxResults``, Compute Engine returns a ``nextPageToken`` + that can be used to get the next page of results in + subsequent list requests. Acceptable values are ``0`` to + ``500``, inclusive. (Default: ``500``) + + This field is a member of `oneof`_ ``_max_results``. + order_by (str): + Sorts list results by a certain order. By default, results + are returned in alphanumerical order based on the resource + name. You can also sort results in descending order based on + the creation timestamp using + ``orderBy="creationTimestamp desc"``. This sorts results + based on the ``creationTimestamp`` field in reverse + chronological order (newest result first). Use this to sort + resources like operations so that the newest operation is + returned first. Currently, only sorting by ``name`` or + ``creationTimestamp desc`` is supported. + + This field is a member of `oneof`_ ``_order_by``. + page_token (str): + Specifies a page token to use. Set ``pageToken`` to the + ``nextPageToken`` returned by a previous list request to get + the next page of results. + + This field is a member of `oneof`_ ``_page_token``. + project (str): + Project ID for this request. + return_partial_success (bool): + Opt-in for partial success behavior which + provides partial results in case of failure. The + default value is false. + + This field is a member of `oneof`_ ``_return_partial_success``. + """ + + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + include_all_scopes = proto.Field( + proto.BOOL, + number=391327988, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) + + +class AggregatedListTargetVpnGatewaysRequest(proto.Message): + r"""A request message for TargetVpnGateways.AggregatedList. See the method description for details. Attributes: @@ -7454,6 +8043,11 @@ class AllocationSpecificSKUReservation(proto.Message): instance configuration. Next ID: 5 Attributes: + assured_count (int): + [Output Only] Indicates how many instances are actually + usable currently. + + This field is a member of `oneof`_ ``_assured_count``. count (int): Specifies the number of resources that are allocated. @@ -7469,6 +8063,11 @@ class AllocationSpecificSKUReservation(proto.Message): This field is a member of `oneof`_ ``_instance_properties``. """ + assured_count = proto.Field( + proto.INT64, + number=281197645, + optional=True, + ) count = proto.Field( proto.INT64, number=94851343, @@ -8067,7 +8666,7 @@ class AttachedDiskInitializeParams(proto.Message): type, not URL. This field is a member of `oneof`_ ``_disk_type``. - labels (Sequence[google.cloud.compute_v1.types.AttachedDiskInitializeParams.LabelsEntry]): + labels (Mapping[str, str]): Labels to apply to this disk. These can be later modified by the disks.setLabels method. This field is only applicable for persistent @@ -8425,7 +9024,7 @@ class Autoscaler(proto.Message): resides (for autoscalers living in regional scope). This field is a member of `oneof`_ ``_region``. - scaling_schedule_status (Sequence[google.cloud.compute_v1.types.Autoscaler.ScalingScheduleStatusEntry]): + scaling_schedule_status (Mapping[str, google.cloud.compute_v1.types.ScalingScheduleStatus]): [Output Only] Status information of existing scaling schedules. self_link (str): @@ -8561,7 +9160,7 @@ class AutoscalerAggregatedList(proto.Message): the server. This field is a member of `oneof`_ ``_id``. - items (Sequence[google.cloud.compute_v1.types.AutoscalerAggregatedList.ItemsEntry]): + items (Mapping[str, google.cloud.compute_v1.types.AutoscalersScopedList]): A list of AutoscalersScopedList resources. kind (str): [Output Only] Type of resource. Always @@ -8920,7 +9519,7 @@ class AutoscalingPolicy(proto.Message): scale_in_control (google.cloud.compute_v1.types.AutoscalingPolicyScaleInControl): This field is a member of `oneof`_ ``_scale_in_control``. - scaling_schedules (Sequence[google.cloud.compute_v1.types.AutoscalingPolicy.ScalingSchedulesEntry]): + scaling_schedules (Mapping[str, google.cloud.compute_v1.types.AutoscalingPolicyScalingSchedule]): Scaling schedules defined for an autoscaler. Multiple schedules can be set on an autoscaler, and they can overlap. During overlapping periods the greatest @@ -10151,6 +10750,15 @@ class BackendService(proto.Message): of possible values. This field is a member of `oneof`_ ``_load_balancing_scheme``. + locality_lb_policies (Sequence[google.cloud.compute_v1.types.BackendServiceLocalityLoadBalancingPolicyConfig]): + A list of locality load balancing policies to + be used in order of preference. Either the + policy or the customPolicy field should be set. + Overrides any value set in the localityLbPolicy + field. localityLbPolicies is only supported when + the BackendService is referenced by a URL Map + that is referenced by a target gRPC proxy that + has the validateForProxyless field set to true. locality_lb_policy (str): The load balancing algorithm used within the scope of the locality. The possible values are: - ROUND_ROBIN: This is a @@ -10306,6 +10914,14 @@ class BackendService(proto.Message): This field is a member of `oneof`_ ``_subsetting``. timeout_sec (int): + The backend service timeout has a different + meaning depending on the type of load balancer. + For more information see, Backend service + settings. The default is 30 seconds. The full + range of timeout values allowed goes from 1 + through 2,147,483,647 seconds. This value can be + overridden in the PathMatcher configuration of + the UrlMap that references this backend service. Not supported when the backend service is referenced by a URL map that is bound to target gRPC proxy that has validateForProxyless field @@ -10506,6 +11122,11 @@ class SessionAffinity(proto.Enum): number=363890244, optional=True, ) + locality_lb_policies = proto.RepeatedField( + proto.MESSAGE, + number=140982557, + message="BackendServiceLocalityLoadBalancingPolicyConfig", + ) locality_lb_policy = proto.Field( proto.STRING, number=131431487, @@ -10602,7 +11223,7 @@ class BackendServiceAggregatedList(proto.Message): the server. This field is a member of `oneof`_ ``_id``. - items (Sequence[google.cloud.compute_v1.types.BackendServiceAggregatedList.ItemsEntry]): + items (Mapping[str, google.cloud.compute_v1.types.BackendServicesScopedList]): A list of BackendServicesScopedList resources. kind (str): @@ -10985,6 +11606,12 @@ class BackendServiceConnectionTrackingPolicy(proto.Message): the list of possible values. This field is a member of `oneof`_ ``_connection_persistence_on_unhealthy_backends``. + enable_strong_affinity (bool): + Enable Strong Session Affinity for Network + Load Balancing. This option is not available + publicly. + + This field is a member of `oneof`_ ``_enable_strong_affinity``. idle_timeout_sec (int): Specifies how long to keep a Connection Tracking entry while there is no matching traffic (in seconds). For Internal @@ -11061,6 +11688,11 @@ class TrackingMode(proto.Enum): number=152439033, optional=True, ) + enable_strong_affinity = proto.Field( + proto.BOOL, + number=24539924, + optional=True, + ) idle_timeout_sec = proto.Field( proto.INT32, number=24977544, @@ -11143,7 +11775,7 @@ class BackendServiceGroupHealth(proto.Message): r""" Attributes: - annotations (Sequence[google.cloud.compute_v1.types.BackendServiceGroupHealth.AnnotationsEntry]): + annotations (Mapping[str, str]): Metadata defined as annotations on the network endpoint group. health_status (Sequence[google.cloud.compute_v1.types.HealthStatus]): @@ -11301,6 +11933,112 @@ def raw_page(self): ) +class BackendServiceLocalityLoadBalancingPolicyConfig(proto.Message): + r"""Container for either a built-in LB policy supported by gRPC + or Envoy or a custom one implemented by the end user. + + Attributes: + custom_policy (google.cloud.compute_v1.types.BackendServiceLocalityLoadBalancingPolicyConfigCustomPolicy): + + This field is a member of `oneof`_ ``_custom_policy``. + policy (google.cloud.compute_v1.types.BackendServiceLocalityLoadBalancingPolicyConfigPolicy): + + This field is a member of `oneof`_ ``_policy``. + """ + + custom_policy = proto.Field( + proto.MESSAGE, + number=4818368, + optional=True, + message="BackendServiceLocalityLoadBalancingPolicyConfigCustomPolicy", + ) + policy = proto.Field( + proto.MESSAGE, + number=91071794, + optional=True, + message="BackendServiceLocalityLoadBalancingPolicyConfigPolicy", + ) + + +class BackendServiceLocalityLoadBalancingPolicyConfigCustomPolicy(proto.Message): + r"""The configuration for a custom policy implemented by the user + and deployed with the client. + + Attributes: + data (str): + An optional, arbitrary JSON object with + configuration data, understood by a locally + installed custom policy implementation. + + This field is a member of `oneof`_ ``_data``. + name (str): + Identifies the custom policy. The value + should match the type the custom implementation + is registered with on the gRPC clients. It + should follow protocol buffer message naming + conventions and include the full path (e.g. + myorg.CustomLbPolicy). The maximum length is 256 + characters. Note that specifying the same custom + policy more than once for a backend is not a + valid configuration and will be rejected. + + This field is a member of `oneof`_ ``_name``. + """ + + data = proto.Field( + proto.STRING, + number=3076010, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + + +class BackendServiceLocalityLoadBalancingPolicyConfigPolicy(proto.Message): + r"""The configuration for a built-in load balancing policy. + + Attributes: + name (str): + The name of a locality load balancer policy to be used. The + value should be one of the predefined ones as supported by + localityLbPolicy, although at the moment only ROUND_ROBIN is + supported. This field should only be populated when the + customPolicy field is not used. Note that specifying the + same policy more than once for a backend is not a valid + configuration and will be rejected. Check the Name enum for + the list of possible values. + + This field is a member of `oneof`_ ``_name``. + """ + + class Name(proto.Enum): + r"""The name of a locality load balancer policy to be used. The value + should be one of the predefined ones as supported by + localityLbPolicy, although at the moment only ROUND_ROBIN is + supported. This field should only be populated when the customPolicy + field is not used. Note that specifying the same policy more than + once for a backend is not a valid configuration and will be + rejected. + """ + UNDEFINED_NAME = 0 + INVALID_LB_POLICY = 323318707 + LEAST_REQUEST = 46604921 + MAGLEV = 119180266 + ORIGINAL_DESTINATION = 166297216 + RANDOM = 262527171 + RING_HASH = 432795069 + ROUND_ROBIN = 153895801 + + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + + class BackendServiceLogConfig(proto.Message): r"""The available logging options for the load balancer traffic served by this backend service. @@ -11989,7 +12727,7 @@ class BulkInsertInstanceResource(proto.Message): placeholder #...# can contain up to 18 characters. This field is a member of `oneof`_ ``_name_pattern``. - per_instance_properties (Sequence[google.cloud.compute_v1.types.BulkInsertInstanceResource.PerInstancePropertiesEntry]): + per_instance_properties (Mapping[str, google.cloud.compute_v1.types.BulkInsertInstanceResourcePerInstanceProperties]): Per-instance properties to be set on individual instances. Keys of this map specify requested instance names. Can be empty if name_pattern is used. @@ -12232,17 +12970,21 @@ class CircuitBreakers(proto.Message): Attributes: max_connections (int): - Not supported when the backend service is + The maximum number of connections to the + backend service. If not specified, there is no + limit. Not supported when the backend service is referenced by a URL map that is bound to target gRPC proxy that has validateForProxyless field set to true. This field is a member of `oneof`_ ``_max_connections``. max_pending_requests (int): - Not supported when the backend service is - referenced by a URL map that is bound to target - gRPC proxy that has validateForProxyless field - set to true. + The maximum number of pending requests + allowed to the backend service. If not + specified, there is no limit. Not supported when + the backend service is referenced by a URL map + that is bound to target gRPC proxy that has + validateForProxyless field set to true. This field is a member of `oneof`_ ``_max_pending_requests``. max_requests (int): @@ -12252,17 +12994,24 @@ class CircuitBreakers(proto.Message): This field is a member of `oneof`_ ``_max_requests``. max_requests_per_connection (int): - Not supported when the backend service is - referenced by a URL map that is bound to target - gRPC proxy that has validateForProxyless field - set to true. + Maximum requests for a single connection to + the backend service. This parameter is respected + by both the HTTP/1.1 and HTTP/2 implementations. + If not specified, there is no limit. Setting + this parameter to 1 will effectively disable + keep alive. Not supported when the backend + service is referenced by a URL map that is bound + to target gRPC proxy that has + validateForProxyless field set to true. This field is a member of `oneof`_ ``_max_requests_per_connection``. max_retries (int): - Not supported when the backend service is - referenced by a URL map that is bound to target - gRPC proxy that has validateForProxyless field - set to true. + The maximum number of parallel retries + allowed to the backend cluster. If not + specified, the default is 1. Not supported when + the backend service is referenced by a URL map + that is bound to target gRPC proxy that has + validateForProxyless field set to true. This field is a member of `oneof`_ ``_max_retries``. """ @@ -12341,6 +13090,119 @@ class CloneRulesFirewallPolicyRequest(proto.Message): ) +class CloneRulesNetworkFirewallPolicyRequest(proto.Message): + r"""A request message for NetworkFirewallPolicies.CloneRules. See + the method description for details. + + Attributes: + firewall_policy (str): + Name of the firewall policy to update. + project (str): + Project ID for this request. + request_id (str): + An optional request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. For example, consider a situation + where you make an initial request and the + request times out. If you make the request again + with the same request ID, the server can check + if original operation with the same request ID + was received, and if so, will ignore the second + request. This prevents clients from accidentally + creating duplicate commitments. The request ID + must be a valid UUID with the exception that + zero UUID is not supported ( + 00000000-0000-0000-0000-000000000000). + + This field is a member of `oneof`_ ``_request_id``. + source_firewall_policy (str): + The firewall policy from which to copy rules. + + This field is a member of `oneof`_ ``_source_firewall_policy``. + """ + + firewall_policy = proto.Field( + proto.STRING, + number=498173265, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + source_firewall_policy = proto.Field( + proto.STRING, + number=25013549, + optional=True, + ) + + +class CloneRulesRegionNetworkFirewallPolicyRequest(proto.Message): + r"""A request message for + RegionNetworkFirewallPolicies.CloneRules. See the method + description for details. + + Attributes: + firewall_policy (str): + Name of the firewall policy to update. + project (str): + Project ID for this request. + region (str): + Name of the region scoping this request. + request_id (str): + An optional request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. For example, consider a situation + where you make an initial request and the + request times out. If you make the request again + with the same request ID, the server can check + if original operation with the same request ID + was received, and if so, will ignore the second + request. This prevents clients from accidentally + creating duplicate commitments. The request ID + must be a valid UUID with the exception that + zero UUID is not supported ( + 00000000-0000-0000-0000-000000000000). + + This field is a member of `oneof`_ ``_request_id``. + source_firewall_policy (str): + The firewall policy from which to copy rules. + + This field is a member of `oneof`_ ``_source_firewall_policy``. + """ + + firewall_policy = proto.Field( + proto.STRING, + number=498173265, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + source_firewall_policy = proto.Field( + proto.STRING, + number=25013549, + optional=True, + ) + + class Commitment(proto.Message): r"""Represents a regional Commitment resource. Creating a commitment resource means that you are purchasing a committed @@ -12618,7 +13480,7 @@ class CommitmentAggregatedList(proto.Message): the server. This field is a member of `oneof`_ ``_id``. - items (Sequence[google.cloud.compute_v1.types.CommitmentAggregatedList.ItemsEntry]): + items (Mapping[str, google.cloud.compute_v1.types.CommitmentsScopedList]): A list of CommitmentsScopedList resources. kind (str): [Output Only] Type of resource. Always @@ -12793,12 +13655,14 @@ class Condition(proto.Message): Attributes: iam (str): This is deprecated and has no effect. Do not - use. + use. Check the Iam enum for the list of possible + values. This field is a member of `oneof`_ ``_iam``. op (str): This is deprecated and has no effect. Do not - use. + use. Check the Op enum for the list of possible + values. This field is a member of `oneof`_ ``_op``. svc (str): @@ -12808,7 +13672,8 @@ class Condition(proto.Message): This field is a member of `oneof`_ ``_svc``. sys (str): This is deprecated and has no effect. Do not - use. + use. Check the Sys enum for the list of possible + values. This field is a member of `oneof`_ ``_sys``. values (Sequence[str]): @@ -12816,6 +13681,41 @@ class Condition(proto.Message): use. """ + class Iam(proto.Enum): + r"""This is deprecated and has no effect. Do not use. Additional + supported values which may be not listed in the enum directly due to + technical reasons: NO_ATTR + """ + UNDEFINED_IAM = 0 + APPROVER = 357258949 + ATTRIBUTION = 232465503 + AUTHORITY = 504108835 + CREDENTIALS_TYPE = 348222141 + CREDS_ASSERTION = 332343272 + JUSTIFICATION_TYPE = 206147719 + SECURITY_REALM = 526269616 + + class Op(proto.Enum): + r"""This is deprecated and has no effect. Do not use.""" + UNDEFINED_OP = 0 + DISCHARGED = 266338274 + EQUALS = 442201023 + IN = 2341 + NOT_EQUALS = 19718859 + NOT_IN = 161144369 + NO_OP = 74481951 + + class Sys(proto.Enum): + r"""This is deprecated and has no effect. Do not use. Additional + supported values which may be not listed in the enum directly due to + technical reasons: NO_ATTR + """ + UNDEFINED_SYS = 0 + IP = 2343 + NAME = 2388619 + REGION = 266017524 + SERVICE = 17781397 + iam = proto.Field( proto.STRING, number=104021, @@ -13186,8 +14086,7 @@ class CreateSnapshotDiskRequest(proto.Message): guest_flush (bool): [Input Only] Whether to attempt an application consistent snapshot by informing the OS to prepare for the snapshot - process. Currently only supported on Windows instances using - the Volume Shadow Copy Service (VSS). + process. This field is a member of `oneof`_ ``_guest_flush``. project (str): @@ -14751,6 +15650,57 @@ class DeleteMachineImageRequest(proto.Message): ) +class DeleteNetworkEdgeSecurityServiceRequest(proto.Message): + r"""A request message for NetworkEdgeSecurityServices.Delete. See + the method description for details. + + Attributes: + network_edge_security_service (str): + Name of the network edge security service to + delete. + project (str): + Project ID for this request. + region (str): + Name of the region scoping this request. + request_id (str): + An optional request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. For example, consider a situation + where you make an initial request and the + request times out. If you make the request again + with the same request ID, the server can check + if original operation with the same request ID + was received, and if so, will ignore the second + request. This prevents clients from accidentally + creating duplicate commitments. The request ID + must be a valid UUID with the exception that + zero UUID is not supported ( + 00000000-0000-0000-0000-000000000000). + + This field is a member of `oneof`_ ``_request_id``. + """ + + network_edge_security_service = proto.Field( + proto.STRING, + number=157011879, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + + class DeleteNetworkEndpointGroupRequest(proto.Message): r"""A request message for NetworkEndpointGroups.Delete. See the method description for details. @@ -14804,6 +15754,50 @@ class DeleteNetworkEndpointGroupRequest(proto.Message): ) +class DeleteNetworkFirewallPolicyRequest(proto.Message): + r"""A request message for NetworkFirewallPolicies.Delete. See the + method description for details. + + Attributes: + firewall_policy (str): + Name of the firewall policy to delete. + project (str): + Project ID for this request. + request_id (str): + An optional request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. For example, consider a situation + where you make an initial request and the + request times out. If you make the request again + with the same request ID, the server can check + if original operation with the same request ID + was received, and if so, will ignore the second + request. This prevents clients from accidentally + creating duplicate commitments. The request ID + must be a valid UUID with the exception that + zero UUID is not supported ( + 00000000-0000-0000-0000-000000000000). + + This field is a member of `oneof`_ ``_request_id``. + """ + + firewall_policy = proto.Field( + proto.STRING, + number=498173265, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + + class DeleteNetworkRequest(proto.Message): r"""A request message for Networks.Delete. See the method description for details. @@ -15585,6 +16579,56 @@ class DeleteRegionNetworkEndpointGroupRequest(proto.Message): ) +class DeleteRegionNetworkFirewallPolicyRequest(proto.Message): + r"""A request message for RegionNetworkFirewallPolicies.Delete. + See the method description for details. + + Attributes: + firewall_policy (str): + Name of the firewall policy to delete. + project (str): + Project ID for this request. + region (str): + Name of the region scoping this request. + request_id (str): + An optional request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. For example, consider a situation + where you make an initial request and the + request times out. If you make the request again + with the same request ID, the server can check + if original operation with the same request ID + was received, and if so, will ignore the second + request. This prevents clients from accidentally + creating duplicate commitments. The request ID + must be a valid UUID with the exception that + zero UUID is not supported ( + 00000000-0000-0000-0000-000000000000). + + This field is a member of `oneof`_ ``_request_id``. + """ + + firewall_policy = proto.Field( + proto.STRING, + number=498173265, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + + class DeleteRegionNotificationEndpointRequest(proto.Message): r"""A request message for RegionNotificationEndpoints.Delete. See the method description for details. @@ -15670,6 +16714,56 @@ class DeleteRegionOperationResponse(proto.Message): """ +class DeleteRegionSecurityPolicyRequest(proto.Message): + r"""A request message for RegionSecurityPolicies.Delete. See the + method description for details. + + Attributes: + project (str): + Project ID for this request. + region (str): + Name of the region scoping this request. + request_id (str): + An optional request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. For example, consider a situation + where you make an initial request and the + request times out. If you make the request again + with the same request ID, the server can check + if original operation with the same request ID + was received, and if so, will ignore the second + request. This prevents clients from accidentally + creating duplicate commitments. The request ID + must be a valid UUID with the exception that + zero UUID is not supported ( + 00000000-0000-0000-0000-000000000000). + + This field is a member of `oneof`_ ``_request_id``. + security_policy (str): + Name of the security policy to delete. + """ + + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + security_policy = proto.Field( + proto.STRING, + number=171082513, + ) + + class DeleteRegionSslCertificateRequest(proto.Message): r"""A request message for RegionSslCertificates.Delete. See the method description for details. @@ -17501,7 +18595,7 @@ class Disk(proto.Message): retrieve a disk. This field is a member of `oneof`_ ``_label_fingerprint``. - labels (Sequence[google.cloud.compute_v1.types.Disk.LabelsEntry]): + labels (Mapping[str, str]): Labels to apply to this disk. These can be later modified by the setLabels method. last_attach_timestamp (str): @@ -17925,7 +19019,7 @@ class DiskAggregatedList(proto.Message): the server. This field is a member of `oneof`_ ``_id``. - items (Sequence[google.cloud.compute_v1.types.DiskAggregatedList.ItemsEntry]): + items (Mapping[str, google.cloud.compute_v1.types.DisksScopedList]): A list of DisksScopedList resources. kind (str): [Output Only] Type of resource. Always @@ -18333,7 +19427,7 @@ class DiskTypeAggregatedList(proto.Message): the server. This field is a member of `oneof`_ ``_id``. - items (Sequence[google.cloud.compute_v1.types.DiskTypeAggregatedList.ItemsEntry]): + items (Mapping[str, google.cloud.compute_v1.types.DiskTypesScopedList]): A list of DiskTypesScopedList resources. kind (str): [Output Only] Type of resource. Always @@ -19148,7 +20242,7 @@ class ExternalVpnGateway(proto.Message): ExternalVpnGateway. This field is a member of `oneof`_ ``_label_fingerprint``. - labels (Sequence[google.cloud.compute_v1.types.ExternalVpnGateway.LabelsEntry]): + labels (Mapping[str, str]): Labels for this resource. These can only be added or modified by the setLabels method. Each label key/value pair must comply with RFC1035. @@ -19868,6 +20962,14 @@ class FirewallPolicy(proto.Message): [Output Only] The parent of the firewall policy. This field is a member of `oneof`_ ``_parent``. + region (str): + [Output Only] URL of the region where the regional firewall + policy resides. This field is not applicable to global + firewall policies. You must specify this field as part of + the HTTP request URL. It is not settable as a field in the + request body. + + This field is a member of `oneof`_ ``_region``. rule_tuple_count (int): [Output Only] Total count of all firewall policy rule tuples. A firewall policy can not exceed a set number of @@ -19949,6 +21051,11 @@ class FirewallPolicy(proto.Message): number=78317738, optional=True, ) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) rule_tuple_count = proto.Field( proto.INT32, number=388342037, @@ -20154,6 +21261,11 @@ class FirewallPolicyRule(proto.Message): lowest prority. This field is a member of `oneof`_ ``_priority``. + rule_name (str): + An optional name for the rule. This field is + not a unique identifier and can be updated. + + This field is a member of `oneof`_ ``_rule_name``. rule_tuple_count (int): [Output Only] Calculation of the complexity of a single firewall policy rule. @@ -20165,6 +21277,17 @@ class FirewallPolicyRule(proto.Message): which network's VMs get this rule. If this field is left blank, all VMs within the organization will receive the rule. + target_secure_tags (Sequence[google.cloud.compute_v1.types.FirewallPolicyRuleSecureTag]): + A list of secure tags that controls which instances the + firewall rule applies to. If targetSecureTag are specified, + then the firewall rule applies only to instances in the VPC + network that have one of those EFFECTIVE secure tags, if all + the target_secure_tag are in INEFFECTIVE state, then this + rule will be ignored. targetSecureTag may not be set at the + same time as targetServiceAccounts. If neither + targetServiceAccounts nor targetSecureTag are specified, the + firewall rule applies to all instances on the specified + network. Maximum number of target label tags allowed is 256. target_service_accounts (Sequence[str]): A list of service accounts indicating the sets of instances that are applied with this @@ -20218,6 +21341,11 @@ class Direction(proto.Enum): number=445151652, optional=True, ) + rule_name = proto.Field( + proto.STRING, + number=55286254, + optional=True, + ) rule_tuple_count = proto.Field( proto.INT32, number=388342037, @@ -20227,6 +21355,11 @@ class Direction(proto.Enum): proto.STRING, number=528230647, ) + target_secure_tags = proto.RepeatedField( + proto.MESSAGE, + number=468132403, + message="FirewallPolicyRuleSecureTag", + ) target_service_accounts = proto.RepeatedField( proto.STRING, number=457639710, @@ -20247,6 +21380,13 @@ class FirewallPolicyRuleMatcher(proto.Message): src_ip_ranges (Sequence[str]): CIDR IP address range. Maximum number of source CIDR IP ranges allowed is 5000. + src_secure_tags (Sequence[google.cloud.compute_v1.types.FirewallPolicyRuleSecureTag]): + List of secure tag values, which should be + matched at the source of the traffic. For + INGRESS rule, if all the srcSecureTag are + INEFFECTIVE, and there is no srcIpRange, this + rule will be ignored. Maximum number of source + tag values allowed is 256. """ dest_ip_ranges = proto.RepeatedField( @@ -20262,6 +21402,11 @@ class FirewallPolicyRuleMatcher(proto.Message): proto.STRING, number=432128083, ) + src_secure_tags = proto.RepeatedField( + proto.MESSAGE, + number=508791302, + message="FirewallPolicyRuleSecureTag", + ) class FirewallPolicyRuleMatcherLayer4Config(proto.Message): @@ -20296,6 +21441,45 @@ class FirewallPolicyRuleMatcherLayer4Config(proto.Message): ) +class FirewallPolicyRuleSecureTag(proto.Message): + r""" + + Attributes: + name (str): + Name of the secure tag, created with + TagManager's TagValue API. + + This field is a member of `oneof`_ ``_name``. + state (str): + [Output Only] State of the secure tag, either ``EFFECTIVE`` + or ``INEFFECTIVE``. A secure tag is ``INEFFECTIVE`` when it + is deleted or its network is deleted. Check the State enum + for the list of possible values. + + This field is a member of `oneof`_ ``_state``. + """ + + class State(proto.Enum): + r"""[Output Only] State of the secure tag, either ``EFFECTIVE`` or + ``INEFFECTIVE``. A secure tag is ``INEFFECTIVE`` when it is deleted + or its network is deleted. + """ + UNDEFINED_STATE = 0 + EFFECTIVE = 244201863 + INEFFECTIVE = 304458242 + + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + state = proto.Field( + proto.STRING, + number=109757585, + optional=True, + ) + + class FixedOrPercent(proto.Message): r"""Encapsulates numeric value that can be either absolute or relative. @@ -20481,7 +21665,7 @@ class ForwardingRule(proto.Message): retrieve a ForwardingRule. This field is a member of `oneof`_ ``_label_fingerprint``. - labels (Sequence[google.cloud.compute_v1.types.ForwardingRule.LabelsEntry]): + labels (Mapping[str, str]): Labels for this resource. These can only be added or modified by the setLabels method. Each label key/value pair must comply with RFC1035. @@ -20865,7 +22049,7 @@ class ForwardingRuleAggregatedList(proto.Message): the server. This field is a member of `oneof`_ ``_id``. - items (Sequence[google.cloud.compute_v1.types.ForwardingRuleAggregatedList.ItemsEntry]): + items (Mapping[str, google.cloud.compute_v1.types.ForwardingRulesScopedList]): A list of ForwardingRulesScopedList resources. kind (str): @@ -21255,6 +22439,77 @@ class GetAssociationFirewallPolicyRequest(proto.Message): ) +class GetAssociationNetworkFirewallPolicyRequest(proto.Message): + r"""A request message for NetworkFirewallPolicies.GetAssociation. + See the method description for details. + + Attributes: + firewall_policy (str): + Name of the firewall policy to which the + queried association belongs. + name (str): + The name of the association to get from the + firewall policy. + + This field is a member of `oneof`_ ``_name``. + project (str): + Project ID for this request. + """ + + firewall_policy = proto.Field( + proto.STRING, + number=498173265, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + + +class GetAssociationRegionNetworkFirewallPolicyRequest(proto.Message): + r"""A request message for + RegionNetworkFirewallPolicies.GetAssociation. See the method + description for details. + + Attributes: + firewall_policy (str): + Name of the firewall policy to which the + queried association belongs. + name (str): + The name of the association to get from the + firewall policy. + + This field is a member of `oneof`_ ``_name``. + project (str): + Project ID for this request. + region (str): + Name of the region scoping this request. + """ + + firewall_policy = proto.Field( + proto.STRING, + number=498173265, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + + class GetAutoscalerRequest(proto.Message): r"""A request message for Autoscalers.Get. See the method description for details. @@ -21455,6 +22710,34 @@ class GetEffectiveFirewallsNetworkRequest(proto.Message): ) +class GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest(proto.Message): + r"""A request message for + RegionNetworkFirewallPolicies.GetEffectiveFirewalls. See the + method description for details. + + Attributes: + network (str): + Network reference + project (str): + Project ID for this request. + region (str): + Name of the region scoping this request. + """ + + network = proto.Field( + proto.STRING, + number=232872494, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + + class GetExternalVpnGatewayRequest(proto.Message): r"""A request message for ExternalVpnGateways.Get. See the method description for details. @@ -22076,9 +23359,9 @@ class GetIamPolicyMachineImageRequest(proto.Message): ) -class GetIamPolicyNodeGroupRequest(proto.Message): - r"""A request message for NodeGroups.GetIamPolicy. See the method - description for details. +class GetIamPolicyNetworkFirewallPolicyRequest(proto.Message): + r"""A request message for NetworkFirewallPolicies.GetIamPolicy. + See the method description for details. Attributes: options_requested_policy_version (int): @@ -22089,8 +23372,6 @@ class GetIamPolicyNodeGroupRequest(proto.Message): Project ID for this request. resource (str): Name or id of the resource for this request. - zone (str): - The name of the zone for this request. """ options_requested_policy_version = proto.Field( @@ -22106,15 +23387,11 @@ class GetIamPolicyNodeGroupRequest(proto.Message): proto.STRING, number=195806222, ) - zone = proto.Field( - proto.STRING, - number=3744684, - ) -class GetIamPolicyNodeTemplateRequest(proto.Message): - r"""A request message for NodeTemplates.GetIamPolicy. See the - method description for details. +class GetIamPolicyNodeGroupRequest(proto.Message): + r"""A request message for NodeGroups.GetIamPolicy. See the method + description for details. Attributes: options_requested_policy_version (int): @@ -22123,10 +23400,10 @@ class GetIamPolicyNodeTemplateRequest(proto.Message): This field is a member of `oneof`_ ``_options_requested_policy_version``. project (str): Project ID for this request. - region (str): - The name of the region for this request. resource (str): Name or id of the resource for this request. + zone (str): + The name of the zone for this request. """ options_requested_policy_version = proto.Field( @@ -22138,18 +23415,18 @@ class GetIamPolicyNodeTemplateRequest(proto.Message): proto.STRING, number=227560217, ) - region = proto.Field( - proto.STRING, - number=138946292, - ) resource = proto.Field( proto.STRING, number=195806222, ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) -class GetIamPolicyRegionDiskRequest(proto.Message): - r"""A request message for RegionDisks.GetIamPolicy. See the +class GetIamPolicyNodeTemplateRequest(proto.Message): + r"""A request message for NodeTemplates.GetIamPolicy. See the method description for details. Attributes: @@ -22184,44 +23461,117 @@ class GetIamPolicyRegionDiskRequest(proto.Message): ) -class GetIamPolicyReservationRequest(proto.Message): - r"""A request message for Reservations.GetIamPolicy. See the - method description for details. - - Attributes: - options_requested_policy_version (int): - Requested IAM Policy version. - - This field is a member of `oneof`_ ``_options_requested_policy_version``. - project (str): - Project ID for this request. - resource (str): - Name or id of the resource for this request. - zone (str): - The name of the zone for this request. - """ - - options_requested_policy_version = proto.Field( - proto.INT32, - number=499220029, - optional=True, - ) - project = proto.Field( - proto.STRING, - number=227560217, - ) - resource = proto.Field( - proto.STRING, - number=195806222, - ) - zone = proto.Field( - proto.STRING, - number=3744684, - ) - - -class GetIamPolicyResourcePolicyRequest(proto.Message): - r"""A request message for ResourcePolicies.GetIamPolicy. See the +class GetIamPolicyRegionDiskRequest(proto.Message): + r"""A request message for RegionDisks.GetIamPolicy. See the + method description for details. + + Attributes: + options_requested_policy_version (int): + Requested IAM Policy version. + + This field is a member of `oneof`_ ``_options_requested_policy_version``. + project (str): + Project ID for this request. + region (str): + The name of the region for this request. + resource (str): + Name or id of the resource for this request. + """ + + options_requested_policy_version = proto.Field( + proto.INT32, + number=499220029, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + resource = proto.Field( + proto.STRING, + number=195806222, + ) + + +class GetIamPolicyRegionNetworkFirewallPolicyRequest(proto.Message): + r"""A request message for + RegionNetworkFirewallPolicies.GetIamPolicy. See the method + description for details. + + Attributes: + options_requested_policy_version (int): + Requested IAM Policy version. + + This field is a member of `oneof`_ ``_options_requested_policy_version``. + project (str): + Project ID for this request. + region (str): + The name of the region for this request. + resource (str): + Name or id of the resource for this request. + """ + + options_requested_policy_version = proto.Field( + proto.INT32, + number=499220029, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + resource = proto.Field( + proto.STRING, + number=195806222, + ) + + +class GetIamPolicyReservationRequest(proto.Message): + r"""A request message for Reservations.GetIamPolicy. See the + method description for details. + + Attributes: + options_requested_policy_version (int): + Requested IAM Policy version. + + This field is a member of `oneof`_ ``_options_requested_policy_version``. + project (str): + Project ID for this request. + resource (str): + Name or id of the resource for this request. + zone (str): + The name of the zone for this request. + """ + + options_requested_policy_version = proto.Field( + proto.INT32, + number=499220029, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) + + +class GetIamPolicyResourcePolicyRequest(proto.Message): + r"""A request message for ResourcePolicies.GetIamPolicy. See the method description for details. Attributes: @@ -22786,6 +24136,34 @@ class GetNatMappingInfoRoutersRequest(proto.Message): ) +class GetNetworkEdgeSecurityServiceRequest(proto.Message): + r"""A request message for NetworkEdgeSecurityServices.Get. See + the method description for details. + + Attributes: + network_edge_security_service (str): + Name of the network edge security service to + get. + project (str): + Project ID for this request. + region (str): + Name of the region scoping this request. + """ + + network_edge_security_service = proto.Field( + proto.STRING, + number=157011879, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + + class GetNetworkEndpointGroupRequest(proto.Message): r"""A request message for NetworkEndpointGroups.Get. See the method description for details. @@ -22816,6 +24194,27 @@ class GetNetworkEndpointGroupRequest(proto.Message): ) +class GetNetworkFirewallPolicyRequest(proto.Message): + r"""A request message for NetworkFirewallPolicies.Get. See the + method description for details. + + Attributes: + firewall_policy (str): + Name of the firewall policy to get. + project (str): + Project ID for this request. + """ + + firewall_policy = proto.Field( + proto.STRING, + number=498173265, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + + class GetNetworkRequest(proto.Message): r"""A request message for Networks.Get. See the method description for details. @@ -23289,6 +24688,33 @@ class GetRegionNetworkEndpointGroupRequest(proto.Message): ) +class GetRegionNetworkFirewallPolicyRequest(proto.Message): + r"""A request message for RegionNetworkFirewallPolicies.Get. See + the method description for details. + + Attributes: + firewall_policy (str): + Name of the firewall policy to get. + project (str): + Project ID for this request. + region (str): + Name of the region scoping this request. + """ + + firewall_policy = proto.Field( + proto.STRING, + number=498173265, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + + class GetRegionNotificationEndpointRequest(proto.Message): r"""A request message for RegionNotificationEndpoints.Get. See the method description for details. @@ -23365,6 +24791,33 @@ class GetRegionRequest(proto.Message): ) +class GetRegionSecurityPolicyRequest(proto.Message): + r"""A request message for RegionSecurityPolicies.Get. See the + method description for details. + + Attributes: + project (str): + Project ID for this request. + region (str): + Name of the region scoping this request. + security_policy (str): + Name of the security policy to get. + """ + + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + security_policy = proto.Field( + proto.STRING, + number=171082513, + ) + + class GetRegionSslCertificateRequest(proto.Message): r"""A request message for RegionSslCertificates.Get. See the method description for details. @@ -23631,6 +25084,76 @@ class GetRuleFirewallPolicyRequest(proto.Message): ) +class GetRuleNetworkFirewallPolicyRequest(proto.Message): + r"""A request message for NetworkFirewallPolicies.GetRule. See + the method description for details. + + Attributes: + firewall_policy (str): + Name of the firewall policy to which the + queried rule belongs. + priority (int): + The priority of the rule to get from the + firewall policy. + + This field is a member of `oneof`_ ``_priority``. + project (str): + Project ID for this request. + """ + + firewall_policy = proto.Field( + proto.STRING, + number=498173265, + ) + priority = proto.Field( + proto.INT32, + number=445151652, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + + +class GetRuleRegionNetworkFirewallPolicyRequest(proto.Message): + r"""A request message for RegionNetworkFirewallPolicies.GetRule. + See the method description for details. + + Attributes: + firewall_policy (str): + Name of the firewall policy to which the + queried rule belongs. + priority (int): + The priority of the rule to get from the + firewall policy. + + This field is a member of `oneof`_ ``_priority``. + project (str): + Project ID for this request. + region (str): + Name of the region scoping this request. + """ + + firewall_policy = proto.Field( + proto.STRING, + number=498173265, + ) + priority = proto.Field( + proto.INT32, + number=445151652, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + + class GetRuleSecurityPolicyRequest(proto.Message): r"""A request message for SecurityPolicies.GetRule. See the method description for details. @@ -24468,16 +25991,12 @@ class GlobalSetLabelsRequest(proto.Message): fingerprint. This field is a member of `oneof`_ ``_label_fingerprint``. - labels (Sequence[google.cloud.compute_v1.types.GlobalSetLabelsRequest.LabelsEntry]): - A list of labels to apply for this resource. Each label key - & value must comply with RFC1035. Specifically, the name - must be 1-63 characters long and match the regular - expression ``[a-z]([-a-z0-9]*[a-z0-9])?`` which means the - first character must be a lowercase letter, and all - following characters must be a dash, lowercase letter, or - digit, except the last character, which cannot be a dash. - For example, "webserver-frontend": "images". A label value - can also be empty (e.g. "my-label": ""). + labels (Mapping[str, str]): + A list of labels to apply for this resource. + Each label must comply with the requirements for + labels. For example, "webserver-frontend": + "images". A label value can also be empty (e.g. + "my-label": ""). """ label_fingerprint = proto.Field( @@ -24658,8 +26177,8 @@ class GuestOsFeature(proto.Message): The ID of a supported feature. To add multiple values, use commas to separate values. Set to one or more of the following values: - VIRTIO_SCSI_MULTIQUEUE - WINDOWS - - MULTI_IP_SUBNET - UEFI_COMPATIBLE - SECURE_BOOT - GVNIC - - SEV_CAPABLE - SUSPEND_RESUME_COMPATIBLE For more + MULTI_IP_SUBNET - UEFI_COMPATIBLE - GVNIC - SEV_CAPABLE - + SUSPEND_RESUME_COMPATIBLE - SEV_SNP_CAPABLE For more information, see Enabling guest operating system features. Check the Type enum for the list of possible values. @@ -24670,8 +26189,8 @@ class Type(proto.Enum): r"""The ID of a supported feature. To add multiple values, use commas to separate values. Set to one or more of the following values: - VIRTIO_SCSI_MULTIQUEUE - WINDOWS - MULTI_IP_SUBNET - UEFI_COMPATIBLE - - SECURE_BOOT - GVNIC - SEV_CAPABLE - SUSPEND_RESUME_COMPATIBLE For - more information, see Enabling guest operating system features. + - GVNIC - SEV_CAPABLE - SUSPEND_RESUME_COMPATIBLE - SEV_SNP_CAPABLE + For more information, see Enabling guest operating system features. """ UNDEFINED_TYPE = 0 FEATURE_TYPE_UNSPECIFIED = 531767259 @@ -25660,7 +27179,7 @@ class HealthChecksAggregatedList(proto.Message): the server. This field is a member of `oneof`_ ``_id``. - items (Sequence[google.cloud.compute_v1.types.HealthChecksAggregatedList.ItemsEntry]): + items (Mapping[str, google.cloud.compute_v1.types.HealthChecksScopedList]): A list of HealthChecksScopedList resources. kind (str): Type of resource. @@ -25760,7 +27279,7 @@ class HealthStatus(proto.Message): r""" Attributes: - annotations (Sequence[google.cloud.compute_v1.types.HealthStatus.AnnotationsEntry]): + annotations (Mapping[str, str]): Metadata defined as annotations for network endpoint. forwarding_rule (str): @@ -26565,9 +28084,10 @@ class HttpRouteAction(proto.Message): load balancer on a percentage of requests before sending those requests to the backend service. Similarly requests from clients can be aborted by the load balancer for a - percentage of requests. For the requests impacted by fault - injection, timeout and retry_policy is ignored by clients - that are configured with a fault_injection_policy. + percentage of requests. timeout and retry_policy is ignored + by clients that are configured with a fault_injection_policy + if: 1. The traffic is generated by fault injection AND 2. + The fault injection is not a delay fault injection. This field is a member of `oneof`_ ``_fault_injection_policy``. max_stream_duration (google.cloud.compute_v1.types.Duration): @@ -27018,7 +28538,7 @@ class Image(proto.Message): retrieve an image. This field is a member of `oneof`_ ``_label_fingerprint``. - labels (Sequence[google.cloud.compute_v1.types.Image.LabelsEntry]): + labels (Mapping[str, str]): Labels to apply to this image. These can be later modified by the setLabels method. license_codes (Sequence[int]): @@ -28625,6 +30145,66 @@ class InsertMachineImageRequest(proto.Message): ) +class InsertNetworkEdgeSecurityServiceRequest(proto.Message): + r"""A request message for NetworkEdgeSecurityServices.Insert. See + the method description for details. + + Attributes: + network_edge_security_service_resource (google.cloud.compute_v1.types.NetworkEdgeSecurityService): + The body resource for this request + project (str): + Project ID for this request. + region (str): + Name of the region scoping this request. + request_id (str): + An optional request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. For example, consider a situation + where you make an initial request and the + request times out. If you make the request again + with the same request ID, the server can check + if original operation with the same request ID + was received, and if so, will ignore the second + request. This prevents clients from accidentally + creating duplicate commitments. The request ID + must be a valid UUID with the exception that + zero UUID is not supported ( + 00000000-0000-0000-0000-000000000000). + + This field is a member of `oneof`_ ``_request_id``. + validate_only (bool): + If true, the request will not be committed. + + This field is a member of `oneof`_ ``_validate_only``. + """ + + network_edge_security_service_resource = proto.Field( + proto.MESSAGE, + number=477548966, + message="NetworkEdgeSecurityService", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + validate_only = proto.Field( + proto.BOOL, + number=242744629, + optional=True, + ) + + class InsertNetworkEndpointGroupRequest(proto.Message): r"""A request message for NetworkEndpointGroups.Insert. See the method description for details. @@ -28678,6 +30258,51 @@ class InsertNetworkEndpointGroupRequest(proto.Message): ) +class InsertNetworkFirewallPolicyRequest(proto.Message): + r"""A request message for NetworkFirewallPolicies.Insert. See the + method description for details. + + Attributes: + firewall_policy_resource (google.cloud.compute_v1.types.FirewallPolicy): + The body resource for this request + project (str): + Project ID for this request. + request_id (str): + An optional request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. For example, consider a situation + where you make an initial request and the + request times out. If you make the request again + with the same request ID, the server can check + if original operation with the same request ID + was received, and if so, will ignore the second + request. This prevents clients from accidentally + creating duplicate commitments. The request ID + must be a valid UUID with the exception that + zero UUID is not supported ( + 00000000-0000-0000-0000-000000000000). + + This field is a member of `oneof`_ ``_request_id``. + """ + + firewall_policy_resource = proto.Field( + proto.MESSAGE, + number=495049532, + message="FirewallPolicy", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + + class InsertNetworkRequest(proto.Message): r"""A request message for Networks.Insert. See the method description for details. @@ -29398,12 +31023,12 @@ class InsertRegionNetworkEndpointGroupRequest(proto.Message): ) -class InsertRegionNotificationEndpointRequest(proto.Message): - r"""A request message for RegionNotificationEndpoints.Insert. See - the method description for details. +class InsertRegionNetworkFirewallPolicyRequest(proto.Message): + r"""A request message for RegionNetworkFirewallPolicies.Insert. + See the method description for details. Attributes: - notification_endpoint_resource (google.cloud.compute_v1.types.NotificationEndpoint): + firewall_policy_resource (google.cloud.compute_v1.types.FirewallPolicy): The body resource for this request project (str): Project ID for this request. @@ -29429,10 +31054,10 @@ class InsertRegionNotificationEndpointRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - notification_endpoint_resource = proto.Field( + firewall_policy_resource = proto.Field( proto.MESSAGE, - number=338459940, - message="NotificationEndpoint", + number=495049532, + message="FirewallPolicy", ) project = proto.Field( proto.STRING, @@ -29449,11 +31074,13 @@ class InsertRegionNotificationEndpointRequest(proto.Message): ) -class InsertRegionSslCertificateRequest(proto.Message): - r"""A request message for RegionSslCertificates.Insert. See the - method description for details. +class InsertRegionNotificationEndpointRequest(proto.Message): + r"""A request message for RegionNotificationEndpoints.Insert. See + the method description for details. Attributes: + notification_endpoint_resource (google.cloud.compute_v1.types.NotificationEndpoint): + The body resource for this request project (str): Project ID for this request. region (str): @@ -29476,10 +31103,13 @@ class InsertRegionSslCertificateRequest(proto.Message): 00000000-0000-0000-0000-000000000000). This field is a member of `oneof`_ ``_request_id``. - ssl_certificate_resource (google.cloud.compute_v1.types.SslCertificate): - The body resource for this request """ + notification_endpoint_resource = proto.Field( + proto.MESSAGE, + number=338459940, + message="NotificationEndpoint", + ) project = proto.Field( proto.STRING, number=227560217, @@ -29493,15 +31123,10 @@ class InsertRegionSslCertificateRequest(proto.Message): number=37109963, optional=True, ) - ssl_certificate_resource = proto.Field( - proto.MESSAGE, - number=180709897, - message="SslCertificate", - ) -class InsertRegionTargetHttpProxyRequest(proto.Message): - r"""A request message for RegionTargetHttpProxies.Insert. See the +class InsertRegionSecurityPolicyRequest(proto.Message): + r"""A request message for RegionSecurityPolicies.Insert. See the method description for details. Attributes: @@ -29527,8 +31152,12 @@ class InsertRegionTargetHttpProxyRequest(proto.Message): 00000000-0000-0000-0000-000000000000). This field is a member of `oneof`_ ``_request_id``. - target_http_proxy_resource (google.cloud.compute_v1.types.TargetHttpProxy): + security_policy_resource (google.cloud.compute_v1.types.SecurityPolicy): The body resource for this request + validate_only (bool): + If true, the request will not be committed. + + This field is a member of `oneof`_ ``_validate_only``. """ project = proto.Field( @@ -29544,16 +31173,21 @@ class InsertRegionTargetHttpProxyRequest(proto.Message): number=37109963, optional=True, ) - target_http_proxy_resource = proto.Field( + security_policy_resource = proto.Field( proto.MESSAGE, - number=24696744, - message="TargetHttpProxy", + number=216159612, + message="SecurityPolicy", + ) + validate_only = proto.Field( + proto.BOOL, + number=242744629, + optional=True, ) -class InsertRegionTargetHttpsProxyRequest(proto.Message): - r"""A request message for RegionTargetHttpsProxies.Insert. See - the method description for details. +class InsertRegionSslCertificateRequest(proto.Message): + r"""A request message for RegionSslCertificates.Insert. See the + method description for details. Attributes: project (str): @@ -29578,7 +31212,7 @@ class InsertRegionTargetHttpsProxyRequest(proto.Message): 00000000-0000-0000-0000-000000000000). This field is a member of `oneof`_ ``_request_id``. - target_https_proxy_resource (google.cloud.compute_v1.types.TargetHttpsProxy): + ssl_certificate_resource (google.cloud.compute_v1.types.SslCertificate): The body resource for this request """ @@ -29595,16 +31229,16 @@ class InsertRegionTargetHttpsProxyRequest(proto.Message): number=37109963, optional=True, ) - target_https_proxy_resource = proto.Field( + ssl_certificate_resource = proto.Field( proto.MESSAGE, - number=433657473, - message="TargetHttpsProxy", + number=180709897, + message="SslCertificate", ) -class InsertRegionUrlMapRequest(proto.Message): - r"""A request message for RegionUrlMaps.Insert. See the method - description for details. +class InsertRegionTargetHttpProxyRequest(proto.Message): + r"""A request message for RegionTargetHttpProxies.Insert. See the + method description for details. Attributes: project (str): @@ -29612,11 +31246,24 @@ class InsertRegionUrlMapRequest(proto.Message): region (str): Name of the region scoping this request. request_id (str): - begin_interface: MixerMutationRequestBuilder Request ID to - support idempotency. + An optional request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. For example, consider a situation + where you make an initial request and the + request times out. If you make the request again + with the same request ID, the server can check + if original operation with the same request ID + was received, and if so, will ignore the second + request. This prevents clients from accidentally + creating duplicate commitments. The request ID + must be a valid UUID with the exception that + zero UUID is not supported ( + 00000000-0000-0000-0000-000000000000). This field is a member of `oneof`_ ``_request_id``. - url_map_resource (google.cloud.compute_v1.types.UrlMap): + target_http_proxy_resource (google.cloud.compute_v1.types.TargetHttpProxy): The body resource for this request """ @@ -29633,20 +31280,22 @@ class InsertRegionUrlMapRequest(proto.Message): number=37109963, optional=True, ) - url_map_resource = proto.Field( + target_http_proxy_resource = proto.Field( proto.MESSAGE, - number=168675425, - message="UrlMap", + number=24696744, + message="TargetHttpProxy", ) -class InsertReservationRequest(proto.Message): - r"""A request message for Reservations.Insert. See the method - description for details. +class InsertRegionTargetHttpsProxyRequest(proto.Message): + r"""A request message for RegionTargetHttpsProxies.Insert. See + the method description for details. Attributes: project (str): Project ID for this request. + region (str): + Name of the region scoping this request. request_id (str): An optional request ID to identify requests. Specify a unique request ID so that if you must @@ -29665,60 +31314,45 @@ class InsertReservationRequest(proto.Message): 00000000-0000-0000-0000-000000000000). This field is a member of `oneof`_ ``_request_id``. - reservation_resource (google.cloud.compute_v1.types.Reservation): + target_https_proxy_resource (google.cloud.compute_v1.types.TargetHttpsProxy): The body resource for this request - zone (str): - Name of the zone for this request. """ project = proto.Field( proto.STRING, number=227560217, ) + region = proto.Field( + proto.STRING, + number=138946292, + ) request_id = proto.Field( proto.STRING, number=37109963, optional=True, ) - reservation_resource = proto.Field( + target_https_proxy_resource = proto.Field( proto.MESSAGE, - number=285030177, - message="Reservation", - ) - zone = proto.Field( - proto.STRING, - number=3744684, + number=433657473, + message="TargetHttpsProxy", ) -class InsertResourcePolicyRequest(proto.Message): - r"""A request message for ResourcePolicies.Insert. See the method +class InsertRegionUrlMapRequest(proto.Message): + r"""A request message for RegionUrlMaps.Insert. See the method description for details. Attributes: project (str): Project ID for this request. region (str): - Name of the region for this request. + Name of the region scoping this request. request_id (str): - An optional request ID to identify requests. - Specify a unique request ID so that if you must - retry your request, the server will know to - ignore the request if it has already been - completed. For example, consider a situation - where you make an initial request and the - request times out. If you make the request again - with the same request ID, the server can check - if original operation with the same request ID - was received, and if so, will ignore the second - request. This prevents clients from accidentally - creating duplicate commitments. The request ID - must be a valid UUID with the exception that - zero UUID is not supported ( - 00000000-0000-0000-0000-000000000000). + begin_interface: MixerMutationRequestBuilder Request ID to + support idempotency. This field is a member of `oneof`_ ``_request_id``. - resource_policy_resource (google.cloud.compute_v1.types.ResourcePolicy): + url_map_resource (google.cloud.compute_v1.types.UrlMap): The body resource for this request """ @@ -29735,15 +31369,15 @@ class InsertResourcePolicyRequest(proto.Message): number=37109963, optional=True, ) - resource_policy_resource = proto.Field( + url_map_resource = proto.Field( proto.MESSAGE, - number=76826186, - message="ResourcePolicy", + number=168675425, + message="UrlMap", ) -class InsertRouteRequest(proto.Message): - r"""A request message for Routes.Insert. See the method +class InsertReservationRequest(proto.Message): + r"""A request message for Reservations.Insert. See the method description for details. Attributes: @@ -29767,8 +31401,10 @@ class InsertRouteRequest(proto.Message): 00000000-0000-0000-0000-000000000000). This field is a member of `oneof`_ ``_request_id``. - route_resource (google.cloud.compute_v1.types.Route): + reservation_resource (google.cloud.compute_v1.types.Reservation): The body resource for this request + zone (str): + Name of the zone for this request. """ project = proto.Field( @@ -29780,15 +31416,19 @@ class InsertRouteRequest(proto.Message): number=37109963, optional=True, ) - route_resource = proto.Field( + reservation_resource = proto.Field( proto.MESSAGE, - number=225428804, - message="Route", + number=285030177, + message="Reservation", + ) + zone = proto.Field( + proto.STRING, + number=3744684, ) -class InsertRouterRequest(proto.Message): - r"""A request message for Routers.Insert. See the method +class InsertResourcePolicyRequest(proto.Message): + r"""A request message for ResourcePolicies.Insert. See the method description for details. Attributes: @@ -29814,7 +31454,7 @@ class InsertRouterRequest(proto.Message): 00000000-0000-0000-0000-000000000000). This field is a member of `oneof`_ ``_request_id``. - router_resource (google.cloud.compute_v1.types.Router): + resource_policy_resource (google.cloud.compute_v1.types.ResourcePolicy): The body resource for this request """ @@ -29831,15 +31471,15 @@ class InsertRouterRequest(proto.Message): number=37109963, optional=True, ) - router_resource = proto.Field( + resource_policy_resource = proto.Field( proto.MESSAGE, - number=155222084, - message="Router", + number=76826186, + message="ResourcePolicy", ) -class InsertSecurityPolicyRequest(proto.Message): - r"""A request message for SecurityPolicies.Insert. See the method +class InsertRouteRequest(proto.Message): + r"""A request message for Routes.Insert. See the method description for details. Attributes: @@ -29863,7 +31503,7 @@ class InsertSecurityPolicyRequest(proto.Message): 00000000-0000-0000-0000-000000000000). This field is a member of `oneof`_ ``_request_id``. - security_policy_resource (google.cloud.compute_v1.types.SecurityPolicy): + route_resource (google.cloud.compute_v1.types.Route): The body resource for this request """ @@ -29876,22 +31516,22 @@ class InsertSecurityPolicyRequest(proto.Message): number=37109963, optional=True, ) - security_policy_resource = proto.Field( + route_resource = proto.Field( proto.MESSAGE, - number=216159612, - message="SecurityPolicy", + number=225428804, + message="Route", ) -class InsertServiceAttachmentRequest(proto.Message): - r"""A request message for ServiceAttachments.Insert. See the - method description for details. +class InsertRouterRequest(proto.Message): + r"""A request message for Routers.Insert. See the method + description for details. Attributes: project (str): Project ID for this request. region (str): - Name of the region of this request. + Name of the region for this request. request_id (str): An optional request ID to identify requests. Specify a unique request ID so that if you must @@ -29910,7 +31550,7 @@ class InsertServiceAttachmentRequest(proto.Message): 00000000-0000-0000-0000-000000000000). This field is a member of `oneof`_ ``_request_id``. - service_attachment_resource (google.cloud.compute_v1.types.ServiceAttachment): + router_resource (google.cloud.compute_v1.types.Router): The body resource for this request """ @@ -29927,105 +31567,15 @@ class InsertServiceAttachmentRequest(proto.Message): number=37109963, optional=True, ) - service_attachment_resource = proto.Field( - proto.MESSAGE, - number=472980256, - message="ServiceAttachment", - ) - - -class InsertSnapshotRequest(proto.Message): - r"""A request message for Snapshots.Insert. See the method - description for details. - - Attributes: - project (str): - Project ID for this request. - request_id (str): - An optional request ID to identify requests. - Specify a unique request ID so that if you must - retry your request, the server will know to - ignore the request if it has already been - completed. For example, consider a situation - where you make an initial request and the - request times out. If you make the request again - with the same request ID, the server can check - if original operation with the same request ID - was received, and if so, will ignore the second - request. This prevents clients from accidentally - creating duplicate commitments. The request ID - must be a valid UUID with the exception that - zero UUID is not supported ( - 00000000-0000-0000-0000-000000000000). - - This field is a member of `oneof`_ ``_request_id``. - snapshot_resource (google.cloud.compute_v1.types.Snapshot): - The body resource for this request - """ - - project = proto.Field( - proto.STRING, - number=227560217, - ) - request_id = proto.Field( - proto.STRING, - number=37109963, - optional=True, - ) - snapshot_resource = proto.Field( - proto.MESSAGE, - number=481319977, - message="Snapshot", - ) - - -class InsertSslCertificateRequest(proto.Message): - r"""A request message for SslCertificates.Insert. See the method - description for details. - - Attributes: - project (str): - Project ID for this request. - request_id (str): - An optional request ID to identify requests. - Specify a unique request ID so that if you must - retry your request, the server will know to - ignore the request if it has already been - completed. For example, consider a situation - where you make an initial request and the - request times out. If you make the request again - with the same request ID, the server can check - if original operation with the same request ID - was received, and if so, will ignore the second - request. This prevents clients from accidentally - creating duplicate commitments. The request ID - must be a valid UUID with the exception that - zero UUID is not supported ( - 00000000-0000-0000-0000-000000000000). - - This field is a member of `oneof`_ ``_request_id``. - ssl_certificate_resource (google.cloud.compute_v1.types.SslCertificate): - The body resource for this request - """ - - project = proto.Field( - proto.STRING, - number=227560217, - ) - request_id = proto.Field( - proto.STRING, - number=37109963, - optional=True, - ) - ssl_certificate_resource = proto.Field( + router_resource = proto.Field( proto.MESSAGE, - number=180709897, - message="SslCertificate", + number=155222084, + message="Router", ) -class InsertSslPolicyRequest(proto.Message): - r"""A request message for SslPolicies.Insert. See the method +class InsertSecurityPolicyRequest(proto.Message): + r"""A request message for SecurityPolicies.Insert. See the method description for details. Attributes: @@ -30049,7 +31599,7 @@ class InsertSslPolicyRequest(proto.Message): 00000000-0000-0000-0000-000000000000). This field is a member of `oneof`_ ``_request_id``. - ssl_policy_resource (google.cloud.compute_v1.types.SslPolicy): + security_policy_resource (google.cloud.compute_v1.types.SecurityPolicy): The body resource for this request """ @@ -30062,22 +31612,22 @@ class InsertSslPolicyRequest(proto.Message): number=37109963, optional=True, ) - ssl_policy_resource = proto.Field( + security_policy_resource = proto.Field( proto.MESSAGE, - number=274891848, - message="SslPolicy", + number=216159612, + message="SecurityPolicy", ) -class InsertSubnetworkRequest(proto.Message): - r"""A request message for Subnetworks.Insert. See the method - description for details. +class InsertServiceAttachmentRequest(proto.Message): + r"""A request message for ServiceAttachments.Insert. See the + method description for details. Attributes: project (str): Project ID for this request. region (str): - Name of the region scoping this request. + Name of the region of this request. request_id (str): An optional request ID to identify requests. Specify a unique request ID so that if you must @@ -30096,7 +31646,7 @@ class InsertSubnetworkRequest(proto.Message): 00000000-0000-0000-0000-000000000000). This field is a member of `oneof`_ ``_request_id``. - subnetwork_resource (google.cloud.compute_v1.types.Subnetwork): + service_attachment_resource (google.cloud.compute_v1.types.ServiceAttachment): The body resource for this request """ @@ -30113,16 +31663,16 @@ class InsertSubnetworkRequest(proto.Message): number=37109963, optional=True, ) - subnetwork_resource = proto.Field( + service_attachment_resource = proto.Field( proto.MESSAGE, - number=42233151, - message="Subnetwork", + number=472980256, + message="ServiceAttachment", ) -class InsertTargetGrpcProxyRequest(proto.Message): - r"""A request message for TargetGrpcProxies.Insert. See the - method description for details. +class InsertSnapshotRequest(proto.Message): + r"""A request message for Snapshots.Insert. See the method + description for details. Attributes: project (str): @@ -30145,7 +31695,7 @@ class InsertTargetGrpcProxyRequest(proto.Message): 00000000-0000-0000-0000-000000000000). This field is a member of `oneof`_ ``_request_id``. - target_grpc_proxy_resource (google.cloud.compute_v1.types.TargetGrpcProxy): + snapshot_resource (google.cloud.compute_v1.types.Snapshot): The body resource for this request """ @@ -30158,16 +31708,16 @@ class InsertTargetGrpcProxyRequest(proto.Message): number=37109963, optional=True, ) - target_grpc_proxy_resource = proto.Field( + snapshot_resource = proto.Field( proto.MESSAGE, - number=328922450, - message="TargetGrpcProxy", + number=481319977, + message="Snapshot", ) -class InsertTargetHttpProxyRequest(proto.Message): - r"""A request message for TargetHttpProxies.Insert. See the - method description for details. +class InsertSslCertificateRequest(proto.Message): + r"""A request message for SslCertificates.Insert. See the method + description for details. Attributes: project (str): @@ -30190,7 +31740,7 @@ class InsertTargetHttpProxyRequest(proto.Message): 00000000-0000-0000-0000-000000000000). This field is a member of `oneof`_ ``_request_id``. - target_http_proxy_resource (google.cloud.compute_v1.types.TargetHttpProxy): + ssl_certificate_resource (google.cloud.compute_v1.types.SslCertificate): The body resource for this request """ @@ -30203,16 +31753,16 @@ class InsertTargetHttpProxyRequest(proto.Message): number=37109963, optional=True, ) - target_http_proxy_resource = proto.Field( + ssl_certificate_resource = proto.Field( proto.MESSAGE, - number=24696744, - message="TargetHttpProxy", + number=180709897, + message="SslCertificate", ) -class InsertTargetHttpsProxyRequest(proto.Message): - r"""A request message for TargetHttpsProxies.Insert. See the - method description for details. +class InsertSslPolicyRequest(proto.Message): + r"""A request message for SslPolicies.Insert. See the method + description for details. Attributes: project (str): @@ -30235,7 +31785,7 @@ class InsertTargetHttpsProxyRequest(proto.Message): 00000000-0000-0000-0000-000000000000). This field is a member of `oneof`_ ``_request_id``. - target_https_proxy_resource (google.cloud.compute_v1.types.TargetHttpsProxy): + ssl_policy_resource (google.cloud.compute_v1.types.SslPolicy): The body resource for this request """ @@ -30248,20 +31798,22 @@ class InsertTargetHttpsProxyRequest(proto.Message): number=37109963, optional=True, ) - target_https_proxy_resource = proto.Field( + ssl_policy_resource = proto.Field( proto.MESSAGE, - number=433657473, - message="TargetHttpsProxy", + number=274891848, + message="SslPolicy", ) -class InsertTargetInstanceRequest(proto.Message): - r"""A request message for TargetInstances.Insert. See the method +class InsertSubnetworkRequest(proto.Message): + r"""A request message for Subnetworks.Insert. See the method description for details. Attributes: project (str): Project ID for this request. + region (str): + Name of the region scoping this request. request_id (str): An optional request ID to identify requests. Specify a unique request ID so that if you must @@ -30280,41 +31832,37 @@ class InsertTargetInstanceRequest(proto.Message): 00000000-0000-0000-0000-000000000000). This field is a member of `oneof`_ ``_request_id``. - target_instance_resource (google.cloud.compute_v1.types.TargetInstance): + subnetwork_resource (google.cloud.compute_v1.types.Subnetwork): The body resource for this request - zone (str): - Name of the zone scoping this request. """ project = proto.Field( proto.STRING, number=227560217, ) + region = proto.Field( + proto.STRING, + number=138946292, + ) request_id = proto.Field( proto.STRING, number=37109963, optional=True, ) - target_instance_resource = proto.Field( + subnetwork_resource = proto.Field( proto.MESSAGE, - number=430453066, - message="TargetInstance", - ) - zone = proto.Field( - proto.STRING, - number=3744684, + number=42233151, + message="Subnetwork", ) -class InsertTargetPoolRequest(proto.Message): - r"""A request message for TargetPools.Insert. See the method - description for details. +class InsertTargetGrpcProxyRequest(proto.Message): + r"""A request message for TargetGrpcProxies.Insert. See the + method description for details. Attributes: project (str): Project ID for this request. - region (str): - Name of the region scoping this request. request_id (str): An optional request ID to identify requests. Specify a unique request ID so that if you must @@ -30333,7 +31881,7 @@ class InsertTargetPoolRequest(proto.Message): 00000000-0000-0000-0000-000000000000). This field is a member of `oneof`_ ``_request_id``. - target_pool_resource (google.cloud.compute_v1.types.TargetPool): + target_grpc_proxy_resource (google.cloud.compute_v1.types.TargetGrpcProxy): The body resource for this request """ @@ -30341,25 +31889,21 @@ class InsertTargetPoolRequest(proto.Message): proto.STRING, number=227560217, ) - region = proto.Field( - proto.STRING, - number=138946292, - ) request_id = proto.Field( proto.STRING, number=37109963, optional=True, ) - target_pool_resource = proto.Field( + target_grpc_proxy_resource = proto.Field( proto.MESSAGE, - number=101281443, - message="TargetPool", + number=328922450, + message="TargetGrpcProxy", ) -class InsertTargetSslProxyRequest(proto.Message): - r"""A request message for TargetSslProxies.Insert. See the method - description for details. +class InsertTargetHttpProxyRequest(proto.Message): + r"""A request message for TargetHttpProxies.Insert. See the + method description for details. Attributes: project (str): @@ -30382,7 +31926,7 @@ class InsertTargetSslProxyRequest(proto.Message): 00000000-0000-0000-0000-000000000000). This field is a member of `oneof`_ ``_request_id``. - target_ssl_proxy_resource (google.cloud.compute_v1.types.TargetSslProxy): + target_http_proxy_resource (google.cloud.compute_v1.types.TargetHttpProxy): The body resource for this request """ @@ -30395,16 +31939,208 @@ class InsertTargetSslProxyRequest(proto.Message): number=37109963, optional=True, ) - target_ssl_proxy_resource = proto.Field( + target_http_proxy_resource = proto.Field( proto.MESSAGE, - number=142016192, - message="TargetSslProxy", + number=24696744, + message="TargetHttpProxy", ) -class InsertTargetTcpProxyRequest(proto.Message): - r"""A request message for TargetTcpProxies.Insert. See the method - description for details. +class InsertTargetHttpsProxyRequest(proto.Message): + r"""A request message for TargetHttpsProxies.Insert. See the + method description for details. + + Attributes: + project (str): + Project ID for this request. + request_id (str): + An optional request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. For example, consider a situation + where you make an initial request and the + request times out. If you make the request again + with the same request ID, the server can check + if original operation with the same request ID + was received, and if so, will ignore the second + request. This prevents clients from accidentally + creating duplicate commitments. The request ID + must be a valid UUID with the exception that + zero UUID is not supported ( + 00000000-0000-0000-0000-000000000000). + + This field is a member of `oneof`_ ``_request_id``. + target_https_proxy_resource (google.cloud.compute_v1.types.TargetHttpsProxy): + The body resource for this request + """ + + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + target_https_proxy_resource = proto.Field( + proto.MESSAGE, + number=433657473, + message="TargetHttpsProxy", + ) + + +class InsertTargetInstanceRequest(proto.Message): + r"""A request message for TargetInstances.Insert. See the method + description for details. + + Attributes: + project (str): + Project ID for this request. + request_id (str): + An optional request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. For example, consider a situation + where you make an initial request and the + request times out. If you make the request again + with the same request ID, the server can check + if original operation with the same request ID + was received, and if so, will ignore the second + request. This prevents clients from accidentally + creating duplicate commitments. The request ID + must be a valid UUID with the exception that + zero UUID is not supported ( + 00000000-0000-0000-0000-000000000000). + + This field is a member of `oneof`_ ``_request_id``. + target_instance_resource (google.cloud.compute_v1.types.TargetInstance): + The body resource for this request + zone (str): + Name of the zone scoping this request. + """ + + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + target_instance_resource = proto.Field( + proto.MESSAGE, + number=430453066, + message="TargetInstance", + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) + + +class InsertTargetPoolRequest(proto.Message): + r"""A request message for TargetPools.Insert. See the method + description for details. + + Attributes: + project (str): + Project ID for this request. + region (str): + Name of the region scoping this request. + request_id (str): + An optional request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. For example, consider a situation + where you make an initial request and the + request times out. If you make the request again + with the same request ID, the server can check + if original operation with the same request ID + was received, and if so, will ignore the second + request. This prevents clients from accidentally + creating duplicate commitments. The request ID + must be a valid UUID with the exception that + zero UUID is not supported ( + 00000000-0000-0000-0000-000000000000). + + This field is a member of `oneof`_ ``_request_id``. + target_pool_resource (google.cloud.compute_v1.types.TargetPool): + The body resource for this request + """ + + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + target_pool_resource = proto.Field( + proto.MESSAGE, + number=101281443, + message="TargetPool", + ) + + +class InsertTargetSslProxyRequest(proto.Message): + r"""A request message for TargetSslProxies.Insert. See the method + description for details. + + Attributes: + project (str): + Project ID for this request. + request_id (str): + An optional request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. For example, consider a situation + where you make an initial request and the + request times out. If you make the request again + with the same request ID, the server can check + if original operation with the same request ID + was received, and if so, will ignore the second + request. This prevents clients from accidentally + creating duplicate commitments. The request ID + must be a valid UUID with the exception that + zero UUID is not supported ( + 00000000-0000-0000-0000-000000000000). + + This field is a member of `oneof`_ ``_request_id``. + target_ssl_proxy_resource (google.cloud.compute_v1.types.TargetSslProxy): + The body resource for this request + """ + + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + target_ssl_proxy_resource = proto.Field( + proto.MESSAGE, + number=142016192, + message="TargetSslProxy", + ) + + +class InsertTargetTcpProxyRequest(proto.Message): + r"""A request message for TargetTcpProxies.Insert. See the method + description for details. Attributes: project (str): @@ -30741,7 +32477,7 @@ class Instance(proto.Message): get() request to the instance. This field is a member of `oneof`_ ``_label_fingerprint``. - labels (Sequence[google.cloud.compute_v1.types.Instance.LabelsEntry]): + labels (Mapping[str, str]): Labels to apply to this instance. These can be later modified by the setLabels method. last_start_timestamp (str): @@ -30813,6 +32549,11 @@ class Instance(proto.Message): network_performance_config (google.cloud.compute_v1.types.NetworkPerformanceConfig): This field is a member of `oneof`_ ``_network_performance_config``. + params (google.cloud.compute_v1.types.InstanceParams): + Input only. [Input Only] Additional params passed with the + request, but not persisted as part of resource payload. + + This field is a member of `oneof`_ ``_params``. private_ipv6_google_access (str): The private IPv6 google access type for the VM. If not specified, use INHERIT_FROM_SUBNETWORK as default. Check the @@ -31058,6 +32799,12 @@ class Status(proto.Enum): optional=True, message="NetworkPerformanceConfig", ) + params = proto.Field( + proto.MESSAGE, + number=78313862, + optional=True, + message="InstanceParams", + ) private_ipv6_google_access = proto.Field( proto.STRING, number=48277006, @@ -31154,7 +32901,7 @@ class InstanceAggregatedList(proto.Message): the server. This field is a member of `oneof`_ ``_id``. - items (Sequence[google.cloud.compute_v1.types.InstanceAggregatedList.ItemsEntry]): + items (Mapping[str, google.cloud.compute_v1.types.InstancesScopedList]): An object that contains a list of instances scoped by zone. kind (str): @@ -31275,9 +33022,10 @@ class InstanceGroup(proto.Message): Assigns a name to a port number. For example: {name: "http", port: 80} This allows the system to reference ports by the assigned name instead of a port number. Named ports can also - contain multiple ports. For example: [{name: "http", port: - 80},{name: "http", port: 8080}] Named ports apply to all - instances in this instance group. + contain multiple ports. For example: [{name: "app1", port: + 8080}, {name: "app1", port: 8081}, {name: "app2", port: + 8082}] Named ports apply to all instances in this instance + group. network (str): [Output Only] The URL of the network to which all instances in the instance group belong. If your instance has multiple @@ -31392,7 +33140,7 @@ class InstanceGroupAggregatedList(proto.Message): the server. This field is a member of `oneof`_ ``_id``. - items (Sequence[google.cloud.compute_v1.types.InstanceGroupAggregatedList.ItemsEntry]): + items (Mapping[str, google.cloud.compute_v1.types.InstanceGroupsScopedList]): A list of InstanceGroupsScopedList resources. kind (str): [Output Only] The resource type, which is always @@ -31969,7 +33717,7 @@ class InstanceGroupManagerAggregatedList(proto.Message): the server. This field is a member of `oneof`_ ``_id``. - items (Sequence[google.cloud.compute_v1.types.InstanceGroupManagerAggregatedList.ItemsEntry]): + items (Mapping[str, google.cloud.compute_v1.types.InstanceGroupManagersScopedList]): A list of InstanceGroupManagersScopedList resources. kind (str): @@ -32290,7 +34038,9 @@ class InstanceGroupManagerUpdatePolicy(proto.Message): to maintain an even distribution of VM instances across zones in the region. - NONE: For non-autoscaled groups, proactive redistribution - is disabled. + is disabled. Check the + InstanceRedistributionType enum for the list of + possible values. This field is a member of `oneof`_ ``_instance_redistribution_type``. max_surge (google.cloud.compute_v1.types.FixedOrPercent): @@ -32339,7 +34089,9 @@ class InstanceGroupManagerUpdatePolicy(proto.Message): attempt to perform that action only. However, if the Updater determines that the minimal action you specify is not enough to perform the update, - it might perform a more disruptive action. + it might perform a more disruptive action. Check + the MinimalAction enum for the list of possible + values. This field is a member of `oneof`_ ``_minimal_action``. most_disruptive_allowed_action (str): @@ -32353,12 +34105,14 @@ class InstanceGroupManagerUpdatePolicy(proto.Message): that the minimal update action needed is more disruptive than most disruptive allowed action you specify it will not perform the update at - all. + all. Check the MostDisruptiveAllowedAction enum + for the list of possible values. This field is a member of `oneof`_ ``_most_disruptive_allowed_action``. replacement_method (str): What action should be used to replace instances. See - minimal_action.REPLACE + minimal_action.REPLACE Check the ReplacementMethod enum for + the list of possible values. This field is a member of `oneof`_ ``_replacement_method``. type_ (str): @@ -32369,11 +34123,78 @@ class InstanceGroupManagerUpdatePolicy(proto.Message): OPPORTUNISTIC so that no action is proactively executed but the update will be performed as part of other actions (for example, resizes or - recreateInstances calls). + recreateInstances calls). Check the Type enum + for the list of possible values. This field is a member of `oneof`_ ``_type``. """ + class InstanceRedistributionType(proto.Enum): + r"""The instance redistribution policy for regional managed + instance groups. Valid values are: - PROACTIVE (default): The + group attempts to maintain an even distribution of VM instances + across zones in the region. - NONE: For non-autoscaled groups, + proactive redistribution is disabled. Additional supported + values which may be not listed in the enum directly due to + technical reasons: NONE + PROACTIVE + """ + UNDEFINED_INSTANCE_REDISTRIBUTION_TYPE = 0 + + class MinimalAction(proto.Enum): + r"""Minimal action to be taken on an instance. You can specify + either RESTART to restart existing instances or REPLACE to + delete and create new instances from the target template. If you + specify a RESTART, the Updater will attempt to perform that + action only. However, if the Updater determines that the minimal + action you specify is not enough to perform the update, it might + perform a more disruptive action. Additional supported values + which may be not listed in the enum directly due to technical + reasons: NONE + REFRESH + REPLACE + RESTART + """ + UNDEFINED_MINIMAL_ACTION = 0 + + class MostDisruptiveAllowedAction(proto.Enum): + r"""Most disruptive action that is allowed to be taken on an + instance. You can specify either NONE to forbid any actions, + REFRESH to allow actions that do not need instance restart, + RESTART to allow actions that can be applied without instance + replacing or REPLACE to allow all possible actions. If the + Updater determines that the minimal update action needed is more + disruptive than most disruptive allowed action you specify it + will not perform the update at all. Additional supported values + which may be not listed in the enum directly due to technical + reasons: NONE + REFRESH + REPLACE + RESTART + """ + UNDEFINED_MOST_DISRUPTIVE_ALLOWED_ACTION = 0 + + class ReplacementMethod(proto.Enum): + r"""What action should be used to replace instances. See + minimal_action.REPLACE + """ + UNDEFINED_REPLACEMENT_METHOD = 0 + RECREATE = 522644719 + SUBSTITUTE = 280924314 + + class Type(proto.Enum): + r"""The type of update process. You can specify either PROACTIVE + so that the instance group manager proactively executes actions + in order to bring instances to their target versions or + OPPORTUNISTIC so that no action is proactively executed but the + update will be performed as part of other actions (for example, + resizes or recreateInstances calls). Additional supported values + which may be not listed in the enum directly due to technical + reasons: PROACTIVE + """ + UNDEFINED_TYPE = 0 + OPPORTUNISTIC = 429530089 + instance_redistribution_type = proto.Field( proto.STRING, number=292630424, @@ -32509,7 +34330,9 @@ class InstanceGroupManagersApplyUpdatesRequest(proto.Message): default, the minimum action is NONE. If your update requires a more disruptive action than you set with this flag, the necessary action is - performed to execute the update. + performed to execute the update. Check the + MinimalAction enum for the list of possible + values. This field is a member of `oneof`_ ``_minimal_action``. most_disruptive_allowed_action (str): @@ -32522,11 +34345,45 @@ class InstanceGroupManagersApplyUpdatesRequest(proto.Message): default, the most disruptive allowed action is REPLACE. If your update requires a more disruptive action than you set with this flag, - the update request will fail. + the update request will fail. Check the + MostDisruptiveAllowedAction enum for the list of + possible values. This field is a member of `oneof`_ ``_most_disruptive_allowed_action``. """ + class MinimalAction(proto.Enum): + r"""The minimal action that you want to perform on each instance + during the update: - REPLACE: At minimum, delete the instance + and create it again. - RESTART: Stop the instance and start it + again. - REFRESH: Do not stop the instance. - NONE: Do not + disrupt the instance at all. By default, the minimum action is + NONE. If your update requires a more disruptive action than you + set with this flag, the necessary action is performed to execute + the update. Additional supported values which may be not listed + in the enum directly due to technical reasons: NONE + REFRESH + REPLACE + RESTART + """ + UNDEFINED_MINIMAL_ACTION = 0 + + class MostDisruptiveAllowedAction(proto.Enum): + r"""The most disruptive action that you want to perform on each + instance during the update: - REPLACE: Delete the instance and + create it again. - RESTART: Stop the instance and start it + again. - REFRESH: Do not stop the instance. - NONE: Do not + disrupt the instance at all. By default, the most disruptive + allowed action is REPLACE. If your update requires a more + disruptive action than you set with this flag, the update + request will fail. Additional supported values which may be not + listed in the enum directly due to technical reasons: NONE + REFRESH + REPLACE + RESTART + """ + UNDEFINED_MOST_DISRUPTIVE_ALLOWED_ACTION = 0 + all_instances = proto.Field( proto.BOOL, number=403676512, @@ -33368,6 +35225,25 @@ class InstanceMoveRequest(proto.Message): ) +class InstanceParams(proto.Message): + r"""Additional instance params. + + Attributes: + resource_manager_tags (Mapping[str, str]): + Resource manager tags to be bound to the instance. Tag keys + and values have the same definition as resource manager + tags. Keys must be in the format ``tagKeys/{tag_key_id}``, + and values are in the format ``tagValues/456``. The field is + ignored (both PUT & PATCH) when empty. + """ + + resource_manager_tags = proto.MapField( + proto.STRING, + proto.STRING, + number=377671164, + ) + + class InstanceProperties(proto.Message): r""" @@ -33410,7 +35286,7 @@ class InstanceProperties(proto.Message): A list of guest accelerator cards' type and count to use for instances created from these properties. - labels (Sequence[google.cloud.compute_v1.types.InstanceProperties.LabelsEntry]): + labels (Mapping[str, str]): Labels to apply to instances that are created from these properties. machine_type (str): @@ -33459,7 +35335,7 @@ class InstanceProperties(proto.Message): is not supported yet. This field is a member of `oneof`_ ``_reservation_affinity``. - resource_manager_tags (Sequence[google.cloud.compute_v1.types.InstanceProperties.ResourceManagerTagsEntry]): + resource_manager_tags (Mapping[str, str]): Resource manager tags to be bound to the instance. Tag keys and values have the same definition as resource manager tags. Keys must be in the format ``tagKeys/{tag_key_id}``, @@ -33928,16 +35804,21 @@ class InstancesGetEffectiveFirewallsResponseEffectiveFirewallPolicy(proto.Messag This field is a member of `oneof`_ ``_short_name``. type_ (str): - [Output Only] The type of the firewall policy. Check the - Type enum for the list of possible values. + [Output Only] The type of the firewall policy. Can be one of + HIERARCHY, NETWORK, NETWORK_REGIONAL. Check the Type enum + for the list of possible values. This field is a member of `oneof`_ ``_type``. """ class Type(proto.Enum): - r"""[Output Only] The type of the firewall policy.""" + r"""[Output Only] The type of the firewall policy. Can be one of + HIERARCHY, NETWORK, NETWORK_REGIONAL. + """ UNDEFINED_TYPE = 0 HIERARCHY = 69902869 + NETWORK = 413984270 + NETWORK_REGIONAL = 190804272 UNSPECIFIED = 526786327 display_name = proto.Field( @@ -34019,7 +35900,7 @@ class InstancesSetLabelsRequest(proto.Message): a request to add or change labels. This field is a member of `oneof`_ ``_label_fingerprint``. - labels (Sequence[google.cloud.compute_v1.types.InstancesSetLabelsRequest.LabelsEntry]): + labels (Mapping[str, str]): """ @@ -34522,17 +36403,7 @@ class InterconnectAttachment(proto.Message): This field is a member of `oneof`_ ``_bandwidth``. candidate_ipv6_subnets (Sequence[str]): - Up to 16 candidate prefixes that control the - allocation of cloudRouterIpv6Address and - customerRouterIpv6Address for this attachment. - Each prefix must be in the Global Unique Address - (GUA) space. It is highly recommended that it be - in a range owned by the requestor. A GUA in a - range owned by Google will cause the request to - fail. Google will select an available prefix - from the supplied candidates or fail the - request. If not supplied, a /125 from a - Google-owned GUA block will be selected. + This field is not available. candidate_subnets (Sequence[str]): Up to 16 candidate prefixes that can be used to restrict the allocation of @@ -34557,12 +36428,7 @@ class InterconnectAttachment(proto.Message): This field is a member of `oneof`_ ``_cloud_router_ipv6_address``. cloud_router_ipv6_interface_id (str): - If supplied, the interface id (index within - the subnet) to be used for the cloud router - address. The id must be in the range of 1 to 6. - If a subnet mask is supplied, it must be /125, - and the subnet should either be 0 or match the - selected subnet. + This field is not available. This field is a member of `oneof`_ ``_cloud_router_ipv6_interface_id``. creation_timestamp (str): @@ -34582,17 +36448,11 @@ class InterconnectAttachment(proto.Message): This field is a member of `oneof`_ ``_customer_router_ipv6_address``. customer_router_ipv6_interface_id (str): - If supplied, the interface id (index within - the subnet) to be used for the customer router - address. The id must be in the range of 1 to 6. - If a subnet mask is supplied, it must be /125, - and the subnet should either be 0 or match the - selected subnet. + This field is not available. This field is a member of `oneof`_ ``_customer_router_ipv6_interface_id``. dataplane_version (int): - [Output only for types PARTNER and DEDICATED. Not present - for PARTNER_PROVIDER.] Dataplane version for this + [Output Only] Dataplane version for this InterconnectAttachment. This field is only present for Dataplane version 2 and higher. Absence of this field in the API output indicates that the Dataplane is version 1. @@ -35116,7 +36976,7 @@ class InterconnectAttachmentAggregatedList(proto.Message): the server. This field is a member of `oneof`_ ``_id``. - items (Sequence[google.cloud.compute_v1.types.InterconnectAttachmentAggregatedList.ItemsEntry]): + items (Mapping[str, google.cloud.compute_v1.types.InterconnectAttachmentsScopedList]): A list of InterconnectAttachmentsScopedList resources. kind (str): @@ -37086,107 +38946,540 @@ class ListAvailableFeaturesSslPoliciesRequest(proto.Message): number=336120696, optional=True, ) - max_results = proto.Field( - proto.UINT32, - number=54715419, - optional=True, - ) - order_by = proto.Field( - proto.STRING, - number=160562920, - optional=True, - ) - page_token = proto.Field( - proto.STRING, - number=19994697, - optional=True, - ) - project = proto.Field( - proto.STRING, - number=227560217, - ) - return_partial_success = proto.Field( - proto.BOOL, - number=517198390, - optional=True, - ) - - -class ListBackendBucketsRequest(proto.Message): - r"""A request message for BackendBuckets.List. See the method - description for details. - - Attributes: - filter (str): - A filter expression that filters resources listed in the - response. The expression must specify the field name, an - operator, and the value that you want to use for filtering. - The value must be a string, a number, or a boolean. The - operator must be either ``=``, ``!=``, ``>``, ``<``, ``<=``, - ``>=`` or ``:``. For example, if you are filtering Compute - Engine instances, you can exclude instances named - ``example-instance`` by specifying - ``name != example-instance``. The ``:`` operator can be used - with string fields to match substrings. For non-string - fields it is equivalent to the ``=`` operator. The ``:*`` - comparison can be used to test whether a key has been - defined. For example, to find all objects with ``owner`` - label use: ``labels.owner:*`` You can also filter nested - fields. For example, you could specify - ``scheduling.automaticRestart = false`` to include instances - only if they are not scheduled for automatic restarts. You - can use filtering on nested fields to filter based on - resource labels. To filter on multiple expressions, provide - each separate expression within parentheses. For example: - ``(scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake")`` - By default, each expression is an ``AND`` expression. - However, you can include ``AND`` and ``OR`` expressions - explicitly. For example: - ``(cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true)`` - - This field is a member of `oneof`_ ``_filter``. - max_results (int): - The maximum number of results per page that should be - returned. If the number of available results is larger than - ``maxResults``, Compute Engine returns a ``nextPageToken`` - that can be used to get the next page of results in - subsequent list requests. Acceptable values are ``0`` to - ``500``, inclusive. (Default: ``500``) - - This field is a member of `oneof`_ ``_max_results``. - order_by (str): - Sorts list results by a certain order. By default, results - are returned in alphanumerical order based on the resource - name. You can also sort results in descending order based on - the creation timestamp using - ``orderBy="creationTimestamp desc"``. This sorts results - based on the ``creationTimestamp`` field in reverse - chronological order (newest result first). Use this to sort - resources like operations so that the newest operation is - returned first. Currently, only sorting by ``name`` or - ``creationTimestamp desc`` is supported. - - This field is a member of `oneof`_ ``_order_by``. - page_token (str): - Specifies a page token to use. Set ``pageToken`` to the - ``nextPageToken`` returned by a previous list request to get - the next page of results. - - This field is a member of `oneof`_ ``_page_token``. - project (str): - Project ID for this request. - return_partial_success (bool): - Opt-in for partial success behavior which - provides partial results in case of failure. The - default value is false. - - This field is a member of `oneof`_ ``_return_partial_success``. - """ - - filter = proto.Field( + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) + + +class ListBackendBucketsRequest(proto.Message): + r"""A request message for BackendBuckets.List. See the method + description for details. + + Attributes: + filter (str): + A filter expression that filters resources listed in the + response. The expression must specify the field name, an + operator, and the value that you want to use for filtering. + The value must be a string, a number, or a boolean. The + operator must be either ``=``, ``!=``, ``>``, ``<``, ``<=``, + ``>=`` or ``:``. For example, if you are filtering Compute + Engine instances, you can exclude instances named + ``example-instance`` by specifying + ``name != example-instance``. The ``:`` operator can be used + with string fields to match substrings. For non-string + fields it is equivalent to the ``=`` operator. The ``:*`` + comparison can be used to test whether a key has been + defined. For example, to find all objects with ``owner`` + label use: ``labels.owner:*`` You can also filter nested + fields. For example, you could specify + ``scheduling.automaticRestart = false`` to include instances + only if they are not scheduled for automatic restarts. You + can use filtering on nested fields to filter based on + resource labels. To filter on multiple expressions, provide + each separate expression within parentheses. For example: + ``(scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake")`` + By default, each expression is an ``AND`` expression. + However, you can include ``AND`` and ``OR`` expressions + explicitly. For example: + ``(cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true)`` + + This field is a member of `oneof`_ ``_filter``. + max_results (int): + The maximum number of results per page that should be + returned. If the number of available results is larger than + ``maxResults``, Compute Engine returns a ``nextPageToken`` + that can be used to get the next page of results in + subsequent list requests. Acceptable values are ``0`` to + ``500``, inclusive. (Default: ``500``) + + This field is a member of `oneof`_ ``_max_results``. + order_by (str): + Sorts list results by a certain order. By default, results + are returned in alphanumerical order based on the resource + name. You can also sort results in descending order based on + the creation timestamp using + ``orderBy="creationTimestamp desc"``. This sorts results + based on the ``creationTimestamp`` field in reverse + chronological order (newest result first). Use this to sort + resources like operations so that the newest operation is + returned first. Currently, only sorting by ``name`` or + ``creationTimestamp desc`` is supported. + + This field is a member of `oneof`_ ``_order_by``. + page_token (str): + Specifies a page token to use. Set ``pageToken`` to the + ``nextPageToken`` returned by a previous list request to get + the next page of results. + + This field is a member of `oneof`_ ``_page_token``. + project (str): + Project ID for this request. + return_partial_success (bool): + Opt-in for partial success behavior which + provides partial results in case of failure. The + default value is false. + + This field is a member of `oneof`_ ``_return_partial_success``. + """ + + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) + + +class ListBackendServicesRequest(proto.Message): + r"""A request message for BackendServices.List. See the method + description for details. + + Attributes: + filter (str): + A filter expression that filters resources listed in the + response. The expression must specify the field name, an + operator, and the value that you want to use for filtering. + The value must be a string, a number, or a boolean. The + operator must be either ``=``, ``!=``, ``>``, ``<``, ``<=``, + ``>=`` or ``:``. For example, if you are filtering Compute + Engine instances, you can exclude instances named + ``example-instance`` by specifying + ``name != example-instance``. The ``:`` operator can be used + with string fields to match substrings. For non-string + fields it is equivalent to the ``=`` operator. The ``:*`` + comparison can be used to test whether a key has been + defined. For example, to find all objects with ``owner`` + label use: ``labels.owner:*`` You can also filter nested + fields. For example, you could specify + ``scheduling.automaticRestart = false`` to include instances + only if they are not scheduled for automatic restarts. You + can use filtering on nested fields to filter based on + resource labels. To filter on multiple expressions, provide + each separate expression within parentheses. For example: + ``(scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake")`` + By default, each expression is an ``AND`` expression. + However, you can include ``AND`` and ``OR`` expressions + explicitly. For example: + ``(cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true)`` + + This field is a member of `oneof`_ ``_filter``. + max_results (int): + The maximum number of results per page that should be + returned. If the number of available results is larger than + ``maxResults``, Compute Engine returns a ``nextPageToken`` + that can be used to get the next page of results in + subsequent list requests. Acceptable values are ``0`` to + ``500``, inclusive. (Default: ``500``) + + This field is a member of `oneof`_ ``_max_results``. + order_by (str): + Sorts list results by a certain order. By default, results + are returned in alphanumerical order based on the resource + name. You can also sort results in descending order based on + the creation timestamp using + ``orderBy="creationTimestamp desc"``. This sorts results + based on the ``creationTimestamp`` field in reverse + chronological order (newest result first). Use this to sort + resources like operations so that the newest operation is + returned first. Currently, only sorting by ``name`` or + ``creationTimestamp desc`` is supported. + + This field is a member of `oneof`_ ``_order_by``. + page_token (str): + Specifies a page token to use. Set ``pageToken`` to the + ``nextPageToken`` returned by a previous list request to get + the next page of results. + + This field is a member of `oneof`_ ``_page_token``. + project (str): + Project ID for this request. + return_partial_success (bool): + Opt-in for partial success behavior which + provides partial results in case of failure. The + default value is false. + + This field is a member of `oneof`_ ``_return_partial_success``. + """ + + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) + + +class ListDiskTypesRequest(proto.Message): + r"""A request message for DiskTypes.List. See the method + description for details. + + Attributes: + filter (str): + A filter expression that filters resources listed in the + response. The expression must specify the field name, an + operator, and the value that you want to use for filtering. + The value must be a string, a number, or a boolean. The + operator must be either ``=``, ``!=``, ``>``, ``<``, ``<=``, + ``>=`` or ``:``. For example, if you are filtering Compute + Engine instances, you can exclude instances named + ``example-instance`` by specifying + ``name != example-instance``. The ``:`` operator can be used + with string fields to match substrings. For non-string + fields it is equivalent to the ``=`` operator. The ``:*`` + comparison can be used to test whether a key has been + defined. For example, to find all objects with ``owner`` + label use: ``labels.owner:*`` You can also filter nested + fields. For example, you could specify + ``scheduling.automaticRestart = false`` to include instances + only if they are not scheduled for automatic restarts. You + can use filtering on nested fields to filter based on + resource labels. To filter on multiple expressions, provide + each separate expression within parentheses. For example: + ``(scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake")`` + By default, each expression is an ``AND`` expression. + However, you can include ``AND`` and ``OR`` expressions + explicitly. For example: + ``(cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true)`` + + This field is a member of `oneof`_ ``_filter``. + max_results (int): + The maximum number of results per page that should be + returned. If the number of available results is larger than + ``maxResults``, Compute Engine returns a ``nextPageToken`` + that can be used to get the next page of results in + subsequent list requests. Acceptable values are ``0`` to + ``500``, inclusive. (Default: ``500``) + + This field is a member of `oneof`_ ``_max_results``. + order_by (str): + Sorts list results by a certain order. By default, results + are returned in alphanumerical order based on the resource + name. You can also sort results in descending order based on + the creation timestamp using + ``orderBy="creationTimestamp desc"``. This sorts results + based on the ``creationTimestamp`` field in reverse + chronological order (newest result first). Use this to sort + resources like operations so that the newest operation is + returned first. Currently, only sorting by ``name`` or + ``creationTimestamp desc`` is supported. + + This field is a member of `oneof`_ ``_order_by``. + page_token (str): + Specifies a page token to use. Set ``pageToken`` to the + ``nextPageToken`` returned by a previous list request to get + the next page of results. + + This field is a member of `oneof`_ ``_page_token``. + project (str): + Project ID for this request. + return_partial_success (bool): + Opt-in for partial success behavior which + provides partial results in case of failure. The + default value is false. + + This field is a member of `oneof`_ ``_return_partial_success``. + zone (str): + The name of the zone for this request. + """ + + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) + + +class ListDisksRequest(proto.Message): + r"""A request message for Disks.List. See the method description + for details. + + Attributes: + filter (str): + A filter expression that filters resources listed in the + response. The expression must specify the field name, an + operator, and the value that you want to use for filtering. + The value must be a string, a number, or a boolean. The + operator must be either ``=``, ``!=``, ``>``, ``<``, ``<=``, + ``>=`` or ``:``. For example, if you are filtering Compute + Engine instances, you can exclude instances named + ``example-instance`` by specifying + ``name != example-instance``. The ``:`` operator can be used + with string fields to match substrings. For non-string + fields it is equivalent to the ``=`` operator. The ``:*`` + comparison can be used to test whether a key has been + defined. For example, to find all objects with ``owner`` + label use: ``labels.owner:*`` You can also filter nested + fields. For example, you could specify + ``scheduling.automaticRestart = false`` to include instances + only if they are not scheduled for automatic restarts. You + can use filtering on nested fields to filter based on + resource labels. To filter on multiple expressions, provide + each separate expression within parentheses. For example: + ``(scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake")`` + By default, each expression is an ``AND`` expression. + However, you can include ``AND`` and ``OR`` expressions + explicitly. For example: + ``(cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true)`` + + This field is a member of `oneof`_ ``_filter``. + max_results (int): + The maximum number of results per page that should be + returned. If the number of available results is larger than + ``maxResults``, Compute Engine returns a ``nextPageToken`` + that can be used to get the next page of results in + subsequent list requests. Acceptable values are ``0`` to + ``500``, inclusive. (Default: ``500``) + + This field is a member of `oneof`_ ``_max_results``. + order_by (str): + Sorts list results by a certain order. By default, results + are returned in alphanumerical order based on the resource + name. You can also sort results in descending order based on + the creation timestamp using + ``orderBy="creationTimestamp desc"``. This sorts results + based on the ``creationTimestamp`` field in reverse + chronological order (newest result first). Use this to sort + resources like operations so that the newest operation is + returned first. Currently, only sorting by ``name`` or + ``creationTimestamp desc`` is supported. + + This field is a member of `oneof`_ ``_order_by``. + page_token (str): + Specifies a page token to use. Set ``pageToken`` to the + ``nextPageToken`` returned by a previous list request to get + the next page of results. + + This field is a member of `oneof`_ ``_page_token``. + project (str): + Project ID for this request. + return_partial_success (bool): + Opt-in for partial success behavior which + provides partial results in case of failure. The + default value is false. + + This field is a member of `oneof`_ ``_return_partial_success``. + zone (str): + The name of the zone for this request. + """ + + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( + proto.STRING, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) + + +class ListErrorsInstanceGroupManagersRequest(proto.Message): + r"""A request message for InstanceGroupManagers.ListErrors. See + the method description for details. + + Attributes: + filter (str): + A filter expression that filters resources listed in the + response. The expression must specify the field name, an + operator, and the value that you want to use for filtering. + The value must be a string, a number, or a boolean. The + operator must be either ``=``, ``!=``, ``>``, ``<``, ``<=``, + ``>=`` or ``:``. For example, if you are filtering Compute + Engine instances, you can exclude instances named + ``example-instance`` by specifying + ``name != example-instance``. The ``:`` operator can be used + with string fields to match substrings. For non-string + fields it is equivalent to the ``=`` operator. The ``:*`` + comparison can be used to test whether a key has been + defined. For example, to find all objects with ``owner`` + label use: ``labels.owner:*`` You can also filter nested + fields. For example, you could specify + ``scheduling.automaticRestart = false`` to include instances + only if they are not scheduled for automatic restarts. You + can use filtering on nested fields to filter based on + resource labels. To filter on multiple expressions, provide + each separate expression within parentheses. For example: + ``(scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake")`` + By default, each expression is an ``AND`` expression. + However, you can include ``AND`` and ``OR`` expressions + explicitly. For example: + ``(cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true)`` + + This field is a member of `oneof`_ ``_filter``. + instance_group_manager (str): + The name of the managed instance group. It must be a string + that meets the requirements in RFC1035, or an unsigned long + integer: must match regexp pattern: + (?:`a-z `__?)|1-9{0,19}. + max_results (int): + The maximum number of results per page that should be + returned. If the number of available results is larger than + ``maxResults``, Compute Engine returns a ``nextPageToken`` + that can be used to get the next page of results in + subsequent list requests. Acceptable values are ``0`` to + ``500``, inclusive. (Default: ``500``) + + This field is a member of `oneof`_ ``_max_results``. + order_by (str): + Sorts list results by a certain order. By default, results + are returned in alphanumerical order based on the resource + name. You can also sort results in descending order based on + the creation timestamp using + ``orderBy="creationTimestamp desc"``. This sorts results + based on the ``creationTimestamp`` field in reverse + chronological order (newest result first). Use this to sort + resources like operations so that the newest operation is + returned first. Currently, only sorting by ``name`` or + ``creationTimestamp desc`` is supported. + + This field is a member of `oneof`_ ``_order_by``. + page_token (str): + Specifies a page token to use. Set ``pageToken`` to the + ``nextPageToken`` returned by a previous list request to get + the next page of results. + + This field is a member of `oneof`_ ``_page_token``. + project (str): + Project ID for this request. + return_partial_success (bool): + Opt-in for partial success behavior which + provides partial results in case of failure. The + default value is false. + + This field is a member of `oneof`_ ``_return_partial_success``. + zone (str): + The name of the zone where the managed + instance group is located. It should conform to + RFC1035. + """ + + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, + ) + instance_group_manager = proto.Field( proto.STRING, - number=336120696, - optional=True, + number=249363395, ) max_results = proto.Field( proto.UINT32, @@ -37212,11 +39505,15 @@ class ListBackendBucketsRequest(proto.Message): number=517198390, optional=True, ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) -class ListBackendServicesRequest(proto.Message): - r"""A request message for BackendServices.List. See the method - description for details. +class ListErrorsRegionInstanceGroupManagersRequest(proto.Message): + r"""A request message for RegionInstanceGroupManagers.ListErrors. + See the method description for details. Attributes: filter (str): @@ -37247,6 +39544,11 @@ class ListBackendServicesRequest(proto.Message): ``(cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true)`` This field is a member of `oneof`_ ``_filter``. + instance_group_manager (str): + The name of the managed instance group. It must be a string + that meets the requirements in RFC1035, or an unsigned long + integer: must match regexp pattern: + (?:`a-z `__?)|1-9{0,19}. max_results (int): The maximum number of results per page that should be returned. If the number of available results is larger than @@ -37277,6 +39579,9 @@ class ListBackendServicesRequest(proto.Message): This field is a member of `oneof`_ ``_page_token``. project (str): Project ID for this request. + region (str): + Name of the region scoping this request. This + should conform to RFC1035. return_partial_success (bool): Opt-in for partial success behavior which provides partial results in case of failure. The @@ -37290,6 +39595,10 @@ class ListBackendServicesRequest(proto.Message): number=336120696, optional=True, ) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) max_results = proto.Field( proto.UINT32, number=54715419, @@ -37309,6 +39618,10 @@ class ListBackendServicesRequest(proto.Message): proto.STRING, number=227560217, ) + region = proto.Field( + proto.STRING, + number=138946292, + ) return_partial_success = proto.Field( proto.BOOL, number=517198390, @@ -37316,9 +39629,9 @@ class ListBackendServicesRequest(proto.Message): ) -class ListDiskTypesRequest(proto.Message): - r"""A request message for DiskTypes.List. See the method - description for details. +class ListExternalVpnGatewaysRequest(proto.Message): + r"""A request message for ExternalVpnGateways.List. See the + method description for details. Attributes: filter (str): @@ -37385,8 +39698,6 @@ class ListDiskTypesRequest(proto.Message): default value is false. This field is a member of `oneof`_ ``_return_partial_success``. - zone (str): - The name of the zone for this request. """ filter = proto.Field( @@ -37418,15 +39729,11 @@ class ListDiskTypesRequest(proto.Message): number=517198390, optional=True, ) - zone = proto.Field( - proto.STRING, - number=3744684, - ) -class ListDisksRequest(proto.Message): - r"""A request message for Disks.List. See the method description - for details. +class ListFirewallPoliciesRequest(proto.Message): + r"""A request message for FirewallPolicies.List. See the method + description for details. Attributes: filter (str): @@ -37485,16 +39792,16 @@ class ListDisksRequest(proto.Message): the next page of results. This field is a member of `oneof`_ ``_page_token``. - project (str): - Project ID for this request. + parent_id (str): + Parent ID for this request. + + This field is a member of `oneof`_ ``_parent_id``. return_partial_success (bool): Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. This field is a member of `oneof`_ ``_return_partial_success``. - zone (str): - The name of the zone for this request. """ filter = proto.Field( @@ -37517,24 +39824,21 @@ class ListDisksRequest(proto.Message): number=19994697, optional=True, ) - project = proto.Field( + parent_id = proto.Field( proto.STRING, - number=227560217, + number=459714768, + optional=True, ) return_partial_success = proto.Field( proto.BOOL, number=517198390, optional=True, ) - zone = proto.Field( - proto.STRING, - number=3744684, - ) -class ListErrorsInstanceGroupManagersRequest(proto.Message): - r"""A request message for InstanceGroupManagers.ListErrors. See - the method description for details. +class ListFirewallsRequest(proto.Message): + r"""A request message for Firewalls.List. See the method + description for details. Attributes: filter (str): @@ -37565,11 +39869,6 @@ class ListErrorsInstanceGroupManagersRequest(proto.Message): ``(cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true)`` This field is a member of `oneof`_ ``_filter``. - instance_group_manager (str): - The name of the managed instance group. It must be a string - that meets the requirements in RFC1035, or an unsigned long - integer: must match regexp pattern: - (?:`a-z `__?)|1-9{0,19}. max_results (int): The maximum number of results per page that should be returned. If the number of available results is larger than @@ -37606,10 +39905,6 @@ class ListErrorsInstanceGroupManagersRequest(proto.Message): default value is false. This field is a member of `oneof`_ ``_return_partial_success``. - zone (str): - The name of the zone where the managed - instance group is located. It should conform to - RFC1035. """ filter = proto.Field( @@ -37617,10 +39912,6 @@ class ListErrorsInstanceGroupManagersRequest(proto.Message): number=336120696, optional=True, ) - instance_group_manager = proto.Field( - proto.STRING, - number=249363395, - ) max_results = proto.Field( proto.UINT32, number=54715419, @@ -37645,15 +39936,11 @@ class ListErrorsInstanceGroupManagersRequest(proto.Message): number=517198390, optional=True, ) - zone = proto.Field( - proto.STRING, - number=3744684, - ) -class ListErrorsRegionInstanceGroupManagersRequest(proto.Message): - r"""A request message for RegionInstanceGroupManagers.ListErrors. - See the method description for details. +class ListForwardingRulesRequest(proto.Message): + r"""A request message for ForwardingRules.List. See the method + description for details. Attributes: filter (str): @@ -37684,11 +39971,6 @@ class ListErrorsRegionInstanceGroupManagersRequest(proto.Message): ``(cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true)`` This field is a member of `oneof`_ ``_filter``. - instance_group_manager (str): - The name of the managed instance group. It must be a string - that meets the requirements in RFC1035, or an unsigned long - integer: must match regexp pattern: - (?:`a-z `__?)|1-9{0,19}. max_results (int): The maximum number of results per page that should be returned. If the number of available results is larger than @@ -37720,8 +40002,7 @@ class ListErrorsRegionInstanceGroupManagersRequest(proto.Message): project (str): Project ID for this request. region (str): - Name of the region scoping this request. This - should conform to RFC1035. + Name of the region scoping this request. return_partial_success (bool): Opt-in for partial success behavior which provides partial results in case of failure. The @@ -37735,10 +40016,6 @@ class ListErrorsRegionInstanceGroupManagersRequest(proto.Message): number=336120696, optional=True, ) - instance_group_manager = proto.Field( - proto.STRING, - number=249363395, - ) max_results = proto.Field( proto.UINT32, number=54715419, @@ -37769,9 +40046,9 @@ class ListErrorsRegionInstanceGroupManagersRequest(proto.Message): ) -class ListExternalVpnGatewaysRequest(proto.Message): - r"""A request message for ExternalVpnGateways.List. See the - method description for details. +class ListGlobalAddressesRequest(proto.Message): + r"""A request message for GlobalAddresses.List. See the method + description for details. Attributes: filter (str): @@ -37871,9 +40148,9 @@ class ListExternalVpnGatewaysRequest(proto.Message): ) -class ListFirewallPoliciesRequest(proto.Message): - r"""A request message for FirewallPolicies.List. See the method - description for details. +class ListGlobalForwardingRulesRequest(proto.Message): + r"""A request message for GlobalForwardingRules.List. See the + method description for details. Attributes: filter (str): @@ -37932,10 +40209,8 @@ class ListFirewallPoliciesRequest(proto.Message): the next page of results. This field is a member of `oneof`_ ``_page_token``. - parent_id (str): - Parent ID for this request. - - This field is a member of `oneof`_ ``_parent_id``. + project (str): + Project ID for this request. return_partial_success (bool): Opt-in for partial success behavior which provides partial results in case of failure. The @@ -37964,10 +40239,9 @@ class ListFirewallPoliciesRequest(proto.Message): number=19994697, optional=True, ) - parent_id = proto.Field( + project = proto.Field( proto.STRING, - number=459714768, - optional=True, + number=227560217, ) return_partial_success = proto.Field( proto.BOOL, @@ -37976,9 +40250,9 @@ class ListFirewallPoliciesRequest(proto.Message): ) -class ListFirewallsRequest(proto.Message): - r"""A request message for Firewalls.List. See the method - description for details. +class ListGlobalNetworkEndpointGroupsRequest(proto.Message): + r"""A request message for GlobalNetworkEndpointGroups.List. See + the method description for details. Attributes: filter (str): @@ -38078,8 +40352,8 @@ class ListFirewallsRequest(proto.Message): ) -class ListForwardingRulesRequest(proto.Message): - r"""A request message for ForwardingRules.List. See the method +class ListGlobalOperationsRequest(proto.Message): + r"""A request message for GlobalOperations.List. See the method description for details. Attributes: @@ -38141,8 +40415,6 @@ class ListForwardingRulesRequest(proto.Message): This field is a member of `oneof`_ ``_page_token``. project (str): Project ID for this request. - region (str): - Name of the region scoping this request. return_partial_success (bool): Opt-in for partial success behavior which provides partial results in case of failure. The @@ -38175,10 +40447,6 @@ class ListForwardingRulesRequest(proto.Message): proto.STRING, number=227560217, ) - region = proto.Field( - proto.STRING, - number=138946292, - ) return_partial_success = proto.Field( proto.BOOL, number=517198390, @@ -38186,9 +40454,9 @@ class ListForwardingRulesRequest(proto.Message): ) -class ListGlobalAddressesRequest(proto.Message): - r"""A request message for GlobalAddresses.List. See the method - description for details. +class ListGlobalOrganizationOperationsRequest(proto.Message): + r"""A request message for GlobalOrganizationOperations.List. See + the method description for details. Attributes: filter (str): @@ -38247,8 +40515,10 @@ class ListGlobalAddressesRequest(proto.Message): the next page of results. This field is a member of `oneof`_ ``_page_token``. - project (str): - Project ID for this request. + parent_id (str): + Parent ID for this request. + + This field is a member of `oneof`_ ``_parent_id``. return_partial_success (bool): Opt-in for partial success behavior which provides partial results in case of failure. The @@ -38277,9 +40547,10 @@ class ListGlobalAddressesRequest(proto.Message): number=19994697, optional=True, ) - project = proto.Field( + parent_id = proto.Field( proto.STRING, - number=227560217, + number=459714768, + optional=True, ) return_partial_success = proto.Field( proto.BOOL, @@ -38288,9 +40559,9 @@ class ListGlobalAddressesRequest(proto.Message): ) -class ListGlobalForwardingRulesRequest(proto.Message): - r"""A request message for GlobalForwardingRules.List. See the - method description for details. +class ListGlobalPublicDelegatedPrefixesRequest(proto.Message): + r"""A request message for GlobalPublicDelegatedPrefixes.List. See + the method description for details. Attributes: filter (str): @@ -38390,9 +40661,9 @@ class ListGlobalForwardingRulesRequest(proto.Message): ) -class ListGlobalNetworkEndpointGroupsRequest(proto.Message): - r"""A request message for GlobalNetworkEndpointGroups.List. See - the method description for details. +class ListHealthChecksRequest(proto.Message): + r"""A request message for HealthChecks.List. See the method + description for details. Attributes: filter (str): @@ -38492,9 +40763,9 @@ class ListGlobalNetworkEndpointGroupsRequest(proto.Message): ) -class ListGlobalOperationsRequest(proto.Message): - r"""A request message for GlobalOperations.List. See the method - description for details. +class ListImagesRequest(proto.Message): + r"""A request message for Images.List. See the method description + for details. Attributes: filter (str): @@ -38594,114 +40865,9 @@ class ListGlobalOperationsRequest(proto.Message): ) -class ListGlobalOrganizationOperationsRequest(proto.Message): - r"""A request message for GlobalOrganizationOperations.List. See - the method description for details. - - Attributes: - filter (str): - A filter expression that filters resources listed in the - response. The expression must specify the field name, an - operator, and the value that you want to use for filtering. - The value must be a string, a number, or a boolean. The - operator must be either ``=``, ``!=``, ``>``, ``<``, ``<=``, - ``>=`` or ``:``. For example, if you are filtering Compute - Engine instances, you can exclude instances named - ``example-instance`` by specifying - ``name != example-instance``. The ``:`` operator can be used - with string fields to match substrings. For non-string - fields it is equivalent to the ``=`` operator. The ``:*`` - comparison can be used to test whether a key has been - defined. For example, to find all objects with ``owner`` - label use: ``labels.owner:*`` You can also filter nested - fields. For example, you could specify - ``scheduling.automaticRestart = false`` to include instances - only if they are not scheduled for automatic restarts. You - can use filtering on nested fields to filter based on - resource labels. To filter on multiple expressions, provide - each separate expression within parentheses. For example: - ``(scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake")`` - By default, each expression is an ``AND`` expression. - However, you can include ``AND`` and ``OR`` expressions - explicitly. For example: - ``(cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true)`` - - This field is a member of `oneof`_ ``_filter``. - max_results (int): - The maximum number of results per page that should be - returned. If the number of available results is larger than - ``maxResults``, Compute Engine returns a ``nextPageToken`` - that can be used to get the next page of results in - subsequent list requests. Acceptable values are ``0`` to - ``500``, inclusive. (Default: ``500``) - - This field is a member of `oneof`_ ``_max_results``. - order_by (str): - Sorts list results by a certain order. By default, results - are returned in alphanumerical order based on the resource - name. You can also sort results in descending order based on - the creation timestamp using - ``orderBy="creationTimestamp desc"``. This sorts results - based on the ``creationTimestamp`` field in reverse - chronological order (newest result first). Use this to sort - resources like operations so that the newest operation is - returned first. Currently, only sorting by ``name`` or - ``creationTimestamp desc`` is supported. - - This field is a member of `oneof`_ ``_order_by``. - page_token (str): - Specifies a page token to use. Set ``pageToken`` to the - ``nextPageToken`` returned by a previous list request to get - the next page of results. - - This field is a member of `oneof`_ ``_page_token``. - parent_id (str): - Parent ID for this request. - - This field is a member of `oneof`_ ``_parent_id``. - return_partial_success (bool): - Opt-in for partial success behavior which - provides partial results in case of failure. The - default value is false. - - This field is a member of `oneof`_ ``_return_partial_success``. - """ - - filter = proto.Field( - proto.STRING, - number=336120696, - optional=True, - ) - max_results = proto.Field( - proto.UINT32, - number=54715419, - optional=True, - ) - order_by = proto.Field( - proto.STRING, - number=160562920, - optional=True, - ) - page_token = proto.Field( - proto.STRING, - number=19994697, - optional=True, - ) - parent_id = proto.Field( - proto.STRING, - number=459714768, - optional=True, - ) - return_partial_success = proto.Field( - proto.BOOL, - number=517198390, - optional=True, - ) - - -class ListGlobalPublicDelegatedPrefixesRequest(proto.Message): - r"""A request message for GlobalPublicDelegatedPrefixes.List. See - the method description for details. +class ListInstanceGroupManagersRequest(proto.Message): + r"""A request message for InstanceGroupManagers.List. See the + method description for details. Attributes: filter (str): @@ -38768,6 +40934,9 @@ class ListGlobalPublicDelegatedPrefixesRequest(proto.Message): default value is false. This field is a member of `oneof`_ ``_return_partial_success``. + zone (str): + The name of the zone where the managed + instance group is located. """ filter = proto.Field( @@ -38799,10 +40968,14 @@ class ListGlobalPublicDelegatedPrefixesRequest(proto.Message): number=517198390, optional=True, ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) -class ListHealthChecksRequest(proto.Message): - r"""A request message for HealthChecks.List. See the method +class ListInstanceGroupsRequest(proto.Message): + r"""A request message for InstanceGroups.List. See the method description for details. Attributes: @@ -38870,6 +41043,9 @@ class ListHealthChecksRequest(proto.Message): default value is false. This field is a member of `oneof`_ ``_return_partial_success``. + zone (str): + The name of the zone where the instance group + is located. """ filter = proto.Field( @@ -38901,11 +41077,15 @@ class ListHealthChecksRequest(proto.Message): number=517198390, optional=True, ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) -class ListImagesRequest(proto.Message): - r"""A request message for Images.List. See the method description - for details. +class ListInstanceTemplatesRequest(proto.Message): + r"""A request message for InstanceTemplates.List. See the method + description for details. Attributes: filter (str): @@ -39005,8 +41185,8 @@ class ListImagesRequest(proto.Message): ) -class ListInstanceGroupManagersRequest(proto.Message): - r"""A request message for InstanceGroupManagers.List. See the +class ListInstancesInstanceGroupsRequest(proto.Message): + r"""A request message for InstanceGroups.ListInstances. See the method description for details. Attributes: @@ -39038,6 +41218,11 @@ class ListInstanceGroupManagersRequest(proto.Message): ``(cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true)`` This field is a member of `oneof`_ ``_filter``. + instance_group (str): + The name of the instance group from which you + want to generate a list of included instances. + instance_groups_list_instances_request_resource (google.cloud.compute_v1.types.InstanceGroupsListInstancesRequest): + The body resource for this request max_results (int): The maximum number of results per page that should be returned. If the number of available results is larger than @@ -39075,8 +41260,8 @@ class ListInstanceGroupManagersRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. zone (str): - The name of the zone where the managed - instance group is located. + The name of the zone where the instance group + is located. """ filter = proto.Field( @@ -39084,6 +41269,15 @@ class ListInstanceGroupManagersRequest(proto.Message): number=336120696, optional=True, ) + instance_group = proto.Field( + proto.STRING, + number=81095253, + ) + instance_groups_list_instances_request_resource = proto.Field( + proto.MESSAGE, + number=476255263, + message="InstanceGroupsListInstancesRequest", + ) max_results = proto.Field( proto.UINT32, number=54715419, @@ -39114,9 +41308,9 @@ class ListInstanceGroupManagersRequest(proto.Message): ) -class ListInstanceGroupsRequest(proto.Message): - r"""A request message for InstanceGroups.List. See the method - description for details. +class ListInstancesRegionInstanceGroupsRequest(proto.Message): + r"""A request message for RegionInstanceGroups.ListInstances. See + the method description for details. Attributes: filter (str): @@ -39147,6 +41341,9 @@ class ListInstanceGroupsRequest(proto.Message): ``(cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true)`` This field is a member of `oneof`_ ``_filter``. + instance_group (str): + Name of the regional instance group for which + we want to list the instances. max_results (int): The maximum number of results per page that should be returned. If the number of available results is larger than @@ -39177,15 +41374,16 @@ class ListInstanceGroupsRequest(proto.Message): This field is a member of `oneof`_ ``_page_token``. project (str): Project ID for this request. + region (str): + Name of the region scoping this request. + region_instance_groups_list_instances_request_resource (google.cloud.compute_v1.types.RegionInstanceGroupsListInstancesRequest): + The body resource for this request return_partial_success (bool): Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. This field is a member of `oneof`_ ``_return_partial_success``. - zone (str): - The name of the zone where the instance group - is located. """ filter = proto.Field( @@ -39193,6 +41391,10 @@ class ListInstanceGroupsRequest(proto.Message): number=336120696, optional=True, ) + instance_group = proto.Field( + proto.STRING, + number=81095253, + ) max_results = proto.Field( proto.UINT32, number=54715419, @@ -39212,19 +41414,24 @@ class ListInstanceGroupsRequest(proto.Message): proto.STRING, number=227560217, ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + region_instance_groups_list_instances_request_resource = proto.Field( + proto.MESSAGE, + number=48239828, + message="RegionInstanceGroupsListInstancesRequest", + ) return_partial_success = proto.Field( proto.BOOL, number=517198390, optional=True, ) - zone = proto.Field( - proto.STRING, - number=3744684, - ) -class ListInstanceTemplatesRequest(proto.Message): - r"""A request message for InstanceTemplates.List. See the method +class ListInstancesRequest(proto.Message): + r"""A request message for Instances.List. See the method description for details. Attributes: @@ -39292,6 +41499,8 @@ class ListInstanceTemplatesRequest(proto.Message): default value is false. This field is a member of `oneof`_ ``_return_partial_success``. + zone (str): + The name of the zone for this request. """ filter = proto.Field( @@ -39323,10 +41532,14 @@ class ListInstanceTemplatesRequest(proto.Message): number=517198390, optional=True, ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) -class ListInstancesInstanceGroupsRequest(proto.Message): - r"""A request message for InstanceGroups.ListInstances. See the +class ListInterconnectAttachmentsRequest(proto.Message): + r"""A request message for InterconnectAttachments.List. See the method description for details. Attributes: @@ -39358,11 +41571,6 @@ class ListInstancesInstanceGroupsRequest(proto.Message): ``(cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true)`` This field is a member of `oneof`_ ``_filter``. - instance_group (str): - The name of the instance group from which you - want to generate a list of included instances. - instance_groups_list_instances_request_resource (google.cloud.compute_v1.types.InstanceGroupsListInstancesRequest): - The body resource for this request max_results (int): The maximum number of results per page that should be returned. If the number of available results is larger than @@ -39393,15 +41601,14 @@ class ListInstancesInstanceGroupsRequest(proto.Message): This field is a member of `oneof`_ ``_page_token``. project (str): Project ID for this request. + region (str): + Name of the region for this request. return_partial_success (bool): Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. This field is a member of `oneof`_ ``_return_partial_success``. - zone (str): - The name of the zone where the instance group - is located. """ filter = proto.Field( @@ -39409,15 +41616,6 @@ class ListInstancesInstanceGroupsRequest(proto.Message): number=336120696, optional=True, ) - instance_group = proto.Field( - proto.STRING, - number=81095253, - ) - instance_groups_list_instances_request_resource = proto.Field( - proto.MESSAGE, - number=476255263, - message="InstanceGroupsListInstancesRequest", - ) max_results = proto.Field( proto.UINT32, number=54715419, @@ -39437,20 +41635,20 @@ class ListInstancesInstanceGroupsRequest(proto.Message): proto.STRING, number=227560217, ) + region = proto.Field( + proto.STRING, + number=138946292, + ) return_partial_success = proto.Field( proto.BOOL, number=517198390, optional=True, ) - zone = proto.Field( - proto.STRING, - number=3744684, - ) -class ListInstancesRegionInstanceGroupsRequest(proto.Message): - r"""A request message for RegionInstanceGroups.ListInstances. See - the method description for details. +class ListInterconnectLocationsRequest(proto.Message): + r"""A request message for InterconnectLocations.List. See the + method description for details. Attributes: filter (str): @@ -39481,9 +41679,6 @@ class ListInstancesRegionInstanceGroupsRequest(proto.Message): ``(cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true)`` This field is a member of `oneof`_ ``_filter``. - instance_group (str): - Name of the regional instance group for which - we want to list the instances. max_results (int): The maximum number of results per page that should be returned. If the number of available results is larger than @@ -39514,10 +41709,6 @@ class ListInstancesRegionInstanceGroupsRequest(proto.Message): This field is a member of `oneof`_ ``_page_token``. project (str): Project ID for this request. - region (str): - Name of the region scoping this request. - region_instance_groups_list_instances_request_resource (google.cloud.compute_v1.types.RegionInstanceGroupsListInstancesRequest): - The body resource for this request return_partial_success (bool): Opt-in for partial success behavior which provides partial results in case of failure. The @@ -39531,10 +41722,6 @@ class ListInstancesRegionInstanceGroupsRequest(proto.Message): number=336120696, optional=True, ) - instance_group = proto.Field( - proto.STRING, - number=81095253, - ) max_results = proto.Field( proto.UINT32, number=54715419, @@ -39554,15 +41741,6 @@ class ListInstancesRegionInstanceGroupsRequest(proto.Message): proto.STRING, number=227560217, ) - region = proto.Field( - proto.STRING, - number=138946292, - ) - region_instance_groups_list_instances_request_resource = proto.Field( - proto.MESSAGE, - number=48239828, - message="RegionInstanceGroupsListInstancesRequest", - ) return_partial_success = proto.Field( proto.BOOL, number=517198390, @@ -39570,8 +41748,8 @@ class ListInstancesRegionInstanceGroupsRequest(proto.Message): ) -class ListInstancesRequest(proto.Message): - r"""A request message for Instances.List. See the method +class ListInterconnectsRequest(proto.Message): + r"""A request message for Interconnects.List. See the method description for details. Attributes: @@ -39639,8 +41817,6 @@ class ListInstancesRequest(proto.Message): default value is false. This field is a member of `oneof`_ ``_return_partial_success``. - zone (str): - The name of the zone for this request. """ filter = proto.Field( @@ -39672,15 +41848,11 @@ class ListInstancesRequest(proto.Message): number=517198390, optional=True, ) - zone = proto.Field( - proto.STRING, - number=3744684, - ) -class ListInterconnectAttachmentsRequest(proto.Message): - r"""A request message for InterconnectAttachments.List. See the - method description for details. +class ListLicensesRequest(proto.Message): + r"""A request message for Licenses.List. See the method + description for details. Attributes: filter (str): @@ -39741,8 +41913,6 @@ class ListInterconnectAttachmentsRequest(proto.Message): This field is a member of `oneof`_ ``_page_token``. project (str): Project ID for this request. - region (str): - Name of the region for this request. return_partial_success (bool): Opt-in for partial success behavior which provides partial results in case of failure. The @@ -39775,10 +41945,6 @@ class ListInterconnectAttachmentsRequest(proto.Message): proto.STRING, number=227560217, ) - region = proto.Field( - proto.STRING, - number=138946292, - ) return_partial_success = proto.Field( proto.BOOL, number=517198390, @@ -39786,9 +41952,9 @@ class ListInterconnectAttachmentsRequest(proto.Message): ) -class ListInterconnectLocationsRequest(proto.Message): - r"""A request message for InterconnectLocations.List. See the - method description for details. +class ListMachineImagesRequest(proto.Message): + r"""A request message for MachineImages.List. See the method + description for details. Attributes: filter (str): @@ -39888,8 +42054,8 @@ class ListInterconnectLocationsRequest(proto.Message): ) -class ListInterconnectsRequest(proto.Message): - r"""A request message for Interconnects.List. See the method +class ListMachineTypesRequest(proto.Message): + r"""A request message for MachineTypes.List. See the method description for details. Attributes: @@ -39957,6 +42123,8 @@ class ListInterconnectsRequest(proto.Message): default value is false. This field is a member of `oneof`_ ``_return_partial_success``. + zone (str): + The name of the zone for this request. """ filter = proto.Field( @@ -39988,10 +42156,15 @@ class ListInterconnectsRequest(proto.Message): number=517198390, optional=True, ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) -class ListLicensesRequest(proto.Message): - r"""A request message for Licenses.List. See the method +class ListManagedInstancesInstanceGroupManagersRequest(proto.Message): + r"""A request message for + InstanceGroupManagers.ListManagedInstances. See the method description for details. Attributes: @@ -40023,6 +42196,8 @@ class ListLicensesRequest(proto.Message): ``(cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true)`` This field is a member of `oneof`_ ``_filter``. + instance_group_manager (str): + The name of the managed instance group. max_results (int): The maximum number of results per page that should be returned. If the number of available results is larger than @@ -40059,6 +42234,9 @@ class ListLicensesRequest(proto.Message): default value is false. This field is a member of `oneof`_ ``_return_partial_success``. + zone (str): + The name of the zone where the managed + instance group is located. """ filter = proto.Field( @@ -40066,6 +42244,10 @@ class ListLicensesRequest(proto.Message): number=336120696, optional=True, ) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) max_results = proto.Field( proto.UINT32, number=54715419, @@ -40090,10 +42272,15 @@ class ListLicensesRequest(proto.Message): number=517198390, optional=True, ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) -class ListMachineImagesRequest(proto.Message): - r"""A request message for MachineImages.List. See the method +class ListManagedInstancesRegionInstanceGroupManagersRequest(proto.Message): + r"""A request message for + RegionInstanceGroupManagers.ListManagedInstances. See the method description for details. Attributes: @@ -40125,6 +42312,8 @@ class ListMachineImagesRequest(proto.Message): ``(cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true)`` This field is a member of `oneof`_ ``_filter``. + instance_group_manager (str): + The name of the managed instance group. max_results (int): The maximum number of results per page that should be returned. If the number of available results is larger than @@ -40155,6 +42344,8 @@ class ListMachineImagesRequest(proto.Message): This field is a member of `oneof`_ ``_page_token``. project (str): Project ID for this request. + region (str): + Name of the region scoping this request. return_partial_success (bool): Opt-in for partial success behavior which provides partial results in case of failure. The @@ -40168,6 +42359,10 @@ class ListMachineImagesRequest(proto.Message): number=336120696, optional=True, ) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) max_results = proto.Field( proto.UINT32, number=54715419, @@ -40187,6 +42382,10 @@ class ListMachineImagesRequest(proto.Message): proto.STRING, number=227560217, ) + region = proto.Field( + proto.STRING, + number=138946292, + ) return_partial_success = proto.Field( proto.BOOL, number=517198390, @@ -40194,9 +42393,9 @@ class ListMachineImagesRequest(proto.Message): ) -class ListMachineTypesRequest(proto.Message): - r"""A request message for MachineTypes.List. See the method - description for details. +class ListNetworkEndpointGroupsRequest(proto.Message): + r"""A request message for NetworkEndpointGroups.List. See the + method description for details. Attributes: filter (str): @@ -40264,7 +42463,9 @@ class ListMachineTypesRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. zone (str): - The name of the zone for this request. + The name of the zone where the network + endpoint group is located. It should comply with + RFC1035. """ filter = proto.Field( @@ -40302,9 +42503,9 @@ class ListMachineTypesRequest(proto.Message): ) -class ListManagedInstancesInstanceGroupManagersRequest(proto.Message): +class ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest(proto.Message): r"""A request message for - InstanceGroupManagers.ListManagedInstances. See the method + GlobalNetworkEndpointGroups.ListNetworkEndpoints. See the method description for details. Attributes: @@ -40336,8 +42537,6 @@ class ListManagedInstancesInstanceGroupManagersRequest(proto.Message): ``(cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true)`` This field is a member of `oneof`_ ``_filter``. - instance_group_manager (str): - The name of the managed instance group. max_results (int): The maximum number of results per page that should be returned. If the number of available results is larger than @@ -40347,6 +42546,11 @@ class ListManagedInstancesInstanceGroupManagersRequest(proto.Message): ``500``, inclusive. (Default: ``500``) This field is a member of `oneof`_ ``_max_results``. + network_endpoint_group (str): + The name of the network endpoint group from + which you want to generate a list of included + network endpoints. It should comply with + RFC1035. order_by (str): Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource @@ -40374,9 +42578,6 @@ class ListManagedInstancesInstanceGroupManagersRequest(proto.Message): default value is false. This field is a member of `oneof`_ ``_return_partial_success``. - zone (str): - The name of the zone where the managed - instance group is located. """ filter = proto.Field( @@ -40384,15 +42585,15 @@ class ListManagedInstancesInstanceGroupManagersRequest(proto.Message): number=336120696, optional=True, ) - instance_group_manager = proto.Field( - proto.STRING, - number=249363395, - ) max_results = proto.Field( proto.UINT32, number=54715419, optional=True, ) + network_endpoint_group = proto.Field( + proto.STRING, + number=433907078, + ) order_by = proto.Field( proto.STRING, number=160562920, @@ -40412,15 +42613,11 @@ class ListManagedInstancesInstanceGroupManagersRequest(proto.Message): number=517198390, optional=True, ) - zone = proto.Field( - proto.STRING, - number=3744684, - ) -class ListManagedInstancesRegionInstanceGroupManagersRequest(proto.Message): +class ListNetworkEndpointsNetworkEndpointGroupsRequest(proto.Message): r"""A request message for - RegionInstanceGroupManagers.ListManagedInstances. See the method + NetworkEndpointGroups.ListNetworkEndpoints. See the method description for details. Attributes: @@ -40452,8 +42649,6 @@ class ListManagedInstancesRegionInstanceGroupManagersRequest(proto.Message): ``(cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true)`` This field is a member of `oneof`_ ``_filter``. - instance_group_manager (str): - The name of the managed instance group. max_results (int): The maximum number of results per page that should be returned. If the number of available results is larger than @@ -40463,6 +42658,13 @@ class ListManagedInstancesRegionInstanceGroupManagersRequest(proto.Message): ``500``, inclusive. (Default: ``500``) This field is a member of `oneof`_ ``_max_results``. + network_endpoint_group (str): + The name of the network endpoint group from + which you want to generate a list of included + network endpoints. It should comply with + RFC1035. + network_endpoint_groups_list_endpoints_request_resource (google.cloud.compute_v1.types.NetworkEndpointGroupsListEndpointsRequest): + The body resource for this request order_by (str): Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource @@ -40484,14 +42686,16 @@ class ListManagedInstancesRegionInstanceGroupManagersRequest(proto.Message): This field is a member of `oneof`_ ``_page_token``. project (str): Project ID for this request. - region (str): - Name of the region scoping this request. return_partial_success (bool): Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. This field is a member of `oneof`_ ``_return_partial_success``. + zone (str): + The name of the zone where the network + endpoint group is located. It should comply with + RFC1035. """ filter = proto.Field( @@ -40499,15 +42703,20 @@ class ListManagedInstancesRegionInstanceGroupManagersRequest(proto.Message): number=336120696, optional=True, ) - instance_group_manager = proto.Field( - proto.STRING, - number=249363395, - ) max_results = proto.Field( proto.UINT32, number=54715419, optional=True, ) + network_endpoint_group = proto.Field( + proto.STRING, + number=433907078, + ) + network_endpoint_groups_list_endpoints_request_resource = proto.Field( + proto.MESSAGE, + number=59493390, + message="NetworkEndpointGroupsListEndpointsRequest", + ) order_by = proto.Field( proto.STRING, number=160562920, @@ -40522,19 +42731,19 @@ class ListManagedInstancesRegionInstanceGroupManagersRequest(proto.Message): proto.STRING, number=227560217, ) - region = proto.Field( - proto.STRING, - number=138946292, - ) return_partial_success = proto.Field( proto.BOOL, number=517198390, optional=True, ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) -class ListNetworkEndpointGroupsRequest(proto.Message): - r"""A request message for NetworkEndpointGroups.List. See the +class ListNetworkFirewallPoliciesRequest(proto.Message): + r"""A request message for NetworkFirewallPolicies.List. See the method description for details. Attributes: @@ -40602,10 +42811,6 @@ class ListNetworkEndpointGroupsRequest(proto.Message): default value is false. This field is a member of `oneof`_ ``_return_partial_success``. - zone (str): - The name of the zone where the network - endpoint group is located. It should comply with - RFC1035. """ filter = proto.Field( @@ -40637,15 +42842,10 @@ class ListNetworkEndpointGroupsRequest(proto.Message): number=517198390, optional=True, ) - zone = proto.Field( - proto.STRING, - number=3744684, - ) -class ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest(proto.Message): - r"""A request message for - GlobalNetworkEndpointGroups.ListNetworkEndpoints. See the method +class ListNetworksRequest(proto.Message): + r"""A request message for Networks.List. See the method description for details. Attributes: @@ -40686,11 +42886,6 @@ class ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest(proto.Message): ``500``, inclusive. (Default: ``500``) This field is a member of `oneof`_ ``_max_results``. - network_endpoint_group (str): - The name of the network endpoint group from - which you want to generate a list of included - network endpoints. It should comply with - RFC1035. order_by (str): Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource @@ -40730,10 +42925,6 @@ class ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest(proto.Message): number=54715419, optional=True, ) - network_endpoint_group = proto.Field( - proto.STRING, - number=433907078, - ) order_by = proto.Field( proto.STRING, number=160562920, @@ -40755,9 +42946,8 @@ class ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest(proto.Message): ) -class ListNetworkEndpointsNetworkEndpointGroupsRequest(proto.Message): - r"""A request message for - NetworkEndpointGroups.ListNetworkEndpoints. See the method +class ListNodeGroupsRequest(proto.Message): + r"""A request message for NodeGroups.List. See the method description for details. Attributes: @@ -40798,13 +42988,6 @@ class ListNetworkEndpointsNetworkEndpointGroupsRequest(proto.Message): ``500``, inclusive. (Default: ``500``) This field is a member of `oneof`_ ``_max_results``. - network_endpoint_group (str): - The name of the network endpoint group from - which you want to generate a list of included - network endpoints. It should comply with - RFC1035. - network_endpoint_groups_list_endpoints_request_resource (google.cloud.compute_v1.types.NetworkEndpointGroupsListEndpointsRequest): - The body resource for this request order_by (str): Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource @@ -40833,9 +43016,7 @@ class ListNetworkEndpointsNetworkEndpointGroupsRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. zone (str): - The name of the zone where the network - endpoint group is located. It should comply with - RFC1035. + The name of the zone for this request. """ filter = proto.Field( @@ -40848,15 +43029,6 @@ class ListNetworkEndpointsNetworkEndpointGroupsRequest(proto.Message): number=54715419, optional=True, ) - network_endpoint_group = proto.Field( - proto.STRING, - number=433907078, - ) - network_endpoint_groups_list_endpoints_request_resource = proto.Field( - proto.MESSAGE, - number=59493390, - message="NetworkEndpointGroupsListEndpointsRequest", - ) order_by = proto.Field( proto.STRING, number=160562920, @@ -40882,8 +43054,8 @@ class ListNetworkEndpointsNetworkEndpointGroupsRequest(proto.Message): ) -class ListNetworksRequest(proto.Message): - r"""A request message for Networks.List. See the method +class ListNodeTemplatesRequest(proto.Message): + r"""A request message for NodeTemplates.List. See the method description for details. Attributes: @@ -40945,6 +43117,8 @@ class ListNetworksRequest(proto.Message): This field is a member of `oneof`_ ``_page_token``. project (str): Project ID for this request. + region (str): + The name of the region for this request. return_partial_success (bool): Opt-in for partial success behavior which provides partial results in case of failure. The @@ -40977,6 +43151,10 @@ class ListNetworksRequest(proto.Message): proto.STRING, number=227560217, ) + region = proto.Field( + proto.STRING, + number=138946292, + ) return_partial_success = proto.Field( proto.BOOL, number=517198390, @@ -40984,8 +43162,8 @@ class ListNetworksRequest(proto.Message): ) -class ListNodeGroupsRequest(proto.Message): - r"""A request message for NodeGroups.List. See the method +class ListNodeTypesRequest(proto.Message): + r"""A request message for NodeTypes.List. See the method description for details. Attributes: @@ -41092,8 +43270,8 @@ class ListNodeGroupsRequest(proto.Message): ) -class ListNodeTemplatesRequest(proto.Message): - r"""A request message for NodeTemplates.List. See the method +class ListNodesNodeGroupsRequest(proto.Message): + r"""A request message for NodeGroups.ListNodes. See the method description for details. Attributes: @@ -41134,6 +43312,9 @@ class ListNodeTemplatesRequest(proto.Message): ``500``, inclusive. (Default: ``500``) This field is a member of `oneof`_ ``_max_results``. + node_group (str): + Name of the NodeGroup resource whose nodes + you want to list. order_by (str): Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource @@ -41155,14 +43336,14 @@ class ListNodeTemplatesRequest(proto.Message): This field is a member of `oneof`_ ``_page_token``. project (str): Project ID for this request. - region (str): - The name of the region for this request. return_partial_success (bool): Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. This field is a member of `oneof`_ ``_return_partial_success``. + zone (str): + The name of the zone for this request. """ filter = proto.Field( @@ -41175,6 +43356,10 @@ class ListNodeTemplatesRequest(proto.Message): number=54715419, optional=True, ) + node_group = proto.Field( + proto.STRING, + number=469958146, + ) order_by = proto.Field( proto.STRING, number=160562920, @@ -41189,19 +43374,19 @@ class ListNodeTemplatesRequest(proto.Message): proto.STRING, number=227560217, ) - region = proto.Field( - proto.STRING, - number=138946292, - ) return_partial_success = proto.Field( proto.BOOL, number=517198390, optional=True, ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) -class ListNodeTypesRequest(proto.Message): - r"""A request message for NodeTypes.List. See the method +class ListPacketMirroringsRequest(proto.Message): + r"""A request message for PacketMirrorings.List. See the method description for details. Attributes: @@ -41263,14 +43448,14 @@ class ListNodeTypesRequest(proto.Message): This field is a member of `oneof`_ ``_page_token``. project (str): Project ID for this request. + region (str): + Name of the region for this request. return_partial_success (bool): Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. This field is a member of `oneof`_ ``_return_partial_success``. - zone (str): - The name of the zone for this request. """ filter = proto.Field( @@ -41297,22 +43482,28 @@ class ListNodeTypesRequest(proto.Message): proto.STRING, number=227560217, ) + region = proto.Field( + proto.STRING, + number=138946292, + ) return_partial_success = proto.Field( proto.BOOL, number=517198390, optional=True, ) - zone = proto.Field( - proto.STRING, - number=3744684, - ) -class ListNodesNodeGroupsRequest(proto.Message): - r"""A request message for NodeGroups.ListNodes. See the method - description for details. +class ListPeeringRoutesNetworksRequest(proto.Message): + r"""A request message for Networks.ListPeeringRoutes. See the + method description for details. Attributes: + direction (str): + The direction of the exchanged routes. + Check the Direction enum for the list of + possible values. + + This field is a member of `oneof`_ ``_direction``. filter (str): A filter expression that filters resources listed in the response. The expression must specify the field name, an @@ -41350,9 +43541,8 @@ class ListNodesNodeGroupsRequest(proto.Message): ``500``, inclusive. (Default: ``500``) This field is a member of `oneof`_ ``_max_results``. - node_group (str): - Name of the NodeGroup resource whose nodes - you want to list. + network (str): + Name of the network for this request. order_by (str): Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource @@ -41372,18 +43562,38 @@ class ListNodesNodeGroupsRequest(proto.Message): the next page of results. This field is a member of `oneof`_ ``_page_token``. + peering_name (str): + The response will show routes exchanged over + the given peering connection. + + This field is a member of `oneof`_ ``_peering_name``. project (str): Project ID for this request. + region (str): + The region of the request. The response will + include all subnet routes, static routes and + dynamic routes in the region. + + This field is a member of `oneof`_ ``_region``. return_partial_success (bool): Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. This field is a member of `oneof`_ ``_return_partial_success``. - zone (str): - The name of the zone for this request. """ + class Direction(proto.Enum): + r"""The direction of the exchanged routes.""" + UNDEFINED_DIRECTION = 0 + INCOMING = 338552870 + OUTGOING = 307438444 + + direction = proto.Field( + proto.STRING, + number=111150975, + optional=True, + ) filter = proto.Field( proto.STRING, number=336120696, @@ -41394,9 +43604,9 @@ class ListNodesNodeGroupsRequest(proto.Message): number=54715419, optional=True, ) - node_group = proto.Field( + network = proto.Field( proto.STRING, - number=469958146, + number=232872494, ) order_by = proto.Field( proto.STRING, @@ -41408,23 +43618,30 @@ class ListNodesNodeGroupsRequest(proto.Message): number=19994697, optional=True, ) + peering_name = proto.Field( + proto.STRING, + number=249571370, + optional=True, + ) project = proto.Field( proto.STRING, number=227560217, ) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) return_partial_success = proto.Field( proto.BOOL, number=517198390, optional=True, ) - zone = proto.Field( - proto.STRING, - number=3744684, - ) -class ListPacketMirroringsRequest(proto.Message): - r"""A request message for PacketMirrorings.List. See the method +class ListPerInstanceConfigsInstanceGroupManagersRequest(proto.Message): + r"""A request message for + InstanceGroupManagers.ListPerInstanceConfigs. See the method description for details. Attributes: @@ -41456,6 +43673,9 @@ class ListPacketMirroringsRequest(proto.Message): ``(cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true)`` This field is a member of `oneof`_ ``_filter``. + instance_group_manager (str): + The name of the managed instance group. It + should conform to RFC1035. max_results (int): The maximum number of results per page that should be returned. If the number of available results is larger than @@ -41486,14 +43706,16 @@ class ListPacketMirroringsRequest(proto.Message): This field is a member of `oneof`_ ``_page_token``. project (str): Project ID for this request. - region (str): - Name of the region for this request. return_partial_success (bool): Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. This field is a member of `oneof`_ ``_return_partial_success``. + zone (str): + The name of the zone where the managed + instance group is located. It should conform to + RFC1035. """ filter = proto.Field( @@ -41501,6 +43723,10 @@ class ListPacketMirroringsRequest(proto.Message): number=336120696, optional=True, ) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) max_results = proto.Field( proto.UINT32, number=54715419, @@ -41520,28 +43746,23 @@ class ListPacketMirroringsRequest(proto.Message): proto.STRING, number=227560217, ) - region = proto.Field( - proto.STRING, - number=138946292, - ) return_partial_success = proto.Field( proto.BOOL, number=517198390, optional=True, ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) -class ListPeeringRoutesNetworksRequest(proto.Message): - r"""A request message for Networks.ListPeeringRoutes. See the +class ListPerInstanceConfigsRegionInstanceGroupManagersRequest(proto.Message): + r"""A request message for + RegionInstanceGroupManagers.ListPerInstanceConfigs. See the method description for details. Attributes: - direction (str): - The direction of the exchanged routes. - Check the Direction enum for the list of - possible values. - - This field is a member of `oneof`_ ``_direction``. filter (str): A filter expression that filters resources listed in the response. The expression must specify the field name, an @@ -41570,6 +43791,9 @@ class ListPeeringRoutesNetworksRequest(proto.Message): ``(cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true)`` This field is a member of `oneof`_ ``_filter``. + instance_group_manager (str): + The name of the managed instance group. It + should conform to RFC1035. max_results (int): The maximum number of results per page that should be returned. If the number of available results is larger than @@ -41579,8 +43803,6 @@ class ListPeeringRoutesNetworksRequest(proto.Message): ``500``, inclusive. (Default: ``500``) This field is a member of `oneof`_ ``_max_results``. - network (str): - Name of the network for this request. order_by (str): Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource @@ -41600,19 +43822,11 @@ class ListPeeringRoutesNetworksRequest(proto.Message): the next page of results. This field is a member of `oneof`_ ``_page_token``. - peering_name (str): - The response will show routes exchanged over - the given peering connection. - - This field is a member of `oneof`_ ``_peering_name``. project (str): Project ID for this request. region (str): - The region of the request. The response will - include all subnet routes, static routes and - dynamic routes in the region. - - This field is a member of `oneof`_ ``_region``. + Name of the region scoping this request, + should conform to RFC1035. return_partial_success (bool): Opt-in for partial success behavior which provides partial results in case of failure. The @@ -41621,31 +43835,20 @@ class ListPeeringRoutesNetworksRequest(proto.Message): This field is a member of `oneof`_ ``_return_partial_success``. """ - class Direction(proto.Enum): - r"""The direction of the exchanged routes.""" - UNDEFINED_DIRECTION = 0 - INCOMING = 338552870 - OUTGOING = 307438444 - - direction = proto.Field( - proto.STRING, - number=111150975, - optional=True, - ) filter = proto.Field( proto.STRING, number=336120696, optional=True, ) + instance_group_manager = proto.Field( + proto.STRING, + number=249363395, + ) max_results = proto.Field( proto.UINT32, number=54715419, optional=True, ) - network = proto.Field( - proto.STRING, - number=232872494, - ) order_by = proto.Field( proto.STRING, number=160562920, @@ -41656,11 +43859,6 @@ class Direction(proto.Enum): number=19994697, optional=True, ) - peering_name = proto.Field( - proto.STRING, - number=249571370, - optional=True, - ) project = proto.Field( proto.STRING, number=227560217, @@ -41668,7 +43866,6 @@ class Direction(proto.Enum): region = proto.Field( proto.STRING, number=138946292, - optional=True, ) return_partial_success = proto.Field( proto.BOOL, @@ -41677,9 +43874,9 @@ class Direction(proto.Enum): ) -class ListPerInstanceConfigsInstanceGroupManagersRequest(proto.Message): +class ListPreconfiguredExpressionSetsSecurityPoliciesRequest(proto.Message): r"""A request message for - InstanceGroupManagers.ListPerInstanceConfigs. See the method + SecurityPolicies.ListPreconfiguredExpressionSets. See the method description for details. Attributes: @@ -41711,9 +43908,6 @@ class ListPerInstanceConfigsInstanceGroupManagersRequest(proto.Message): ``(cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true)`` This field is a member of `oneof`_ ``_filter``. - instance_group_manager (str): - The name of the managed instance group. It - should conform to RFC1035. max_results (int): The maximum number of results per page that should be returned. If the number of available results is larger than @@ -41750,10 +43944,6 @@ class ListPerInstanceConfigsInstanceGroupManagersRequest(proto.Message): default value is false. This field is a member of `oneof`_ ``_return_partial_success``. - zone (str): - The name of the zone where the managed - instance group is located. It should conform to - RFC1035. """ filter = proto.Field( @@ -41761,9 +43951,107 @@ class ListPerInstanceConfigsInstanceGroupManagersRequest(proto.Message): number=336120696, optional=True, ) - instance_group_manager = proto.Field( + max_results = proto.Field( + proto.UINT32, + number=54715419, + optional=True, + ) + order_by = proto.Field( proto.STRING, - number=249363395, + number=160562920, + optional=True, + ) + page_token = proto.Field( + proto.STRING, + number=19994697, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + return_partial_success = proto.Field( + proto.BOOL, + number=517198390, + optional=True, + ) + + +class ListPublicAdvertisedPrefixesRequest(proto.Message): + r"""A request message for PublicAdvertisedPrefixes.List. See the + method description for details. + + Attributes: + filter (str): + A filter expression that filters resources listed in the + response. The expression must specify the field name, an + operator, and the value that you want to use for filtering. + The value must be a string, a number, or a boolean. The + operator must be either ``=``, ``!=``, ``>``, ``<``, ``<=``, + ``>=`` or ``:``. For example, if you are filtering Compute + Engine instances, you can exclude instances named + ``example-instance`` by specifying + ``name != example-instance``. The ``:`` operator can be used + with string fields to match substrings. For non-string + fields it is equivalent to the ``=`` operator. The ``:*`` + comparison can be used to test whether a key has been + defined. For example, to find all objects with ``owner`` + label use: ``labels.owner:*`` You can also filter nested + fields. For example, you could specify + ``scheduling.automaticRestart = false`` to include instances + only if they are not scheduled for automatic restarts. You + can use filtering on nested fields to filter based on + resource labels. To filter on multiple expressions, provide + each separate expression within parentheses. For example: + ``(scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake")`` + By default, each expression is an ``AND`` expression. + However, you can include ``AND`` and ``OR`` expressions + explicitly. For example: + ``(cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true)`` + + This field is a member of `oneof`_ ``_filter``. + max_results (int): + The maximum number of results per page that should be + returned. If the number of available results is larger than + ``maxResults``, Compute Engine returns a ``nextPageToken`` + that can be used to get the next page of results in + subsequent list requests. Acceptable values are ``0`` to + ``500``, inclusive. (Default: ``500``) + + This field is a member of `oneof`_ ``_max_results``. + order_by (str): + Sorts list results by a certain order. By default, results + are returned in alphanumerical order based on the resource + name. You can also sort results in descending order based on + the creation timestamp using + ``orderBy="creationTimestamp desc"``. This sorts results + based on the ``creationTimestamp`` field in reverse + chronological order (newest result first). Use this to sort + resources like operations so that the newest operation is + returned first. Currently, only sorting by ``name`` or + ``creationTimestamp desc`` is supported. + + This field is a member of `oneof`_ ``_order_by``. + page_token (str): + Specifies a page token to use. Set ``pageToken`` to the + ``nextPageToken`` returned by a previous list request to get + the next page of results. + + This field is a member of `oneof`_ ``_page_token``. + project (str): + Project ID for this request. + return_partial_success (bool): + Opt-in for partial success behavior which + provides partial results in case of failure. The + default value is false. + + This field is a member of `oneof`_ ``_return_partial_success``. + """ + + filter = proto.Field( + proto.STRING, + number=336120696, + optional=True, ) max_results = proto.Field( proto.UINT32, @@ -41789,15 +44077,10 @@ class ListPerInstanceConfigsInstanceGroupManagersRequest(proto.Message): number=517198390, optional=True, ) - zone = proto.Field( - proto.STRING, - number=3744684, - ) -class ListPerInstanceConfigsRegionInstanceGroupManagersRequest(proto.Message): - r"""A request message for - RegionInstanceGroupManagers.ListPerInstanceConfigs. See the +class ListPublicDelegatedPrefixesRequest(proto.Message): + r"""A request message for PublicDelegatedPrefixes.List. See the method description for details. Attributes: @@ -41829,9 +44112,6 @@ class ListPerInstanceConfigsRegionInstanceGroupManagersRequest(proto.Message): ``(cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true)`` This field is a member of `oneof`_ ``_filter``. - instance_group_manager (str): - The name of the managed instance group. It - should conform to RFC1035. max_results (int): The maximum number of results per page that should be returned. If the number of available results is larger than @@ -41863,8 +44143,7 @@ class ListPerInstanceConfigsRegionInstanceGroupManagersRequest(proto.Message): project (str): Project ID for this request. region (str): - Name of the region scoping this request, - should conform to RFC1035. + Name of the region of this request. return_partial_success (bool): Opt-in for partial success behavior which provides partial results in case of failure. The @@ -41878,10 +44157,6 @@ class ListPerInstanceConfigsRegionInstanceGroupManagersRequest(proto.Message): number=336120696, optional=True, ) - instance_group_manager = proto.Field( - proto.STRING, - number=249363395, - ) max_results = proto.Field( proto.UINT32, number=54715419, @@ -41912,9 +44187,8 @@ class ListPerInstanceConfigsRegionInstanceGroupManagersRequest(proto.Message): ) -class ListPreconfiguredExpressionSetsSecurityPoliciesRequest(proto.Message): - r"""A request message for - SecurityPolicies.ListPreconfiguredExpressionSets. See the method +class ListReferrersInstancesRequest(proto.Message): + r"""A request message for Instances.ListReferrers. See the method description for details. Attributes: @@ -41946,6 +44220,10 @@ class ListPreconfiguredExpressionSetsSecurityPoliciesRequest(proto.Message): ``(cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true)`` This field is a member of `oneof`_ ``_filter``. + instance (str): + Name of the target instance scoping this + request, or '-' if the request should span over + all instances in the container. max_results (int): The maximum number of results per page that should be returned. If the number of available results is larger than @@ -41982,6 +44260,8 @@ class ListPreconfiguredExpressionSetsSecurityPoliciesRequest(proto.Message): default value is false. This field is a member of `oneof`_ ``_return_partial_success``. + zone (str): + The name of the zone for this request. """ filter = proto.Field( @@ -41989,107 +44269,9 @@ class ListPreconfiguredExpressionSetsSecurityPoliciesRequest(proto.Message): number=336120696, optional=True, ) - max_results = proto.Field( - proto.UINT32, - number=54715419, - optional=True, - ) - order_by = proto.Field( - proto.STRING, - number=160562920, - optional=True, - ) - page_token = proto.Field( - proto.STRING, - number=19994697, - optional=True, - ) - project = proto.Field( - proto.STRING, - number=227560217, - ) - return_partial_success = proto.Field( - proto.BOOL, - number=517198390, - optional=True, - ) - - -class ListPublicAdvertisedPrefixesRequest(proto.Message): - r"""A request message for PublicAdvertisedPrefixes.List. See the - method description for details. - - Attributes: - filter (str): - A filter expression that filters resources listed in the - response. The expression must specify the field name, an - operator, and the value that you want to use for filtering. - The value must be a string, a number, or a boolean. The - operator must be either ``=``, ``!=``, ``>``, ``<``, ``<=``, - ``>=`` or ``:``. For example, if you are filtering Compute - Engine instances, you can exclude instances named - ``example-instance`` by specifying - ``name != example-instance``. The ``:`` operator can be used - with string fields to match substrings. For non-string - fields it is equivalent to the ``=`` operator. The ``:*`` - comparison can be used to test whether a key has been - defined. For example, to find all objects with ``owner`` - label use: ``labels.owner:*`` You can also filter nested - fields. For example, you could specify - ``scheduling.automaticRestart = false`` to include instances - only if they are not scheduled for automatic restarts. You - can use filtering on nested fields to filter based on - resource labels. To filter on multiple expressions, provide - each separate expression within parentheses. For example: - ``(scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake")`` - By default, each expression is an ``AND`` expression. - However, you can include ``AND`` and ``OR`` expressions - explicitly. For example: - ``(cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true)`` - - This field is a member of `oneof`_ ``_filter``. - max_results (int): - The maximum number of results per page that should be - returned. If the number of available results is larger than - ``maxResults``, Compute Engine returns a ``nextPageToken`` - that can be used to get the next page of results in - subsequent list requests. Acceptable values are ``0`` to - ``500``, inclusive. (Default: ``500``) - - This field is a member of `oneof`_ ``_max_results``. - order_by (str): - Sorts list results by a certain order. By default, results - are returned in alphanumerical order based on the resource - name. You can also sort results in descending order based on - the creation timestamp using - ``orderBy="creationTimestamp desc"``. This sorts results - based on the ``creationTimestamp`` field in reverse - chronological order (newest result first). Use this to sort - resources like operations so that the newest operation is - returned first. Currently, only sorting by ``name`` or - ``creationTimestamp desc`` is supported. - - This field is a member of `oneof`_ ``_order_by``. - page_token (str): - Specifies a page token to use. Set ``pageToken`` to the - ``nextPageToken`` returned by a previous list request to get - the next page of results. - - This field is a member of `oneof`_ ``_page_token``. - project (str): - Project ID for this request. - return_partial_success (bool): - Opt-in for partial success behavior which - provides partial results in case of failure. The - default value is false. - - This field is a member of `oneof`_ ``_return_partial_success``. - """ - - filter = proto.Field( + instance = proto.Field( proto.STRING, - number=336120696, - optional=True, + number=18257045, ) max_results = proto.Field( proto.UINT32, @@ -42115,11 +44297,15 @@ class ListPublicAdvertisedPrefixesRequest(proto.Message): number=517198390, optional=True, ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) -class ListPublicDelegatedPrefixesRequest(proto.Message): - r"""A request message for PublicDelegatedPrefixes.List. See the - method description for details. +class ListRegionAutoscalersRequest(proto.Message): + r"""A request message for RegionAutoscalers.List. See the method + description for details. Attributes: filter (str): @@ -42181,7 +44367,7 @@ class ListPublicDelegatedPrefixesRequest(proto.Message): project (str): Project ID for this request. region (str): - Name of the region of this request. + Name of the region scoping this request. return_partial_success (bool): Opt-in for partial success behavior which provides partial results in case of failure. The @@ -42225,9 +44411,9 @@ class ListPublicDelegatedPrefixesRequest(proto.Message): ) -class ListReferrersInstancesRequest(proto.Message): - r"""A request message for Instances.ListReferrers. See the method - description for details. +class ListRegionBackendServicesRequest(proto.Message): + r"""A request message for RegionBackendServices.List. See the + method description for details. Attributes: filter (str): @@ -42258,10 +44444,6 @@ class ListReferrersInstancesRequest(proto.Message): ``(cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true)`` This field is a member of `oneof`_ ``_filter``. - instance (str): - Name of the target instance scoping this - request, or '-' if the request should span over - all instances in the container. max_results (int): The maximum number of results per page that should be returned. If the number of available results is larger than @@ -42292,14 +44474,14 @@ class ListReferrersInstancesRequest(proto.Message): This field is a member of `oneof`_ ``_page_token``. project (str): Project ID for this request. + region (str): + Name of the region scoping this request. return_partial_success (bool): Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. This field is a member of `oneof`_ ``_return_partial_success``. - zone (str): - The name of the zone for this request. """ filter = proto.Field( @@ -42307,10 +44489,6 @@ class ListReferrersInstancesRequest(proto.Message): number=336120696, optional=True, ) - instance = proto.Field( - proto.STRING, - number=18257045, - ) max_results = proto.Field( proto.UINT32, number=54715419, @@ -42330,19 +44508,19 @@ class ListReferrersInstancesRequest(proto.Message): proto.STRING, number=227560217, ) + region = proto.Field( + proto.STRING, + number=138946292, + ) return_partial_success = proto.Field( proto.BOOL, number=517198390, optional=True, ) - zone = proto.Field( - proto.STRING, - number=3744684, - ) -class ListRegionAutoscalersRequest(proto.Message): - r"""A request message for RegionAutoscalers.List. See the method +class ListRegionCommitmentsRequest(proto.Message): + r"""A request message for RegionCommitments.List. See the method description for details. Attributes: @@ -42405,7 +44583,7 @@ class ListRegionAutoscalersRequest(proto.Message): project (str): Project ID for this request. region (str): - Name of the region scoping this request. + Name of the region for this request. return_partial_success (bool): Opt-in for partial success behavior which provides partial results in case of failure. The @@ -42449,9 +44627,9 @@ class ListRegionAutoscalersRequest(proto.Message): ) -class ListRegionBackendServicesRequest(proto.Message): - r"""A request message for RegionBackendServices.List. See the - method description for details. +class ListRegionDiskTypesRequest(proto.Message): + r"""A request message for RegionDiskTypes.List. See the method + description for details. Attributes: filter (str): @@ -42513,7 +44691,7 @@ class ListRegionBackendServicesRequest(proto.Message): project (str): Project ID for this request. region (str): - Name of the region scoping this request. + The name of the region for this request. return_partial_success (bool): Opt-in for partial success behavior which provides partial results in case of failure. The @@ -42557,8 +44735,8 @@ class ListRegionBackendServicesRequest(proto.Message): ) -class ListRegionCommitmentsRequest(proto.Message): - r"""A request message for RegionCommitments.List. See the method +class ListRegionDisksRequest(proto.Message): + r"""A request message for RegionDisks.List. See the method description for details. Attributes: @@ -42665,9 +44843,9 @@ class ListRegionCommitmentsRequest(proto.Message): ) -class ListRegionDiskTypesRequest(proto.Message): - r"""A request message for RegionDiskTypes.List. See the method - description for details. +class ListRegionHealthCheckServicesRequest(proto.Message): + r"""A request message for RegionHealthCheckServices.List. See the + method description for details. Attributes: filter (str): @@ -42729,7 +44907,7 @@ class ListRegionDiskTypesRequest(proto.Message): project (str): Project ID for this request. region (str): - The name of the region for this request. + Name of the region scoping this request. return_partial_success (bool): Opt-in for partial success behavior which provides partial results in case of failure. The @@ -42773,8 +44951,8 @@ class ListRegionDiskTypesRequest(proto.Message): ) -class ListRegionDisksRequest(proto.Message): - r"""A request message for RegionDisks.List. See the method +class ListRegionHealthChecksRequest(proto.Message): + r"""A request message for RegionHealthChecks.List. See the method description for details. Attributes: @@ -42837,7 +45015,7 @@ class ListRegionDisksRequest(proto.Message): project (str): Project ID for this request. region (str): - Name of the region for this request. + Name of the region scoping this request. return_partial_success (bool): Opt-in for partial success behavior which provides partial results in case of failure. The @@ -42881,9 +45059,9 @@ class ListRegionDisksRequest(proto.Message): ) -class ListRegionHealthCheckServicesRequest(proto.Message): - r"""A request message for RegionHealthCheckServices.List. See the - method description for details. +class ListRegionInstanceGroupManagersRequest(proto.Message): + r"""A request message for RegionInstanceGroupManagers.List. See + the method description for details. Attributes: filter (str): @@ -42989,9 +45167,9 @@ class ListRegionHealthCheckServicesRequest(proto.Message): ) -class ListRegionHealthChecksRequest(proto.Message): - r"""A request message for RegionHealthChecks.List. See the method - description for details. +class ListRegionInstanceGroupsRequest(proto.Message): + r"""A request message for RegionInstanceGroups.List. See the + method description for details. Attributes: filter (str): @@ -43097,8 +45275,8 @@ class ListRegionHealthChecksRequest(proto.Message): ) -class ListRegionInstanceGroupManagersRequest(proto.Message): - r"""A request message for RegionInstanceGroupManagers.List. See +class ListRegionNetworkEndpointGroupsRequest(proto.Message): + r"""A request message for RegionNetworkEndpointGroups.List. See the method description for details. Attributes: @@ -43161,7 +45339,9 @@ class ListRegionInstanceGroupManagersRequest(proto.Message): project (str): Project ID for this request. region (str): - Name of the region scoping this request. + The name of the region where the network + endpoint group is located. It should comply with + RFC1035. return_partial_success (bool): Opt-in for partial success behavior which provides partial results in case of failure. The @@ -43205,9 +45385,9 @@ class ListRegionInstanceGroupManagersRequest(proto.Message): ) -class ListRegionInstanceGroupsRequest(proto.Message): - r"""A request message for RegionInstanceGroups.List. See the - method description for details. +class ListRegionNetworkFirewallPoliciesRequest(proto.Message): + r"""A request message for RegionNetworkFirewallPolicies.List. See + the method description for details. Attributes: filter (str): @@ -43313,8 +45493,8 @@ class ListRegionInstanceGroupsRequest(proto.Message): ) -class ListRegionNetworkEndpointGroupsRequest(proto.Message): - r"""A request message for RegionNetworkEndpointGroups.List. See +class ListRegionNotificationEndpointsRequest(proto.Message): + r"""A request message for RegionNotificationEndpoints.List. See the method description for details. Attributes: @@ -43377,9 +45557,7 @@ class ListRegionNetworkEndpointGroupsRequest(proto.Message): project (str): Project ID for this request. region (str): - The name of the region where the network - endpoint group is located. It should comply with - RFC1035. + Name of the region scoping this request. return_partial_success (bool): Opt-in for partial success behavior which provides partial results in case of failure. The @@ -43423,9 +45601,9 @@ class ListRegionNetworkEndpointGroupsRequest(proto.Message): ) -class ListRegionNotificationEndpointsRequest(proto.Message): - r"""A request message for RegionNotificationEndpoints.List. See - the method description for details. +class ListRegionOperationsRequest(proto.Message): + r"""A request message for RegionOperations.List. See the method + description for details. Attributes: filter (str): @@ -43487,7 +45665,7 @@ class ListRegionNotificationEndpointsRequest(proto.Message): project (str): Project ID for this request. region (str): - Name of the region scoping this request. + Name of the region for this request. return_partial_success (bool): Opt-in for partial success behavior which provides partial results in case of failure. The @@ -43531,9 +45709,9 @@ class ListRegionNotificationEndpointsRequest(proto.Message): ) -class ListRegionOperationsRequest(proto.Message): - r"""A request message for RegionOperations.List. See the method - description for details. +class ListRegionSecurityPoliciesRequest(proto.Message): + r"""A request message for RegionSecurityPolicies.List. See the + method description for details. Attributes: filter (str): @@ -43595,7 +45773,7 @@ class ListRegionOperationsRequest(proto.Message): project (str): Project ID for this request. region (str): - Name of the region for this request. + Name of the region scoping this request. return_partial_success (bool): Opt-in for partial success behavior which provides partial results in case of failure. The @@ -46841,7 +49019,7 @@ class LocationPolicy(proto.Message): single region). Attributes: - locations (Sequence[google.cloud.compute_v1.types.LocationPolicy.LocationsEntry]): + locations (Mapping[str, google.cloud.compute_v1.types.LocationPolicyLocation]): Location configurations mapped by location name. Currently only zone names are supported and must be represented as valid internal URLs, @@ -47071,8 +49249,7 @@ class MachineImage(proto.Message): guest_flush (bool): [Input Only] Whether to attempt an application consistent machine image by informing the OS to prepare for the - snapshot process. Currently only supported on Windows - instances using the Volume Shadow Copy Service (VSS). + snapshot process. This field is a member of `oneof`_ ``_guest_flush``. id (int): @@ -47514,7 +49691,7 @@ class MachineTypeAggregatedList(proto.Message): the server. This field is a member of `oneof`_ ``_id``. - items (Sequence[google.cloud.compute_v1.types.MachineTypeAggregatedList.ItemsEntry]): + items (Mapping[str, google.cloud.compute_v1.types.MachineTypesScopedList]): A list of MachineTypesScopedList resources. kind (str): [Output Only] Type of resource. Always @@ -47730,7 +49907,8 @@ class ManagedInstance(proto.Message): [Output Only] Health state of the instance per health-check. instance_status (str): [Output Only] The status of the instance. This field is - empty when the instance does not exist. + empty when the instance does not exist. Check the + InstanceStatus enum for the list of possible values. This field is a member of `oneof`_ ``_instance_status``. last_attempt (google.cloud.compute_v1.types.ManagedInstanceLastAttempt): @@ -47774,7 +49952,9 @@ class CurrentAction(proto.Enum): changes to the instance without stopping it. For example, the group can update the target pool list for an instance without stopping that instance. - VERIFYING The managed instance group has created - the instance and it is in the process of being verified. + the instance and it is in the process of being verified. Additional + supported values which may be not listed in the enum directly due to + technical reasons: STOPPING SUSPENDING """ UNDEFINED_CURRENT_ACTION = 0 ABANDONING = 388244813 @@ -47785,11 +49965,15 @@ class CurrentAction(proto.Enum): RECREATING = 287278572 REFRESHING = 163266343 RESTARTING = 320534387 + RESUMING = 446856618 + STARTING = 488820800 VERIFYING = 16982185 class InstanceStatus(proto.Enum): r"""[Output Only] The status of the instance. This field is empty when - the instance does not exist. + the instance does not exist. Additional supported values which may + be not listed in the enum directly due to technical reasons: + STOPPING SUSPENDING """ UNDEFINED_INSTANCE_STATUS = 0 DEPROVISIONING = 428935662 @@ -48278,6 +50462,12 @@ class Network(proto.Message): Provide this field when you create the resource. This field is a member of `oneof`_ ``_description``. + enable_ula_internal_ipv6 (bool): + Enable ULA internal ipv6 on this network. + Enabling this feature will assign a /48 from + google defined ULA prefix fd20::/20. . + + This field is a member of `oneof`_ ``_enable_ula_internal_ipv6``. gateway_i_pv4 (str): [Output Only] The gateway address for default routing out of the network, selected by GCP. @@ -48288,6 +50478,18 @@ class Network(proto.Message): identifier is defined by the server. This field is a member of `oneof`_ ``_id``. + internal_ipv6_range (str): + When enabling ula internal ipv6, caller + optionally can specify the /48 range they want + from the google defined ULA prefix fd20::/20. + The input must be a valid /48 ULA IPv6 address + and must be within the fd20::/20. Operation will + fail if the speficied /48 is already in used by + another resource. If the field is not speficied, + then a /48 range will be randomly allocated from + fd20::/20 and returned via this field. . + + This field is a member of `oneof`_ ``_internal_ipv6_range``. kind (str): [Output Only] Type of the resource. Always compute#network for networks. @@ -48312,6 +50514,14 @@ class Network(proto.Message): digit. This field is a member of `oneof`_ ``_name``. + network_firewall_policy_enforcement_order (str): + The network firewall policy enforcement order. Can be either + AFTER_CLASSIC_FIREWALL or BEFORE_CLASSIC_FIREWALL. Defaults + to AFTER_CLASSIC_FIREWALL if the field is not specified. + Check the NetworkFirewallPolicyEnforcementOrder enum for the + list of possible values. + + This field is a member of `oneof`_ ``_network_firewall_policy_enforcement_order``. peerings (Sequence[google.cloud.compute_v1.types.NetworkPeering]): [Output Only] A list of network peerings for the resource. routing_config (google.cloud.compute_v1.types.NetworkRoutingConfig): @@ -48325,11 +50535,25 @@ class Network(proto.Message): [Output Only] Server-defined URL for the resource. This field is a member of `oneof`_ ``_self_link``. + self_link_with_id (str): + [Output Only] Server-defined URL for this resource with the + resource id. + + This field is a member of `oneof`_ ``_self_link_with_id``. subnetworks (Sequence[str]): [Output Only] Server-defined fully-qualified URLs for all subnetworks in this VPC network. """ + class NetworkFirewallPolicyEnforcementOrder(proto.Enum): + r"""The network firewall policy enforcement order. Can be either + AFTER_CLASSIC_FIREWALL or BEFORE_CLASSIC_FIREWALL. Defaults to + AFTER_CLASSIC_FIREWALL if the field is not specified. + """ + UNDEFINED_NETWORK_FIREWALL_POLICY_ENFORCEMENT_ORDER = 0 + AFTER_CLASSIC_FIREWALL = 154582608 + BEFORE_CLASSIC_FIREWALL = 338458349 + I_pv4_range = proto.Field( proto.STRING, number=59234358, @@ -48350,6 +50574,11 @@ class Network(proto.Message): number=422937596, optional=True, ) + enable_ula_internal_ipv6 = proto.Field( + proto.BOOL, + number=423757720, + optional=True, + ) gateway_i_pv4 = proto.Field( proto.STRING, number=178678877, @@ -48360,6 +50589,11 @@ class Network(proto.Message): number=3355, optional=True, ) + internal_ipv6_range = proto.Field( + proto.STRING, + number=277456807, + optional=True, + ) kind = proto.Field( proto.STRING, number=3292052, @@ -48375,6 +50609,11 @@ class Network(proto.Message): number=3373707, optional=True, ) + network_firewall_policy_enforcement_order = proto.Field( + proto.STRING, + number=6504784, + optional=True, + ) peerings = proto.RepeatedField( proto.MESSAGE, number=69883187, @@ -48391,17 +50630,264 @@ class Network(proto.Message): number=456214797, optional=True, ) + self_link_with_id = proto.Field( + proto.STRING, + number=44520962, + optional=True, + ) subnetworks = proto.RepeatedField( proto.STRING, number=415853125, ) +class NetworkEdgeSecurityService(proto.Message): + r"""Represents a Google Cloud Armor network edge security service + resource. + + Attributes: + creation_timestamp (str): + [Output Only] Creation timestamp in RFC3339 text format. + + This field is a member of `oneof`_ ``_creation_timestamp``. + description (str): + An optional description of this resource. + Provide this property when you create the + resource. + + This field is a member of `oneof`_ ``_description``. + fingerprint (str): + Fingerprint of this resource. A hash of the + contents stored in this object. This field is + used in optimistic locking. This field will be + ignored when inserting a + NetworkEdgeSecurityService. An up-to-date + fingerprint must be provided in order to update + the NetworkEdgeSecurityService, otherwise the + request will fail with error 412 + conditionNotMet. To see the latest fingerprint, + make a get() request to retrieve a + NetworkEdgeSecurityService. + + This field is a member of `oneof`_ ``_fingerprint``. + id (int): + [Output Only] The unique identifier for the resource. This + identifier is defined by the server. + + This field is a member of `oneof`_ ``_id``. + kind (str): + [Output only] Type of the resource. Always + compute#networkEdgeSecurityService for + NetworkEdgeSecurityServices + + This field is a member of `oneof`_ ``_kind``. + name (str): + Name of the resource. Provided by the client when the + resource is created. The name must be 1-63 characters long, + and comply with RFC1035. Specifically, the name must be 1-63 + characters long and match the regular expression + ``[a-z]([-a-z0-9]*[a-z0-9])?`` which means the first + character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, + except the last character, which cannot be a dash. + + This field is a member of `oneof`_ ``_name``. + region (str): + [Output Only] URL of the region where the resource resides. + You must specify this field as part of the HTTP request URL. + It is not settable as a field in the request body. + + This field is a member of `oneof`_ ``_region``. + security_policy (str): + The resource URL for the network edge + security service associated with this network + edge security service. + + This field is a member of `oneof`_ ``_security_policy``. + self_link (str): + [Output Only] Server-defined URL for the resource. + + This field is a member of `oneof`_ ``_self_link``. + self_link_with_id (str): + [Output Only] Server-defined URL for this resource with the + resource id. + + This field is a member of `oneof`_ ``_self_link_with_id``. + """ + + creation_timestamp = proto.Field( + proto.STRING, + number=30525366, + optional=True, + ) + description = proto.Field( + proto.STRING, + number=422937596, + optional=True, + ) + fingerprint = proto.Field( + proto.STRING, + number=234678500, + optional=True, + ) + id = proto.Field( + proto.UINT64, + number=3355, + optional=True, + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) + security_policy = proto.Field( + proto.STRING, + number=171082513, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + self_link_with_id = proto.Field( + proto.STRING, + number=44520962, + optional=True, + ) + + +class NetworkEdgeSecurityServiceAggregatedList(proto.Message): + r""" + + Attributes: + etag (str): + + This field is a member of `oneof`_ ``_etag``. + id (str): + [Output Only] Unique identifier for the resource; defined by + the server. + + This field is a member of `oneof`_ ``_id``. + items (Mapping[str, google.cloud.compute_v1.types.NetworkEdgeSecurityServicesScopedList]): + A list of + NetworkEdgeSecurityServicesScopedList resources. + kind (str): + [Output Only] Type of resource. Always + compute#networkEdgeSecurityServiceAggregatedList for lists + of Network Edge Security Services. + + This field is a member of `oneof`_ ``_kind``. + next_page_token (str): + [Output Only] This token allows you to get the next page of + results for list requests. If the number of results is + larger than maxResults, use the nextPageToken as a value for + the query parameter pageToken in the next list request. + Subsequent list requests will have their own nextPageToken + to continue paging through the results. + + This field is a member of `oneof`_ ``_next_page_token``. + self_link (str): + [Output Only] Server-defined URL for this resource. + + This field is a member of `oneof`_ ``_self_link``. + unreachables (Sequence[str]): + [Output Only] Unreachable resources. + warning (google.cloud.compute_v1.types.Warning): + [Output Only] Informational warning message. + + This field is a member of `oneof`_ ``_warning``. + """ + + @property + def raw_page(self): + return self + + etag = proto.Field( + proto.STRING, + number=3123477, + optional=True, + ) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) + items = proto.MapField( + proto.STRING, + proto.MESSAGE, + number=100526016, + message="NetworkEdgeSecurityServicesScopedList", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, + ) + warning = proto.Field( + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", + ) + + +class NetworkEdgeSecurityServicesScopedList(proto.Message): + r""" + + Attributes: + network_edge_security_services (Sequence[google.cloud.compute_v1.types.NetworkEdgeSecurityService]): + A list of NetworkEdgeSecurityServices + contained in this scope. + warning (google.cloud.compute_v1.types.Warning): + Informational warning which replaces the list + of security policies when the list is empty. + + This field is a member of `oneof`_ ``_warning``. + """ + + network_edge_security_services = proto.RepeatedField( + proto.MESSAGE, + number=35530156, + message="NetworkEdgeSecurityService", + ) + warning = proto.Field( + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", + ) + + class NetworkEndpoint(proto.Message): r"""The network endpoint. Attributes: - annotations (Sequence[google.cloud.compute_v1.types.NetworkEndpoint.AnnotationsEntry]): + annotations (Mapping[str, str]): Metadata defined as annotations on the network endpoint. fqdn (str): @@ -48474,7 +50960,7 @@ class NetworkEndpointGroup(proto.Message): serverless NEGs. Attributes: - annotations (Sequence[google.cloud.compute_v1.types.NetworkEndpointGroup.AnnotationsEntry]): + annotations (Mapping[str, str]): Metadata defined as annotations on the network endpoint group. app_engine (google.cloud.compute_v1.types.NetworkEndpointGroupAppEngine): @@ -48539,10 +51025,11 @@ class NetworkEndpointGroup(proto.Message): This field is a member of `oneof`_ ``_network``. network_endpoint_type (str): Type of network endpoints in this network endpoint group. - Can be one of GCE_VM_IP_PORT, NON_GCP_PRIVATE_IP_PORT, - INTERNET_FQDN_PORT, INTERNET_IP_PORT, SERVERLESS, - PRIVATE_SERVICE_CONNECT. Check the NetworkEndpointType enum - for the list of possible values. + Can be one of GCE_VM_IP, GCE_VM_IP_PORT, + NON_GCP_PRIVATE_IP_PORT, INTERNET_FQDN_PORT, + INTERNET_IP_PORT, SERVERLESS, PRIVATE_SERVICE_CONNECT. Check + the NetworkEndpointType enum for the list of possible + values. This field is a member of `oneof`_ ``_network_endpoint_type``. psc_target_service (str): @@ -48580,8 +51067,9 @@ class NetworkEndpointGroup(proto.Message): class NetworkEndpointType(proto.Enum): r"""Type of network endpoints in this network endpoint group. Can be one - of GCE_VM_IP_PORT, NON_GCP_PRIVATE_IP_PORT, INTERNET_FQDN_PORT, - INTERNET_IP_PORT, SERVERLESS, PRIVATE_SERVICE_CONNECT. + of GCE_VM_IP, GCE_VM_IP_PORT, NON_GCP_PRIVATE_IP_PORT, + INTERNET_FQDN_PORT, INTERNET_IP_PORT, SERVERLESS, + PRIVATE_SERVICE_CONNECT. """ UNDEFINED_NETWORK_ENDPOINT_TYPE = 0 GCE_VM_IP = 401880793 @@ -48696,7 +51184,7 @@ class NetworkEndpointGroupAggregatedList(proto.Message): the server. This field is a member of `oneof`_ ``_id``. - items (Sequence[google.cloud.compute_v1.types.NetworkEndpointGroupAggregatedList.ItemsEntry]): + items (Mapping[str, google.cloud.compute_v1.types.NetworkEndpointGroupsScopedList]): A list of NetworkEndpointGroupsScopedList resources. kind (str): @@ -48887,17 +51375,18 @@ class NetworkEndpointGroupCloudRun(proto.Message): This field is a member of `oneof`_ ``_tag``. url_mask (str): - A template to parse service and tag fields - from a request URL. URL mask allows for routing - to multiple Run services without having to - create multiple network endpoint groups and + A template to parse and + fields from a request URL. URL mask allows for + routing to multiple Run services without having + to create multiple network endpoint groups and backend services. For example, request URLs "foo1.domain.com/bar1" and "foo1.domain.com/bar2" can be backed by the same Serverless Network Endpoint Group (NEG) with URL - mask ".domain.com/". The URL mask will parse - them to { service="bar1", tag="foo1" } and { - service="bar2", tag="foo2" } respectively. + mask ".domain.com/". The URL mask + will parse them to { service="bar1", tag="foo1" + } and { service="bar2", tag="foo2" } + respectively. This field is a member of `oneof`_ ``_url_mask``. """ @@ -49198,6 +51687,11 @@ class NetworkInterface(proto.Message): fingerprint is out of date. This field is a member of `oneof`_ ``_fingerprint``. + internal_ipv6_prefix_length (int): + The prefix length of the primary internal + IPv6 range. + + This field is a member of `oneof`_ ``_internal_ipv6_prefix_length``. ipv6_access_configs (Sequence[google.cloud.compute_v1.types.AccessConfig]): An array of IPv6 access configurations for this interface. Currently, only one IPv6 access config, DIRECT_IPV6, is @@ -49223,8 +51717,9 @@ class NetworkInterface(proto.Message): This field is a member of `oneof`_ ``_kind``. name (str): [Output Only] The name of the network interface, which is - generated by the server. For network devices, these are - eth0, eth1, etc. + generated by the server. For a VM, the network interface + uses the nicN naming format. Where N is a value between 0 + and 7. The default interface value is nic0. This field is a member of `oneof`_ ``_name``. network (str): @@ -49299,6 +51794,7 @@ class Ipv6AccessType(proto.Enum): """ UNDEFINED_IPV6_ACCESS_TYPE = 0 EXTERNAL = 35607499 + INTERNAL = 279295677 UNSPECIFIED_IPV6_ACCESS_TYPE = 313080613 class NicType(proto.Enum): @@ -49336,6 +51832,11 @@ class StackType(proto.Enum): number=234678500, optional=True, ) + internal_ipv6_prefix_length = proto.Field( + proto.INT32, + number=203833757, + optional=True, + ) ipv6_access_configs = proto.RepeatedField( proto.MESSAGE, number=483472110, @@ -50061,7 +52562,7 @@ class NodeGroupAggregatedList(proto.Message): the server. This field is a member of `oneof`_ ``_id``. - items (Sequence[google.cloud.compute_v1.types.NodeGroupAggregatedList.ItemsEntry]): + items (Mapping[str, google.cloud.compute_v1.types.NodeGroupsScopedList]): A list of NodeGroupsScopedList resources. kind (str): [Output Only] Type of resource.Always @@ -50594,7 +53095,7 @@ class NodeTemplate(proto.Message): digit, except the last character, which cannot be a dash. This field is a member of `oneof`_ ``_name``. - node_affinity_labels (Sequence[google.cloud.compute_v1.types.NodeTemplate.NodeAffinityLabelsEntry]): + node_affinity_labels (Mapping[str, str]): Labels to use for node affinity, which will be used in instance scheduling. node_type (str): @@ -50751,7 +53252,7 @@ class NodeTemplateAggregatedList(proto.Message): the server. This field is a member of `oneof`_ ``_id``. - items (Sequence[google.cloud.compute_v1.types.NodeTemplateAggregatedList.ItemsEntry]): + items (Mapping[str, google.cloud.compute_v1.types.NodeTemplatesScopedList]): A list of NodeTemplatesScopedList resources. kind (str): [Output Only] Type of resource.Always @@ -51092,7 +53593,7 @@ class NodeTypeAggregatedList(proto.Message): the server. This field is a member of `oneof`_ ``_id``. - items (Sequence[google.cloud.compute_v1.types.NodeTypeAggregatedList.ItemsEntry]): + items (Mapping[str, google.cloud.compute_v1.types.NodeTypesScopedList]): A list of NodeTypesScopedList resources. kind (str): [Output Only] Type of resource.Always @@ -51788,7 +54289,7 @@ class OperationAggregatedList(proto.Message): identifier is defined by the server. This field is a member of `oneof`_ ``_id``. - items (Sequence[google.cloud.compute_v1.types.OperationAggregatedList.ItemsEntry]): + items (Mapping[str, google.cloud.compute_v1.types.OperationsScopedList]): [Output Only] A map of scoped operation lists. kind (str): [Output Only] Type of resource. Always @@ -52387,7 +54888,7 @@ class PacketMirroringAggregatedList(proto.Message): the server. This field is a member of `oneof`_ ``_id``. - items (Sequence[google.cloud.compute_v1.types.PacketMirroringAggregatedList.ItemsEntry]): + items (Mapping[str, google.cloud.compute_v1.types.PacketMirroringsScopedList]): A list of PacketMirroring resources. kind (str): Type of resource. @@ -53261,14 +55762,68 @@ class PatchImageRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - image = proto.Field( + image = proto.Field( + proto.STRING, + number=100313435, + ) + image_resource = proto.Field( + proto.MESSAGE, + number=371171954, + message="Image", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + + +class PatchInstanceGroupManagerRequest(proto.Message): + r"""A request message for InstanceGroupManagers.Patch. See the + method description for details. + + Attributes: + instance_group_manager (str): + The name of the instance group manager. + instance_group_manager_resource (google.cloud.compute_v1.types.InstanceGroupManager): + The body resource for this request + project (str): + Project ID for this request. + request_id (str): + An optional request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. For example, consider a situation + where you make an initial request and the + request times out. If you make the request again + with the same request ID, the server can check + if original operation with the same request ID + was received, and if so, will ignore the second + request. This prevents clients from accidentally + creating duplicate commitments. The request ID + must be a valid UUID with the exception that + zero UUID is not supported ( + 00000000-0000-0000-0000-000000000000). + + This field is a member of `oneof`_ ``_request_id``. + zone (str): + The name of the zone where you want to create + the managed instance group. + """ + + instance_group_manager = proto.Field( proto.STRING, - number=100313435, + number=249363395, ) - image_resource = proto.Field( + instance_group_manager_resource = proto.Field( proto.MESSAGE, - number=371171954, - message="Image", + number=261063946, + message="InstanceGroupManager", ) project = proto.Field( proto.STRING, @@ -53279,19 +55834,25 @@ class PatchImageRequest(proto.Message): number=37109963, optional=True, ) + zone = proto.Field( + proto.STRING, + number=3744684, + ) -class PatchInstanceGroupManagerRequest(proto.Message): - r"""A request message for InstanceGroupManagers.Patch. See the +class PatchInterconnectAttachmentRequest(proto.Message): + r"""A request message for InterconnectAttachments.Patch. See the method description for details. Attributes: - instance_group_manager (str): - The name of the instance group manager. - instance_group_manager_resource (google.cloud.compute_v1.types.InstanceGroupManager): + interconnect_attachment (str): + Name of the interconnect attachment to patch. + interconnect_attachment_resource (google.cloud.compute_v1.types.InterconnectAttachment): The body resource for this request project (str): Project ID for this request. + region (str): + Name of the region scoping this request. request_id (str): An optional request ID to identify requests. Specify a unique request ID so that if you must @@ -53310,44 +55871,96 @@ class PatchInstanceGroupManagerRequest(proto.Message): 00000000-0000-0000-0000-000000000000). This field is a member of `oneof`_ ``_request_id``. - zone (str): - The name of the zone where you want to create - the managed instance group. """ - instance_group_manager = proto.Field( + interconnect_attachment = proto.Field( proto.STRING, - number=249363395, + number=308135284, ) - instance_group_manager_resource = proto.Field( + interconnect_attachment_resource = proto.Field( proto.MESSAGE, - number=261063946, - message="InstanceGroupManager", + number=212341369, + message="InterconnectAttachment", ) project = proto.Field( proto.STRING, number=227560217, ) + region = proto.Field( + proto.STRING, + number=138946292, + ) request_id = proto.Field( proto.STRING, number=37109963, optional=True, ) - zone = proto.Field( + + +class PatchInterconnectRequest(proto.Message): + r"""A request message for Interconnects.Patch. See the method + description for details. + + Attributes: + interconnect (str): + Name of the interconnect to update. + interconnect_resource (google.cloud.compute_v1.types.Interconnect): + The body resource for this request + project (str): + Project ID for this request. + request_id (str): + An optional request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. For example, consider a situation + where you make an initial request and the + request times out. If you make the request again + with the same request ID, the server can check + if original operation with the same request ID + was received, and if so, will ignore the second + request. This prevents clients from accidentally + creating duplicate commitments. The request ID + must be a valid UUID with the exception that + zero UUID is not supported ( + 00000000-0000-0000-0000-000000000000). + + This field is a member of `oneof`_ ``_request_id``. + """ + + interconnect = proto.Field( proto.STRING, - number=3744684, + number=224601230, + ) + interconnect_resource = proto.Field( + proto.MESSAGE, + number=397611167, + message="Interconnect", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, ) -class PatchInterconnectAttachmentRequest(proto.Message): - r"""A request message for InterconnectAttachments.Patch. See the - method description for details. +class PatchNetworkEdgeSecurityServiceRequest(proto.Message): + r"""A request message for NetworkEdgeSecurityServices.Patch. See + the method description for details. Attributes: - interconnect_attachment (str): - Name of the interconnect attachment to patch. - interconnect_attachment_resource (google.cloud.compute_v1.types.InterconnectAttachment): + network_edge_security_service (str): + Name of the network edge security service to + update. + network_edge_security_service_resource (google.cloud.compute_v1.types.NetworkEdgeSecurityService): The body resource for this request + paths (str): + + This field is a member of `oneof`_ ``_paths``. project (str): Project ID for this request. region (str): @@ -53370,16 +55983,26 @@ class PatchInterconnectAttachmentRequest(proto.Message): 00000000-0000-0000-0000-000000000000). This field is a member of `oneof`_ ``_request_id``. + update_mask (str): + Indicates fields to be updated as part of + this request. + + This field is a member of `oneof`_ ``_update_mask``. """ - interconnect_attachment = proto.Field( + network_edge_security_service = proto.Field( proto.STRING, - number=308135284, + number=157011879, ) - interconnect_attachment_resource = proto.Field( + network_edge_security_service_resource = proto.Field( proto.MESSAGE, - number=212341369, - message="InterconnectAttachment", + number=477548966, + message="NetworkEdgeSecurityService", + ) + paths = proto.Field( + proto.STRING, + number=106438894, + optional=True, ) project = proto.Field( proto.STRING, @@ -53394,16 +56017,21 @@ class PatchInterconnectAttachmentRequest(proto.Message): number=37109963, optional=True, ) + update_mask = proto.Field( + proto.STRING, + number=500079778, + optional=True, + ) -class PatchInterconnectRequest(proto.Message): - r"""A request message for Interconnects.Patch. See the method - description for details. +class PatchNetworkFirewallPolicyRequest(proto.Message): + r"""A request message for NetworkFirewallPolicies.Patch. See the + method description for details. Attributes: - interconnect (str): - Name of the interconnect to update. - interconnect_resource (google.cloud.compute_v1.types.Interconnect): + firewall_policy (str): + Name of the firewall policy to update. + firewall_policy_resource (google.cloud.compute_v1.types.FirewallPolicy): The body resource for this request project (str): Project ID for this request. @@ -53427,14 +56055,14 @@ class PatchInterconnectRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - interconnect = proto.Field( + firewall_policy = proto.Field( proto.STRING, - number=224601230, + number=498173265, ) - interconnect_resource = proto.Field( + firewall_policy_resource = proto.Field( proto.MESSAGE, - number=397611167, - message="Interconnect", + number=495049532, + message="FirewallPolicy", ) project = proto.Field( proto.STRING, @@ -53937,14 +56565,130 @@ class PatchRegionBackendServiceRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - backend_service = proto.Field( + backend_service = proto.Field( + proto.STRING, + number=306946058, + ) + backend_service_resource = proto.Field( + proto.MESSAGE, + number=347586723, + message="BackendService", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + + +class PatchRegionHealthCheckRequest(proto.Message): + r"""A request message for RegionHealthChecks.Patch. See the + method description for details. + + Attributes: + health_check (str): + Name of the HealthCheck resource to patch. + health_check_resource (google.cloud.compute_v1.types.HealthCheck): + The body resource for this request + project (str): + Project ID for this request. + region (str): + Name of the region scoping this request. + request_id (str): + An optional request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. For example, consider a situation + where you make an initial request and the + request times out. If you make the request again + with the same request ID, the server can check + if original operation with the same request ID + was received, and if so, will ignore the second + request. This prevents clients from accidentally + creating duplicate commitments. The request ID + must be a valid UUID with the exception that + zero UUID is not supported ( + 00000000-0000-0000-0000-000000000000). + + This field is a member of `oneof`_ ``_request_id``. + """ + + health_check = proto.Field( + proto.STRING, + number=308876645, + ) + health_check_resource = proto.Field( + proto.MESSAGE, + number=201925032, + message="HealthCheck", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + + +class PatchRegionHealthCheckServiceRequest(proto.Message): + r"""A request message for RegionHealthCheckServices.Patch. See + the method description for details. + + Attributes: + health_check_service (str): + Name of the HealthCheckService to update. The + name must be 1-63 characters long, and comply + with RFC1035. + health_check_service_resource (google.cloud.compute_v1.types.HealthCheckService): + The body resource for this request + project (str): + Project ID for this request. + region (str): + Name of the region scoping this request. + request_id (str): + An optional request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. For example, consider a situation + where you make an initial request and the + request times out. If you make the request again + with the same request ID, the server can check + if original operation with the same request ID + was received, and if so, will ignore the second + request. This prevents clients from accidentally + creating duplicate commitments. The request ID + must be a valid UUID with the exception that + zero UUID is not supported ( + 00000000-0000-0000-0000-000000000000). + + This field is a member of `oneof`_ ``_request_id``. + """ + + health_check_service = proto.Field( proto.STRING, - number=306946058, + number=408374747, ) - backend_service_resource = proto.Field( + health_check_service_resource = proto.Field( proto.MESSAGE, - number=347586723, - message="BackendService", + number=477367794, + message="HealthCheckService", ) project = proto.Field( proto.STRING, @@ -53961,14 +56705,14 @@ class PatchRegionBackendServiceRequest(proto.Message): ) -class PatchRegionHealthCheckRequest(proto.Message): - r"""A request message for RegionHealthChecks.Patch. See the - method description for details. +class PatchRegionInstanceGroupManagerRequest(proto.Message): + r"""A request message for RegionInstanceGroupManagers.Patch. See + the method description for details. Attributes: - health_check (str): - Name of the HealthCheck resource to patch. - health_check_resource (google.cloud.compute_v1.types.HealthCheck): + instance_group_manager (str): + The name of the instance group manager. + instance_group_manager_resource (google.cloud.compute_v1.types.InstanceGroupManager): The body resource for this request project (str): Project ID for this request. @@ -53994,14 +56738,14 @@ class PatchRegionHealthCheckRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - health_check = proto.Field( + instance_group_manager = proto.Field( proto.STRING, - number=308876645, + number=249363395, ) - health_check_resource = proto.Field( + instance_group_manager_resource = proto.Field( proto.MESSAGE, - number=201925032, - message="HealthCheck", + number=261063946, + message="InstanceGroupManager", ) project = proto.Field( proto.STRING, @@ -54018,16 +56762,14 @@ class PatchRegionHealthCheckRequest(proto.Message): ) -class PatchRegionHealthCheckServiceRequest(proto.Message): - r"""A request message for RegionHealthCheckServices.Patch. See - the method description for details. +class PatchRegionNetworkFirewallPolicyRequest(proto.Message): + r"""A request message for RegionNetworkFirewallPolicies.Patch. + See the method description for details. Attributes: - health_check_service (str): - Name of the HealthCheckService to update. The - name must be 1-63 characters long, and comply - with RFC1035. - health_check_service_resource (google.cloud.compute_v1.types.HealthCheckService): + firewall_policy (str): + Name of the firewall policy to update. + firewall_policy_resource (google.cloud.compute_v1.types.FirewallPolicy): The body resource for this request project (str): Project ID for this request. @@ -54053,14 +56795,14 @@ class PatchRegionHealthCheckServiceRequest(proto.Message): This field is a member of `oneof`_ ``_request_id``. """ - health_check_service = proto.Field( + firewall_policy = proto.Field( proto.STRING, - number=408374747, + number=498173265, ) - health_check_service_resource = proto.Field( + firewall_policy_resource = proto.Field( proto.MESSAGE, - number=477367794, - message="HealthCheckService", + number=495049532, + message="FirewallPolicy", ) project = proto.Field( proto.STRING, @@ -54077,15 +56819,11 @@ class PatchRegionHealthCheckServiceRequest(proto.Message): ) -class PatchRegionInstanceGroupManagerRequest(proto.Message): - r"""A request message for RegionInstanceGroupManagers.Patch. See - the method description for details. +class PatchRegionSecurityPolicyRequest(proto.Message): + r"""A request message for RegionSecurityPolicies.Patch. See the + method description for details. Attributes: - instance_group_manager (str): - The name of the instance group manager. - instance_group_manager_resource (google.cloud.compute_v1.types.InstanceGroupManager): - The body resource for this request project (str): Project ID for this request. region (str): @@ -54108,17 +56846,70 @@ class PatchRegionInstanceGroupManagerRequest(proto.Message): 00000000-0000-0000-0000-000000000000). This field is a member of `oneof`_ ``_request_id``. + security_policy (str): + Name of the security policy to update. + security_policy_resource (google.cloud.compute_v1.types.SecurityPolicy): + The body resource for this request """ - instance_group_manager = proto.Field( + project = proto.Field( proto.STRING, - number=249363395, + number=227560217, ) - instance_group_manager_resource = proto.Field( + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + security_policy = proto.Field( + proto.STRING, + number=171082513, + ) + security_policy_resource = proto.Field( proto.MESSAGE, - number=261063946, - message="InstanceGroupManager", + number=216159612, + message="SecurityPolicy", ) + + +class PatchRegionTargetHttpsProxyRequest(proto.Message): + r"""A request message for RegionTargetHttpsProxies.Patch. See the + method description for details. + + Attributes: + project (str): + Project ID for this request. + region (str): + Name of the region for this request. + request_id (str): + An optional request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. For example, consider a situation + where you make an initial request and the + request times out. If you make the request again + with the same request ID, the server can check + if original operation with the same request ID + was received, and if so, will ignore the second + request. This prevents clients from accidentally + creating duplicate commitments. The request ID + must be a valid UUID with the exception that + zero UUID is not supported ( + 00000000-0000-0000-0000-000000000000). + + This field is a member of `oneof`_ ``_request_id``. + target_https_proxy (str): + Name of the TargetHttpsProxy resource to + patch. + target_https_proxy_resource (google.cloud.compute_v1.types.TargetHttpsProxy): + The body resource for this request + """ + project = proto.Field( proto.STRING, number=227560217, @@ -54132,6 +56923,15 @@ class PatchRegionInstanceGroupManagerRequest(proto.Message): number=37109963, optional=True, ) + target_https_proxy = proto.Field( + proto.STRING, + number=52336748, + ) + target_https_proxy_resource = proto.Field( + proto.MESSAGE, + number=433657473, + message="TargetHttpsProxy", + ) class PatchRegionUrlMapRequest(proto.Message): @@ -54289,6 +57089,133 @@ class PatchRuleFirewallPolicyRequest(proto.Message): ) +class PatchRuleNetworkFirewallPolicyRequest(proto.Message): + r"""A request message for NetworkFirewallPolicies.PatchRule. See + the method description for details. + + Attributes: + firewall_policy (str): + Name of the firewall policy to update. + firewall_policy_rule_resource (google.cloud.compute_v1.types.FirewallPolicyRule): + The body resource for this request + priority (int): + The priority of the rule to patch. + + This field is a member of `oneof`_ ``_priority``. + project (str): + Project ID for this request. + request_id (str): + An optional request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. For example, consider a situation + where you make an initial request and the + request times out. If you make the request again + with the same request ID, the server can check + if original operation with the same request ID + was received, and if so, will ignore the second + request. This prevents clients from accidentally + creating duplicate commitments. The request ID + must be a valid UUID with the exception that + zero UUID is not supported ( + 00000000-0000-0000-0000-000000000000). + + This field is a member of `oneof`_ ``_request_id``. + """ + + firewall_policy = proto.Field( + proto.STRING, + number=498173265, + ) + firewall_policy_rule_resource = proto.Field( + proto.MESSAGE, + number=250523523, + message="FirewallPolicyRule", + ) + priority = proto.Field( + proto.INT32, + number=445151652, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + + +class PatchRuleRegionNetworkFirewallPolicyRequest(proto.Message): + r"""A request message for + RegionNetworkFirewallPolicies.PatchRule. See the method + description for details. + + Attributes: + firewall_policy (str): + Name of the firewall policy to update. + firewall_policy_rule_resource (google.cloud.compute_v1.types.FirewallPolicyRule): + The body resource for this request + priority (int): + The priority of the rule to patch. + + This field is a member of `oneof`_ ``_priority``. + project (str): + Project ID for this request. + region (str): + Name of the region scoping this request. + request_id (str): + An optional request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. For example, consider a situation + where you make an initial request and the + request times out. If you make the request again + with the same request ID, the server can check + if original operation with the same request ID + was received, and if so, will ignore the second + request. This prevents clients from accidentally + creating duplicate commitments. The request ID + must be a valid UUID with the exception that + zero UUID is not supported ( + 00000000-0000-0000-0000-000000000000). + + This field is a member of `oneof`_ ``_request_id``. + """ + + firewall_policy = proto.Field( + proto.STRING, + number=498173265, + ) + firewall_policy_rule_resource = proto.Field( + proto.MESSAGE, + number=250523523, + message="FirewallPolicyRule", + ) + priority = proto.Field( + proto.INT32, + number=445151652, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + + class PatchRuleSecurityPolicyRequest(proto.Message): r"""A request message for SecurityPolicies.PatchRule. See the method description for details. @@ -55141,8 +58068,6 @@ class Policy(proto.Message): This field is a member of `oneof`_ ``_etag``. iam_owned (bool): - This is deprecated and has no effect. Do not - use. This field is a member of `oneof`_ ``_iam_owned``. rules (Sequence[google.cloud.compute_v1.types.Rule]): @@ -55225,11 +58150,11 @@ class PreservedState(proto.Message): r"""Preserved state for a given instance. Attributes: - disks (Sequence[google.cloud.compute_v1.types.PreservedState.DisksEntry]): + disks (Mapping[str, google.cloud.compute_v1.types.PreservedStatePreservedDisk]): Preserved disks defined for this instance. This map is keyed with the device names of the disks. - metadata (Sequence[google.cloud.compute_v1.types.PreservedState.MetadataEntry]): + metadata (Mapping[str, str]): Preserved metadata defined for this instance. """ @@ -56133,7 +59058,7 @@ class PublicDelegatedPrefixAggregatedList(proto.Message): the server. This field is a member of `oneof`_ ``_id``. - items (Sequence[google.cloud.compute_v1.types.PublicDelegatedPrefixAggregatedList.ItemsEntry]): + items (Mapping[str, google.cloud.compute_v1.types.PublicDelegatedPrefixesScopedList]): A list of PublicDelegatedPrefixesScopedList resources. kind (str): @@ -56450,6 +59375,7 @@ class Metric(proto.Enum): CPUS_ALL_REGIONS = 470911149 DISKS_TOTAL_GB = 353520543 E2_CPUS = 481995837 + EXTERNAL_MANAGED_FORWARDING_RULES = 150790089 EXTERNAL_NETWORK_LB_FORWARDING_RULES = 374298265 EXTERNAL_PROTOCOL_FORWARDING_RULES = 63478888 EXTERNAL_VPN_GATEWAYS = 272457134 @@ -57330,7 +60256,9 @@ class RegionInstanceGroupManagersApplyUpdatesRequest(proto.Message): default, the minimum action is NONE. If your update requires a more disruptive action than you set with this flag, the necessary action is - performed to execute the update. + performed to execute the update. Check the + MinimalAction enum for the list of possible + values. This field is a member of `oneof`_ ``_minimal_action``. most_disruptive_allowed_action (str): @@ -57343,11 +60271,45 @@ class RegionInstanceGroupManagersApplyUpdatesRequest(proto.Message): default, the most disruptive allowed action is REPLACE. If your update requires a more disruptive action than you set with this flag, - the update request will fail. + the update request will fail. Check the + MostDisruptiveAllowedAction enum for the list of + possible values. This field is a member of `oneof`_ ``_most_disruptive_allowed_action``. """ + class MinimalAction(proto.Enum): + r"""The minimal action that you want to perform on each instance + during the update: - REPLACE: At minimum, delete the instance + and create it again. - RESTART: Stop the instance and start it + again. - REFRESH: Do not stop the instance. - NONE: Do not + disrupt the instance at all. By default, the minimum action is + NONE. If your update requires a more disruptive action than you + set with this flag, the necessary action is performed to execute + the update. Additional supported values which may be not listed + in the enum directly due to technical reasons: NONE + REFRESH + REPLACE + RESTART + """ + UNDEFINED_MINIMAL_ACTION = 0 + + class MostDisruptiveAllowedAction(proto.Enum): + r"""The most disruptive action that you want to perform on each + instance during the update: - REPLACE: Delete the instance and + create it again. - RESTART: Stop the instance and start it + again. - REFRESH: Do not stop the instance. - NONE: Do not + disrupt the instance at all. By default, the most disruptive + allowed action is REPLACE. If your update requires a more + disruptive action than you set with this flag, the update + request will fail. Additional supported values which may be not + listed in the enum directly due to technical reasons: NONE + REFRESH + REPLACE + RESTART + """ + UNDEFINED_MOST_DISRUPTIVE_ALLOWED_ACTION = 0 + all_instances = proto.Field( proto.BOOL, number=403676512, @@ -57807,6 +60769,84 @@ def raw_page(self): ) +class RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse(proto.Message): + r""" + + Attributes: + firewall_policys (Sequence[google.cloud.compute_v1.types.RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponseEffectiveFirewallPolicy]): + Effective firewalls from firewall policy. + firewalls (Sequence[google.cloud.compute_v1.types.Firewall]): + Effective firewalls on the network. + """ + + firewall_policys = proto.RepeatedField( + proto.MESSAGE, + number=410985794, + message="RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponseEffectiveFirewallPolicy", + ) + firewalls = proto.RepeatedField( + proto.MESSAGE, + number=272245619, + message="Firewall", + ) + + +class RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponseEffectiveFirewallPolicy( + proto.Message +): + r""" + + Attributes: + display_name (str): + [Output Only] The display name of the firewall policy. + + This field is a member of `oneof`_ ``_display_name``. + name (str): + [Output Only] The name of the firewall policy. + + This field is a member of `oneof`_ ``_name``. + rules (Sequence[google.cloud.compute_v1.types.FirewallPolicyRule]): + The rules that apply to the network. + type_ (str): + [Output Only] The type of the firewall policy. Can be one of + HIERARCHY, NETWORK, NETWORK_REGIONAL. Check the Type enum + for the list of possible values. + + This field is a member of `oneof`_ ``_type``. + """ + + class Type(proto.Enum): + r"""[Output Only] The type of the firewall policy. Can be one of + HIERARCHY, NETWORK, NETWORK_REGIONAL. + """ + UNDEFINED_TYPE = 0 + HIERARCHY = 69902869 + NETWORK = 413984270 + NETWORK_REGIONAL = 190804272 + UNSPECIFIED = 526786327 + + display_name = proto.Field( + proto.STRING, + number=4473832, + optional=True, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + rules = proto.RepeatedField( + proto.MESSAGE, + number=108873975, + message="FirewallPolicyRule", + ) + type_ = proto.Field( + proto.STRING, + number=3575610, + optional=True, + ) + + class RegionSetLabelsRequest(proto.Message): r""" @@ -57822,7 +60862,7 @@ class RegionSetLabelsRequest(proto.Message): resource to get the latest fingerprint. This field is a member of `oneof`_ ``_label_fingerprint``. - labels (Sequence[google.cloud.compute_v1.types.RegionSetLabelsRequest.LabelsEntry]): + labels (Mapping[str, str]): The labels to set for this resource. """ @@ -57962,6 +61002,121 @@ class RemoveAssociationFirewallPolicyRequest(proto.Message): ) +class RemoveAssociationNetworkFirewallPolicyRequest(proto.Message): + r"""A request message for + NetworkFirewallPolicies.RemoveAssociation. See the method + description for details. + + Attributes: + firewall_policy (str): + Name of the firewall policy to update. + name (str): + Name for the attachment that will be removed. + + This field is a member of `oneof`_ ``_name``. + project (str): + Project ID for this request. + request_id (str): + An optional request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. For example, consider a situation + where you make an initial request and the + request times out. If you make the request again + with the same request ID, the server can check + if original operation with the same request ID + was received, and if so, will ignore the second + request. This prevents clients from accidentally + creating duplicate commitments. The request ID + must be a valid UUID with the exception that + zero UUID is not supported ( + 00000000-0000-0000-0000-000000000000). + + This field is a member of `oneof`_ ``_request_id``. + """ + + firewall_policy = proto.Field( + proto.STRING, + number=498173265, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + + +class RemoveAssociationRegionNetworkFirewallPolicyRequest(proto.Message): + r"""A request message for + RegionNetworkFirewallPolicies.RemoveAssociation. See the method + description for details. + + Attributes: + firewall_policy (str): + Name of the firewall policy to update. + name (str): + Name for the association that will be + removed. + + This field is a member of `oneof`_ ``_name``. + project (str): + Project ID for this request. + region (str): + Name of the region scoping this request. + request_id (str): + An optional request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. For example, consider a situation + where you make an initial request and the + request times out. If you make the request again + with the same request ID, the server can check + if original operation with the same request ID + was received, and if so, will ignore the second + request. This prevents clients from accidentally + creating duplicate commitments. The request ID + must be a valid UUID with the exception that + zero UUID is not supported ( + 00000000-0000-0000-0000-000000000000). + + This field is a member of `oneof`_ ``_request_id``. + """ + + firewall_policy = proto.Field( + proto.STRING, + number=498173265, + ) + name = proto.Field( + proto.STRING, + number=3373707, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + + class RemoveHealthCheckTargetPoolRequest(proto.Message): r"""A request message for TargetPools.RemoveHealthCheck. See the method description for details. @@ -58408,6 +61563,121 @@ class RemoveRuleFirewallPolicyRequest(proto.Message): ) +class RemoveRuleNetworkFirewallPolicyRequest(proto.Message): + r"""A request message for NetworkFirewallPolicies.RemoveRule. See + the method description for details. + + Attributes: + firewall_policy (str): + Name of the firewall policy to update. + priority (int): + The priority of the rule to remove from the + firewall policy. + + This field is a member of `oneof`_ ``_priority``. + project (str): + Project ID for this request. + request_id (str): + An optional request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. For example, consider a situation + where you make an initial request and the + request times out. If you make the request again + with the same request ID, the server can check + if original operation with the same request ID + was received, and if so, will ignore the second + request. This prevents clients from accidentally + creating duplicate commitments. The request ID + must be a valid UUID with the exception that + zero UUID is not supported ( + 00000000-0000-0000-0000-000000000000). + + This field is a member of `oneof`_ ``_request_id``. + """ + + firewall_policy = proto.Field( + proto.STRING, + number=498173265, + ) + priority = proto.Field( + proto.INT32, + number=445151652, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + + +class RemoveRuleRegionNetworkFirewallPolicyRequest(proto.Message): + r"""A request message for + RegionNetworkFirewallPolicies.RemoveRule. See the method + description for details. + + Attributes: + firewall_policy (str): + Name of the firewall policy to update. + priority (int): + The priority of the rule to remove from the + firewall policy. + + This field is a member of `oneof`_ ``_priority``. + project (str): + Project ID for this request. + region (str): + Name of the region scoping this request. + request_id (str): + An optional request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. For example, consider a situation + where you make an initial request and the + request times out. If you make the request again + with the same request ID, the server can check + if original operation with the same request ID + was received, and if so, will ignore the second + request. This prevents clients from accidentally + creating duplicate commitments. The request ID + must be a valid UUID with the exception that + zero UUID is not supported ( + 00000000-0000-0000-0000-000000000000). + + This field is a member of `oneof`_ ``_request_id``. + """ + + firewall_policy = proto.Field( + proto.STRING, + number=498173265, + ) + priority = proto.Field( + proto.INT32, + number=445151652, + optional=True, + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + request_id = proto.Field( + proto.STRING, + number=37109963, + optional=True, + ) + + class RemoveRuleSecurityPolicyRequest(proto.Message): r"""A request message for SecurityPolicies.RemoveRule. See the method description for details. @@ -58687,7 +61957,7 @@ class ReservationAggregatedList(proto.Message): the server. This field is a member of `oneof`_ ``_id``. - items (Sequence[google.cloud.compute_v1.types.ReservationAggregatedList.ItemsEntry]): + items (Mapping[str, google.cloud.compute_v1.types.ReservationsScopedList]): A list of Allocation resources. kind (str): Type of resource. @@ -59470,7 +62740,7 @@ class ResourcePolicyAggregatedList(proto.Message): the server. This field is a member of `oneof`_ ``_id``. - items (Sequence[google.cloud.compute_v1.types.ResourcePolicyAggregatedList.ItemsEntry]): + items (Mapping[str, google.cloud.compute_v1.types.ResourcePoliciesScopedList]): A list of ResourcePolicy resources. kind (str): Type of resource. @@ -59550,8 +62820,8 @@ class ResourcePolicyDailyCycle(proto.Message): Attributes: days_in_cycle (int): Defines a schedule with units measured in - months. The value determines how many months - pass between the start of each cycle. + days. The value determines how many days pass + between the start of each cycle. This field is a member of `oneof`_ ``_days_in_cycle``. duration (str): @@ -60021,7 +63291,7 @@ class ResourcePolicySnapshotSchedulePolicySnapshotProperties(proto.Message): snapshot. This field is a member of `oneof`_ ``_guest_flush``. - labels (Sequence[google.cloud.compute_v1.types.ResourcePolicySnapshotSchedulePolicySnapshotProperties.LabelsEntry]): + labels (Mapping[str, str]): Labels to apply to scheduled snapshots. These can be later modified by the setLabels method. Label values may be empty. @@ -60281,6 +63551,11 @@ class Route(proto.Message): priority value must be from ``0`` to ``65535``, inclusive. This field is a member of `oneof`_ ``_priority``. + route_status (str): + [Output only] The status of the route. Check the RouteStatus + enum for the list of possible values. + + This field is a member of `oneof`_ ``_route_status``. route_type (str): [Output Only] The type of this route, which can be one of the following values: - 'TRANSIT' for a transit route that @@ -60305,6 +63580,14 @@ class Route(proto.Message): messages. """ + class RouteStatus(proto.Enum): + r"""[Output only] The status of the route.""" + UNDEFINED_ROUTE_STATUS = 0 + ACTIVE = 314733318 + DROPPED = 496235424 + INACTIVE = 270421099 + PENDING = 35394935 + class RouteType(proto.Enum): r"""[Output Only] The type of this route, which can be one of the following values: - 'TRANSIT' for a transit route that this router @@ -60399,6 +63682,11 @@ class RouteType(proto.Enum): number=445151652, optional=True, ) + route_status = proto.Field( + proto.STRING, + number=418162344, + optional=True, + ) route_type = proto.Field( proto.STRING, number=375888752, @@ -60721,7 +64009,7 @@ class RouterAggregatedList(proto.Message): the server. This field is a member of `oneof`_ ``_id``. - items (Sequence[google.cloud.compute_v1.types.RouterAggregatedList.ItemsEntry]): + items (Mapping[str, google.cloud.compute_v1.types.RoutersScopedList]): A list of Router resources. kind (str): Type of resource. @@ -61158,7 +64446,7 @@ class RouterBgpPeerBfd(proto.Message): for the peer router to initiate the BFD session for this BGP peer. If set to DISABLED, BFD is disabled for this BGP peer. The default is - PASSIVE. Check the SessionInitializationMode + DISABLED. Check the SessionInitializationMode enum for the list of possible values. This field is a member of `oneof`_ ``_session_initialization_mode``. @@ -61170,7 +64458,7 @@ class SessionInitializationMode(proto.Enum): this BGP peer. If set to PASSIVE, the Cloud Router will wait for the peer router to initiate the BFD session for this BGP peer. If set to DISABLED, BFD is disabled for this BGP peer. The - default is PASSIVE. + default is DISABLED. """ UNDEFINED_SESSION_INITIALIZATION_MODE = 0 ACTIVE = 314733318 @@ -61928,7 +65216,9 @@ class RouterStatusBgpPeerStatus(proto.Message): This field is a member of `oneof`_ ``_router_appliance_instance``. state (str): - BGP state as specified in RFC1771. + The state of the BGP session. For a list of + possible values for this field, see BGP session + states. This field is a member of `oneof`_ ``_state``. status (str): @@ -62956,6 +66246,95 @@ class Screenshot(proto.Message): ) +class SecurityPoliciesAggregatedList(proto.Message): + r""" + + Attributes: + etag (str): + + This field is a member of `oneof`_ ``_etag``. + id (str): + [Output Only] Unique identifier for the resource; defined by + the server. + + This field is a member of `oneof`_ ``_id``. + items (Mapping[str, google.cloud.compute_v1.types.SecurityPoliciesScopedList]): + A list of SecurityPoliciesScopedList + resources. + kind (str): + [Output Only] Type of resource. Always + compute#securityPolicyAggregatedList for lists of Security + Policies. + + This field is a member of `oneof`_ ``_kind``. + next_page_token (str): + [Output Only] This token allows you to get the next page of + results for list requests. If the number of results is + larger than maxResults, use the nextPageToken as a value for + the query parameter pageToken in the next list request. + Subsequent list requests will have their own nextPageToken + to continue paging through the results. + + This field is a member of `oneof`_ ``_next_page_token``. + self_link (str): + [Output Only] Server-defined URL for this resource. + + This field is a member of `oneof`_ ``_self_link``. + unreachables (Sequence[str]): + [Output Only] Unreachable resources. + warning (google.cloud.compute_v1.types.Warning): + [Output Only] Informational warning message. + + This field is a member of `oneof`_ ``_warning``. + """ + + @property + def raw_page(self): + return self + + etag = proto.Field( + proto.STRING, + number=3123477, + optional=True, + ) + id = proto.Field( + proto.STRING, + number=3355, + optional=True, + ) + items = proto.MapField( + proto.STRING, + proto.MESSAGE, + number=100526016, + message="SecurityPoliciesScopedList", + ) + kind = proto.Field( + proto.STRING, + number=3292052, + optional=True, + ) + next_page_token = proto.Field( + proto.STRING, + number=79797525, + optional=True, + ) + self_link = proto.Field( + proto.STRING, + number=456214797, + optional=True, + ) + unreachables = proto.RepeatedField( + proto.STRING, + number=243372063, + ) + warning = proto.Field( + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", + ) + + class SecurityPoliciesListPreconfiguredExpressionSetsResponse(proto.Message): r""" @@ -62973,6 +66352,33 @@ class SecurityPoliciesListPreconfiguredExpressionSetsResponse(proto.Message): ) +class SecurityPoliciesScopedList(proto.Message): + r""" + + Attributes: + security_policies (Sequence[google.cloud.compute_v1.types.SecurityPolicy]): + A list of SecurityPolicies contained in this + scope. + warning (google.cloud.compute_v1.types.Warning): + Informational warning which replaces the list + of security policies when the list is empty. + + This field is a member of `oneof`_ ``_warning``. + """ + + security_policies = proto.RepeatedField( + proto.MESSAGE, + number=127783791, + message="SecurityPolicy", + ) + warning = proto.Field( + proto.MESSAGE, + number=50704284, + optional=True, + message="Warning", + ) + + class SecurityPoliciesWafConfig(proto.Message): r""" @@ -63007,6 +66413,9 @@ class SecurityPolicy(proto.Message): [Output Only] Creation timestamp in RFC3339 text format. This field is a member of `oneof`_ ``_creation_timestamp``. + ddos_protection_config (google.cloud.compute_v1.types.SecurityPolicyDdosProtectionConfig): + + This field is a member of `oneof`_ ``_ddos_protection_config``. description (str): An optional description of this resource. Provide this property when you create the @@ -63051,6 +66460,12 @@ class SecurityPolicy(proto.Message): recaptcha_options_config (google.cloud.compute_v1.types.SecurityPolicyRecaptchaOptionsConfig): This field is a member of `oneof`_ ``_recaptcha_options_config``. + region (str): + [Output Only] URL of the region where the regional security + policy resides. This field is not applicable to global + security policies. + + This field is a member of `oneof`_ ``_region``. rules (Sequence[google.cloud.compute_v1.types.SecurityPolicyRule]): A list of rules that belong to this policy. There must always be a default rule (rule with priority 2147483647 and @@ -63063,33 +66478,44 @@ class SecurityPolicy(proto.Message): This field is a member of `oneof`_ ``_self_link``. type_ (str): The type indicates the intended use of the security policy. - CLOUD_ARMOR - Cloud Armor backend security policies can be + - CLOUD_ARMOR: Cloud Armor backend security policies can be configured to filter incoming HTTP requests targeting backend services. They filter requests before they hit the - origin servers. CLOUD_ARMOR_EDGE - Cloud Armor edge security - policies can be configured to filter incoming HTTP requests - targeting backend services (including Cloud CDN-enabled) as - well as backend buckets (Cloud Storage). They filter - requests before the request is served from Google's cache. - Check the Type enum for the list of possible values. + origin servers. - CLOUD_ARMOR_EDGE: Cloud Armor edge + security policies can be configured to filter incoming HTTP + requests targeting backend services (including Cloud + CDN-enabled) as well as backend buckets (Cloud Storage). + They filter requests before the request is served from + Google's cache. - CLOUD_ARMOR_INTERNAL_SERVICE: Cloud Armor + internal service policies can be configured to filter HTTP + requests targeting services managed by Traffic Director in a + service mesh. They filter requests before the request is + served from the application. This field can be set only at + resource creation time. Check the Type enum for the list of + possible values. This field is a member of `oneof`_ ``_type``. """ class Type(proto.Enum): - r"""The type indicates the intended use of the security policy. - CLOUD_ARMOR - Cloud Armor backend security policies can be - configured to filter incoming HTTP requests targeting backend - services. They filter requests before they hit the origin servers. - CLOUD_ARMOR_EDGE - Cloud Armor edge security policies can be + r"""The type indicates the intended use of the security policy. - + CLOUD_ARMOR: Cloud Armor backend security policies can be configured + to filter incoming HTTP requests targeting backend services. They + filter requests before they hit the origin servers. - + CLOUD_ARMOR_EDGE: Cloud Armor edge security policies can be configured to filter incoming HTTP requests targeting backend services (including Cloud CDN-enabled) as well as backend buckets (Cloud Storage). They filter requests before the request is served - from Google's cache. + from Google's cache. - CLOUD_ARMOR_INTERNAL_SERVICE: Cloud Armor + internal service policies can be configured to filter HTTP requests + targeting services managed by Traffic Director in a service mesh. + They filter requests before the request is served from the + application. This field can be set only at resource creation time. """ UNDEFINED_TYPE = 0 CLOUD_ARMOR = 260640373 CLOUD_ARMOR_EDGE = 250728775 + CLOUD_ARMOR_NETWORK = 488527428 adaptive_protection_config = proto.Field( proto.MESSAGE, @@ -63108,6 +66534,12 @@ class Type(proto.Enum): number=30525366, optional=True, ) + ddos_protection_config = proto.Field( + proto.MESSAGE, + number=50315853, + optional=True, + message="SecurityPolicyDdosProtectionConfig", + ) description = proto.Field( proto.STRING, number=422937596, @@ -63139,6 +66571,11 @@ class Type(proto.Enum): optional=True, message="SecurityPolicyRecaptchaOptionsConfig", ) + region = proto.Field( + proto.STRING, + number=138946292, + optional=True, + ) rules = proto.RepeatedField( proto.MESSAGE, number=108873975, @@ -63254,6 +66691,30 @@ class LogLevel(proto.Enum): ) +class SecurityPolicyDdosProtectionConfig(proto.Message): + r""" + + Attributes: + ddos_protection (str): + Check the DdosProtection enum for the list of + possible values. + + This field is a member of `oneof`_ ``_ddos_protection``. + """ + + class DdosProtection(proto.Enum): + r"""""" + UNDEFINED_DDOS_PROTECTION = 0 + ADVANCED = 63789090 + STANDARD = 484642493 + + ddos_protection = proto.Field( + proto.STRING, + number=275173268, + optional=True, + ) + + class SecurityPolicyList(proto.Message): r""" @@ -63631,13 +67092,13 @@ class SecurityPolicyRuleRateLimitOptions(proto.Message): to ALL. - XFF_IP: The first IP address (i.e. the originating client IP address) specified in the list of IPs under X-Forwarded-For HTTP header. If no such header is present or - the value is not a valid IP, the key type defaults to ALL. - - HTTP_COOKIE: The value of the HTTP cookie whose name is - configured under "enforce_on_key_name". The key value is - truncated to the first 128 bytes of the cookie value. If no - such cookie is present in the request, the key type defaults - to ALL. Check the EnforceOnKey enum for the list of possible - values. + the value is not a valid IP, the key defaults to the source + IP address of the request i.e. key type IP. - HTTP_COOKIE: + The value of the HTTP cookie whose name is configured under + "enforce_on_key_name". The key value is truncated to the + first 128 bytes of the cookie value. If no such cookie is + present in the request, the key type defaults to ALL. Check + the EnforceOnKey enum for the list of possible values. This field is a member of `oneof`_ ``_enforce_on_key``. enforce_on_key_name (str): @@ -63648,12 +67109,14 @@ class SecurityPolicyRuleRateLimitOptions(proto.Message): This field is a member of `oneof`_ ``_enforce_on_key_name``. exceed_action (str): - Action to take for requests that are above the configured - rate limit threshold, to either deny with a specified HTTP - response code, or redirect to a different endpoint. Valid - options are "deny()" where valid values for status are 403, - 404, 429, and 502, and "redirect" where the redirect - parameters come from exceed_redirect_options below. + Action to take for requests that are above + the configured rate limit threshold, to either + deny with a specified HTTP response code, or + redirect to a different endpoint. Valid options + are "deny(status)", where valid values for + status are 403, 404, 429, and 502, and + "redirect" where the redirect parameters come + from exceedRedirectOptions below. This field is a member of `oneof`_ ``_exceed_action``. exceed_redirect_options (google.cloud.compute_v1.types.SecurityPolicyRuleRedirectOptions): @@ -63681,10 +67144,11 @@ class EnforceOnKey(proto.Enum): XFF_IP: The first IP address (i.e. the originating client IP address) specified in the list of IPs under X-Forwarded-For HTTP header. If no such header is present or the value is not a valid IP, - the key type defaults to ALL. - HTTP_COOKIE: The value of the HTTP - cookie whose name is configured under "enforce_on_key_name". The key - value is truncated to the first 128 bytes of the cookie value. If no - such cookie is present in the request, the key type defaults to ALL. + the key defaults to the source IP address of the request i.e. key + type IP. - HTTP_COOKIE: The value of the HTTP cookie whose name is + configured under "enforce_on_key_name". The key value is truncated + to the first 128 bytes of the cookie value. If no such cookie is + present in the request, the key type defaults to ALL. """ UNDEFINED_ENFORCE_ON_KEY = 0 ALL = 64897 @@ -64220,7 +67684,7 @@ class ServiceAttachmentAggregatedList(proto.Message): the server. This field is a member of `oneof`_ ``_id``. - items (Sequence[google.cloud.compute_v1.types.ServiceAttachmentAggregatedList.ItemsEntry]): + items (Mapping[str, google.cloud.compute_v1.types.ServiceAttachmentsScopedList]): A list of ServiceAttachmentsScopedList resources. kind (str): @@ -65159,6 +68623,34 @@ class SetIamPolicyMachineImageRequest(proto.Message): ) +class SetIamPolicyNetworkFirewallPolicyRequest(proto.Message): + r"""A request message for NetworkFirewallPolicies.SetIamPolicy. + See the method description for details. + + Attributes: + global_set_policy_request_resource (google.cloud.compute_v1.types.GlobalSetPolicyRequest): + The body resource for this request + project (str): + Project ID for this request. + resource (str): + Name or id of the resource for this request. + """ + + global_set_policy_request_resource = proto.Field( + proto.MESSAGE, + number=337048498, + message="GlobalSetPolicyRequest", + ) + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, + ) + + class SetIamPolicyNodeGroupRequest(proto.Message): r"""A request message for NodeGroups.SetIamPolicy. See the method description for details. @@ -65261,6 +68753,41 @@ class SetIamPolicyRegionDiskRequest(proto.Message): ) +class SetIamPolicyRegionNetworkFirewallPolicyRequest(proto.Message): + r"""A request message for + RegionNetworkFirewallPolicies.SetIamPolicy. See the method + description for details. + + Attributes: + project (str): + Project ID for this request. + region (str): + The name of the region for this request. + region_set_policy_request_resource (google.cloud.compute_v1.types.RegionSetPolicyRequest): + The body resource for this request + resource (str): + Name or id of the resource for this request. + """ + + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + region_set_policy_request_resource = proto.Field( + proto.MESSAGE, + number=276489091, + message="RegionSetPolicyRequest", + ) + resource = proto.Field( + proto.STRING, + number=195806222, + ) + + class SetIamPolicyReservationRequest(proto.Message): r"""A request message for Reservations.SetIamPolicy. See the method description for details. @@ -67603,7 +71130,7 @@ class ShareSettings(proto.Message): groups. Attributes: - project_map (Sequence[google.cloud.compute_v1.types.ShareSettings.ProjectMapEntry]): + project_map (Mapping[str, google.cloud.compute_v1.types.ShareSettingsProjectConfig]): A map of project id and project config. This is only valid when share_type's value is SPECIFIC_PROJECTS. share_type (str): @@ -67908,7 +71435,7 @@ class Snapshot(proto.Message): retrieve a snapshot. This field is a member of `oneof`_ ``_label_fingerprint``. - labels (Sequence[google.cloud.compute_v1.types.Snapshot.LabelsEntry]): + labels (Mapping[str, str]): Labels to apply to this snapshot. These can be later modified by the setLabels method. Label values may be empty. @@ -68314,7 +71841,7 @@ class SourceInstanceProperties(proto.Message): A list of guest accelerator cards' type and count to use for instances created from this machine image. - labels (Sequence[google.cloud.compute_v1.types.SourceInstanceProperties.LabelsEntry]): + labels (Mapping[str, str]): Labels to apply to instances that are created from this machine image. machine_type (str): @@ -68628,7 +72155,7 @@ class SslCertificateAggregatedList(proto.Message): the server. This field is a member of `oneof`_ ``_id``. - items (Sequence[google.cloud.compute_v1.types.SslCertificateAggregatedList.ItemsEntry]): + items (Mapping[str, google.cloud.compute_v1.types.SslCertificatesScopedList]): A list of SslCertificatesScopedList resources. kind (str): @@ -68775,7 +72302,7 @@ class SslCertificateManagedSslCertificate(proto.Message): r"""Configuration and status of a managed SSL certificate. Attributes: - domain_status (Sequence[google.cloud.compute_v1.types.SslCertificateManagedSslCertificate.DomainStatusEntry]): + domain_status (Mapping[str, str]): [Output only] Detailed statuses of the domains specified for managed certificate resource. domains (Sequence[str]): @@ -69275,7 +72802,7 @@ class StatefulPolicyPreservedState(proto.Message): r"""Configuration of preserved resources. Attributes: - disks (Sequence[google.cloud.compute_v1.types.StatefulPolicyPreservedState.DisksEntry]): + disks (Mapping[str, google.cloud.compute_v1.types.StatefulPolicyPreservedStateDiskDevice]): Disks created on the instances that will be preserved on instance delete, update, etc. This map is keyed with the device names of the disks. @@ -69403,8 +72930,8 @@ class Subnetwork(proto.Message): This field is a member of `oneof`_ ``_enable_flow_logs``. external_ipv6_prefix (str): - [Output Only] The range of external IPv6 addresses that are - owned by this subnetwork. + [Output Only] The external IPv6 address range that is + assigned to this subnetwork. This field is a member of `oneof`_ ``_external_ipv6_prefix``. fingerprint (str): @@ -69429,6 +72956,11 @@ class Subnetwork(proto.Message): identifier is defined by the server. This field is a member of `oneof`_ ``_id``. + internal_ipv6_prefix (str): + [Output Only] The internal IPv6 address range that is + assigned to this subnetwork. + + This field is a member of `oneof`_ ``_internal_ipv6_prefix``. ip_cidr_range (str): The range of internal addresses that are owned by this subnetwork. Provide this property @@ -69446,15 +72978,12 @@ class Subnetwork(proto.Message): The access type of IPv6 address this subnet holds. It's immutable and can only be specified during creation or the first time the subnet is updated into IPV4_IPV6 dual stack. - If the ipv6_type is EXTERNAL then this subnet cannot enable - direct path. Check the Ipv6AccessType enum for the list of - possible values. + Check the Ipv6AccessType enum for the list of possible + values. This field is a member of `oneof`_ ``_ipv6_access_type``. ipv6_cidr_range (str): - [Output Only] The range of internal IPv6 addresses that are - owned by this subnetwork. Note this will be for private - google access only eventually. + [Output Only] This field is for internal use. This field is a member of `oneof`_ ``_ipv6_cidr_range``. kind (str): @@ -69495,12 +73024,9 @@ class Subnetwork(proto.Message): This field is a member of `oneof`_ ``_private_ip_google_access``. private_ipv6_google_access (str): - The private IPv6 google access type for the - VMs in this subnet. This is an expanded field of - enablePrivateV6Access. If both fields are set, - privateIpv6GoogleAccess will take priority. This - field can be both set at resource creation time - and updated using patch. Check the + This field is for internal use. This field + can be both set at resource creation time and + updated using patch. Check the PrivateIpv6GoogleAccess enum for the list of possible values. @@ -69547,11 +73073,13 @@ class Subnetwork(proto.Message): This field is a member of `oneof`_ ``_self_link``. stack_type (str): - The stack type for this subnet to identify whether the IPv6 - feature is enabled or not. If not specified IPV4_ONLY will - be used. This field can be both set at resource creation - time and updated using patch. Check the StackType enum for - the list of possible values. + The stack type for the subnet. If set to IPV4_ONLY, new VMs + in the subnet are assigned IPv4 addresses only. If set to + IPV4_IPV6, new VMs in the subnet can be assigned both IPv4 + and IPv6 addresses. If not specified, IPV4_ONLY is used. + This field can be both set at resource creation time and + updated using patch. Check the StackType enum for the list + of possible values. This field is a member of `oneof`_ ``_stack_type``. state (str): @@ -69570,19 +73098,16 @@ class Subnetwork(proto.Message): class Ipv6AccessType(proto.Enum): r"""The access type of IPv6 address this subnet holds. It's immutable and can only be specified during creation or the first time the - subnet is updated into IPV4_IPV6 dual stack. If the ipv6_type is - EXTERNAL then this subnet cannot enable direct path. + subnet is updated into IPV4_IPV6 dual stack. """ UNDEFINED_IPV6_ACCESS_TYPE = 0 EXTERNAL = 35607499 + INTERNAL = 279295677 UNSPECIFIED_IPV6_ACCESS_TYPE = 313080613 class PrivateIpv6GoogleAccess(proto.Enum): - r"""The private IPv6 google access type for the VMs in this - subnet. This is an expanded field of enablePrivateV6Access. If - both fields are set, privateIpv6GoogleAccess will take priority. - This field can be both set at resource creation time and updated - using patch. + r"""This field is for internal use. This field can be both set at + resource creation time and updated using patch. """ UNDEFINED_PRIVATE_IPV6_GOOGLE_ACCESS = 0 DISABLE_GOOGLE_ACCESS = 450958579 @@ -69618,10 +73143,11 @@ class Role(proto.Enum): BACKUP = 341010882 class StackType(proto.Enum): - r"""The stack type for this subnet to identify whether the IPv6 feature - is enabled or not. If not specified IPV4_ONLY will be used. This - field can be both set at resource creation time and updated using - patch. + r"""The stack type for the subnet. If set to IPV4_ONLY, new VMs in the + subnet are assigned IPv4 addresses only. If set to IPV4_IPV6, new + VMs in the subnet can be assigned both IPv4 and IPv6 addresses. If + not specified, IPV4_ONLY is used. This field can be both set at + resource creation time and updated using patch. """ UNDEFINED_STACK_TYPE = 0 IPV4_IPV6 = 22197249 @@ -69675,6 +73201,11 @@ class State(proto.Enum): number=3355, optional=True, ) + internal_ipv6_prefix = proto.Field( + proto.STRING, + number=506270056, + optional=True, + ) ip_cidr_range = proto.Field( proto.STRING, number=98117322, @@ -69767,7 +73298,7 @@ class SubnetworkAggregatedList(proto.Message): the server. This field is a member of `oneof`_ ``_id``. - items (Sequence[google.cloud.compute_v1.types.SubnetworkAggregatedList.ItemsEntry]): + items (Mapping[str, google.cloud.compute_v1.types.SubnetworksScopedList]): A list of SubnetworksScopedList resources. kind (str): [Output Only] Type of resource. Always @@ -69936,8 +73467,9 @@ class SubnetworkLogConfig(proto.Message): This field is a member of `oneof`_ ``_enable``. filter_expr (str): Can only be specified if VPC flow logs for - this subnetwork is enabled. Export filter used - to define which VPC flow logs should be logged. + this subnetwork is enabled. The filter + expression is used to define which VPC flow logs + should be exported to Cloud Logging. This field is a member of `oneof`_ ``_filter_expr``. flow_sampling (float): @@ -70768,7 +74300,7 @@ class TargetHttpProxyAggregatedList(proto.Message): the server. This field is a member of `oneof`_ ``_id``. - items (Sequence[google.cloud.compute_v1.types.TargetHttpProxyAggregatedList.ItemsEntry]): + items (Mapping[str, google.cloud.compute_v1.types.TargetHttpProxiesScopedList]): A list of TargetHttpProxiesScopedList resources. kind (str): @@ -71222,7 +74754,7 @@ class TargetHttpsProxyAggregatedList(proto.Message): the server. This field is a member of `oneof`_ ``_id``. - items (Sequence[google.cloud.compute_v1.types.TargetHttpsProxyAggregatedList.ItemsEntry]): + items (Mapping[str, google.cloud.compute_v1.types.TargetHttpsProxiesScopedList]): A list of TargetHttpsProxiesScopedList resources. kind (str): @@ -71513,7 +75045,7 @@ class TargetInstanceAggregatedList(proto.Message): the server. This field is a member of `oneof`_ ``_id``. - items (Sequence[google.cloud.compute_v1.types.TargetInstanceAggregatedList.ItemsEntry]): + items (Mapping[str, google.cloud.compute_v1.types.TargetInstancesScopedList]): A list of TargetInstance resources. kind (str): Type of resource. @@ -71875,7 +75407,7 @@ class TargetPoolAggregatedList(proto.Message): the server. This field is a member of `oneof`_ ``_id``. - items (Sequence[google.cloud.compute_v1.types.TargetPoolAggregatedList.ItemsEntry]): + items (Mapping[str, google.cloud.compute_v1.types.TargetPoolsScopedList]): A list of TargetPool resources. kind (str): [Output Only] Type of resource. Always @@ -72809,7 +76341,7 @@ class TargetVpnGatewayAggregatedList(proto.Message): the server. This field is a member of `oneof`_ ``_id``. - items (Sequence[google.cloud.compute_v1.types.TargetVpnGatewayAggregatedList.ItemsEntry]): + items (Mapping[str, google.cloud.compute_v1.types.TargetVpnGatewaysScopedList]): A list of TargetVpnGateway resources. kind (str): [Output Only] Type of resource. Always @@ -73367,6 +76899,35 @@ class TestIamPermissionsNetworkEndpointGroupRequest(proto.Message): ) +class TestIamPermissionsNetworkFirewallPolicyRequest(proto.Message): + r"""A request message for + NetworkFirewallPolicies.TestIamPermissions. See the method + description for details. + + Attributes: + project (str): + Project ID for this request. + resource (str): + Name or id of the resource for this request. + test_permissions_request_resource (google.cloud.compute_v1.types.TestPermissionsRequest): + The body resource for this request + """ + + project = proto.Field( + proto.STRING, + number=227560217, + ) + resource = proto.Field( + proto.STRING, + number=195806222, + ) + test_permissions_request_resource = proto.Field( + proto.MESSAGE, + number=439214758, + message="TestPermissionsRequest", + ) + + class TestIamPermissionsNodeGroupRequest(proto.Message): r"""A request message for NodeGroups.TestIamPermissions. See the method description for details. @@ -73503,6 +77064,41 @@ class TestIamPermissionsRegionDiskRequest(proto.Message): ) +class TestIamPermissionsRegionNetworkFirewallPolicyRequest(proto.Message): + r"""A request message for + RegionNetworkFirewallPolicies.TestIamPermissions. See the method + description for details. + + Attributes: + project (str): + Project ID for this request. + region (str): + The name of the region for this request. + resource (str): + Name or id of the resource for this request. + test_permissions_request_resource (google.cloud.compute_v1.types.TestPermissionsRequest): + The body resource for this request + """ + + project = proto.Field( + proto.STRING, + number=227560217, + ) + region = proto.Field( + proto.STRING, + number=138946292, + ) + resource = proto.Field( + proto.STRING, + number=195806222, + ) + test_permissions_request_resource = proto.Field( + proto.MESSAGE, + number=439214758, + message="TestPermissionsRequest", + ) + + class TestIamPermissionsReservationRequest(proto.Message): r"""A request message for Reservations.TestIamPermissions. See the method description for details. @@ -74156,7 +77752,9 @@ class UpdateInstanceRequest(proto.Message): instance even if the updated properties do not require it. If not specified, then Compute Engine acts based on the minimum action that the - updated properties require. + updated properties require. Check the + MinimalAction enum for the list of possible + values. This field is a member of `oneof`_ ``_minimal_action``. most_disruptive_allowed_action (str): @@ -74165,7 +77763,8 @@ class UpdateInstanceRequest(proto.Message): an error if the instance properties require a more disruptive action as part of the instance update. Valid options from lowest to highest are NO_EFFECT, REFRESH, and - RESTART. + RESTART. Check the MostDisruptiveAllowedAction enum for the + list of possible values. This field is a member of `oneof`_ ``_most_disruptive_allowed_action``. project (str): @@ -74192,6 +77791,27 @@ class UpdateInstanceRequest(proto.Message): The name of the zone for this request. """ + class MinimalAction(proto.Enum): + r"""Specifies the action to take when updating an instance even if the + updated properties do not require it. If not specified, then Compute + Engine acts based on the minimum action that the updated properties + require. Additional supported values which may be not listed in the + enum directly due to technical reasons: INVALID NO_EFFECT REFRESH + RESTART + """ + UNDEFINED_MINIMAL_ACTION = 0 + + class MostDisruptiveAllowedAction(proto.Enum): + r"""Specifies the most disruptive action that can be taken on the + instance as part of the update. Compute Engine returns an error if + the instance properties require a more disruptive action as part of + the instance update. Valid options from lowest to highest are + NO_EFFECT, REFRESH, and RESTART. Additional supported values which + may be not listed in the enum directly due to technical reasons: + INVALID NO_EFFECT REFRESH RESTART + """ + UNDEFINED_MOST_DISRUPTIVE_ALLOWED_ACTION = 0 + instance = proto.Field( proto.STRING, number=18257045, @@ -75488,7 +79108,7 @@ class UrlMapsAggregatedList(proto.Message): the server. This field is a member of `oneof`_ ``_id``. - items (Sequence[google.cloud.compute_v1.types.UrlMapsAggregatedList.ItemsEntry]): + items (Mapping[str, google.cloud.compute_v1.types.UrlMapsScopedList]): A list of UrlMapsScopedList resources. kind (str): Type of resource. @@ -75587,12 +79207,39 @@ class UrlMapsValidateRequest(proto.Message): r""" Attributes: + load_balancing_schemes (Sequence[str]): + Specifies the load balancer type(s) this validation request + is for. Use EXTERNAL_MANAGED for HTTP/HTTPS External Global + Load Balancer with Advanced Traffic Management. Use EXTERNAL + for Classic HTTP/HTTPS External Global Load Balancer. Other + load balancer types are not supported. For more information, + refer to Choosing a load balancer. If unspecified, the load + balancing scheme will be inferred from the backend service + resources this URL map references. If that can not be + inferred (for example, this URL map only references backend + buckets, or this Url map is for rewrites and redirects only + and doesn't reference any backends), EXTERNAL will be used + as the default type. If specified, the scheme(s) must not + conflict with the load balancing scheme of the backend + service resources this Url map references. Check the + LoadBalancingSchemes enum for the list of possible values. resource (google.cloud.compute_v1.types.UrlMap): Content of the UrlMap to be validated. This field is a member of `oneof`_ ``_resource``. """ + class LoadBalancingSchemes(proto.Enum): + r"""""" + UNDEFINED_LOAD_BALANCING_SCHEMES = 0 + EXTERNAL = 35607499 + EXTERNAL_MANAGED = 512006923 + LOAD_BALANCING_SCHEME_UNSPECIFIED = 526507452 + + load_balancing_schemes = proto.RepeatedField( + proto.STRING, + number=6308527, + ) resource = proto.Field( proto.MESSAGE, number=195806222, @@ -76117,7 +79764,7 @@ class VpnGateway(proto.Message): retrieve an VpnGateway. This field is a member of `oneof`_ ``_label_fingerprint``. - labels (Sequence[google.cloud.compute_v1.types.VpnGateway.LabelsEntry]): + labels (Mapping[str, str]): Labels for this resource. These can only be added or modified by the setLabels method. Each label key/value pair must comply with RFC1035. @@ -76239,7 +79886,7 @@ class VpnGatewayAggregatedList(proto.Message): the server. This field is a member of `oneof`_ ``_id``. - items (Sequence[google.cloud.compute_v1.types.VpnGatewayAggregatedList.ItemsEntry]): + items (Mapping[str, google.cloud.compute_v1.types.VpnGatewaysScopedList]): A list of VpnGateway resources. kind (str): [Output Only] Type of resource. Always compute#vpnGateway @@ -76955,7 +80602,7 @@ class VpnTunnelAggregatedList(proto.Message): the server. This field is a member of `oneof`_ ``_id``. - items (Sequence[google.cloud.compute_v1.types.VpnTunnelAggregatedList.ItemsEntry]): + items (Mapping[str, google.cloud.compute_v1.types.VpnTunnelsScopedList]): A list of VpnTunnelsScopedList resources. kind (str): [Output Only] Type of resource. Always compute#vpnTunnel for @@ -77779,7 +81426,7 @@ class ZoneSetLabelsRequest(proto.Message): resource to get the latest fingerprint. This field is a member of `oneof`_ ``_label_fingerprint``. - labels (Sequence[google.cloud.compute_v1.types.ZoneSetLabelsRequest.LabelsEntry]): + labels (Mapping[str, str]): The labels to set for this resource. """ diff --git a/tests/unit/gapic/compute_v1/test_accelerator_types.py b/tests/unit/gapic/compute_v1/test_accelerator_types.py index 0904fa39f..a8223fd67 100644 --- a/tests/unit/gapic/compute_v1/test_accelerator_types.py +++ b/tests/unit/gapic/compute_v1/test_accelerator_types.py @@ -109,9 +109,9 @@ def test_accelerator_types_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -166,9 +166,9 @@ def test_accelerator_types_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_addresses.py b/tests/unit/gapic/compute_v1/test_addresses.py index 20d37de8e..8c42368df 100644 --- a/tests/unit/gapic/compute_v1/test_addresses.py +++ b/tests/unit/gapic/compute_v1/test_addresses.py @@ -101,9 +101,9 @@ def test_addresses_client_from_service_account_info(client_class, transport_name assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -156,9 +156,9 @@ def test_addresses_client_from_service_account_file(client_class, transport_name assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_autoscalers.py b/tests/unit/gapic/compute_v1/test_autoscalers.py index a022f71b2..642400d85 100644 --- a/tests/unit/gapic/compute_v1/test_autoscalers.py +++ b/tests/unit/gapic/compute_v1/test_autoscalers.py @@ -103,9 +103,9 @@ def test_autoscalers_client_from_service_account_info(client_class, transport_na assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -158,9 +158,9 @@ def test_autoscalers_client_from_service_account_file(client_class, transport_na assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_backend_buckets.py b/tests/unit/gapic/compute_v1/test_backend_buckets.py index 9e89c6dd0..67ca3c614 100644 --- a/tests/unit/gapic/compute_v1/test_backend_buckets.py +++ b/tests/unit/gapic/compute_v1/test_backend_buckets.py @@ -106,9 +106,9 @@ def test_backend_buckets_client_from_service_account_info(client_class, transpor assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -161,9 +161,9 @@ def test_backend_buckets_client_from_service_account_file(client_class, transpor assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_backend_services.py b/tests/unit/gapic/compute_v1/test_backend_services.py index bd1b42f35..ce912851f 100644 --- a/tests/unit/gapic/compute_v1/test_backend_services.py +++ b/tests/unit/gapic/compute_v1/test_backend_services.py @@ -108,9 +108,9 @@ def test_backend_services_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -165,9 +165,9 @@ def test_backend_services_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -2542,6 +2542,7 @@ def test_insert_unary_rest(request_type): "connection_draining": {"draining_timeout_sec": 2124}, "connection_tracking_policy": { "connection_persistence_on_unhealthy_backends": "connection_persistence_on_unhealthy_backends_value", + "enable_strong_affinity": True, "idle_timeout_sec": 1694, "tracking_mode": "tracking_mode_value", }, @@ -2582,6 +2583,12 @@ def test_insert_unary_rest(request_type): "id": 205, "kind": "kind_value", "load_balancing_scheme": "load_balancing_scheme_value", + "locality_lb_policies": [ + { + "custom_policy": {"data": "data_value", "name": "name_value"}, + "policy": {"name": "name_value"}, + } + ], "locality_lb_policy": "locality_lb_policy_value", "log_config": {"enable": True, "sample_rate": 0.1165}, "max_stream_duration": {}, @@ -2899,6 +2906,7 @@ def test_insert_unary_rest_bad_request( "connection_draining": {"draining_timeout_sec": 2124}, "connection_tracking_policy": { "connection_persistence_on_unhealthy_backends": "connection_persistence_on_unhealthy_backends_value", + "enable_strong_affinity": True, "idle_timeout_sec": 1694, "tracking_mode": "tracking_mode_value", }, @@ -2939,6 +2947,12 @@ def test_insert_unary_rest_bad_request( "id": 205, "kind": "kind_value", "load_balancing_scheme": "load_balancing_scheme_value", + "locality_lb_policies": [ + { + "custom_policy": {"data": "data_value", "name": "name_value"}, + "policy": {"name": "name_value"}, + } + ], "locality_lb_policy": "locality_lb_policy_value", "log_config": {"enable": True, "sample_rate": 0.1165}, "max_stream_duration": {}, @@ -3473,6 +3487,7 @@ def test_patch_unary_rest(request_type): "connection_draining": {"draining_timeout_sec": 2124}, "connection_tracking_policy": { "connection_persistence_on_unhealthy_backends": "connection_persistence_on_unhealthy_backends_value", + "enable_strong_affinity": True, "idle_timeout_sec": 1694, "tracking_mode": "tracking_mode_value", }, @@ -3513,6 +3528,12 @@ def test_patch_unary_rest(request_type): "id": 205, "kind": "kind_value", "load_balancing_scheme": "load_balancing_scheme_value", + "locality_lb_policies": [ + { + "custom_policy": {"data": "data_value", "name": "name_value"}, + "policy": {"name": "name_value"}, + } + ], "locality_lb_policy": "locality_lb_policy_value", "log_config": {"enable": True, "sample_rate": 0.1165}, "max_stream_duration": {}, @@ -3835,6 +3856,7 @@ def test_patch_unary_rest_bad_request( "connection_draining": {"draining_timeout_sec": 2124}, "connection_tracking_policy": { "connection_persistence_on_unhealthy_backends": "connection_persistence_on_unhealthy_backends_value", + "enable_strong_affinity": True, "idle_timeout_sec": 1694, "tracking_mode": "tracking_mode_value", }, @@ -3875,6 +3897,12 @@ def test_patch_unary_rest_bad_request( "id": 205, "kind": "kind_value", "load_balancing_scheme": "load_balancing_scheme_value", + "locality_lb_policies": [ + { + "custom_policy": {"data": "data_value", "name": "name_value"}, + "policy": {"name": "name_value"}, + } + ], "locality_lb_policy": "locality_lb_policy_value", "log_config": {"enable": True, "sample_rate": 0.1165}, "max_stream_duration": {}, @@ -4729,6 +4757,7 @@ def test_update_unary_rest(request_type): "connection_draining": {"draining_timeout_sec": 2124}, "connection_tracking_policy": { "connection_persistence_on_unhealthy_backends": "connection_persistence_on_unhealthy_backends_value", + "enable_strong_affinity": True, "idle_timeout_sec": 1694, "tracking_mode": "tracking_mode_value", }, @@ -4769,6 +4798,12 @@ def test_update_unary_rest(request_type): "id": 205, "kind": "kind_value", "load_balancing_scheme": "load_balancing_scheme_value", + "locality_lb_policies": [ + { + "custom_policy": {"data": "data_value", "name": "name_value"}, + "policy": {"name": "name_value"}, + } + ], "locality_lb_policy": "locality_lb_policy_value", "log_config": {"enable": True, "sample_rate": 0.1165}, "max_stream_duration": {}, @@ -5091,6 +5126,7 @@ def test_update_unary_rest_bad_request( "connection_draining": {"draining_timeout_sec": 2124}, "connection_tracking_policy": { "connection_persistence_on_unhealthy_backends": "connection_persistence_on_unhealthy_backends_value", + "enable_strong_affinity": True, "idle_timeout_sec": 1694, "tracking_mode": "tracking_mode_value", }, @@ -5131,6 +5167,12 @@ def test_update_unary_rest_bad_request( "id": 205, "kind": "kind_value", "load_balancing_scheme": "load_balancing_scheme_value", + "locality_lb_policies": [ + { + "custom_policy": {"data": "data_value", "name": "name_value"}, + "policy": {"name": "name_value"}, + } + ], "locality_lb_policy": "locality_lb_policy_value", "log_config": {"enable": True, "sample_rate": 0.1165}, "max_stream_duration": {}, diff --git a/tests/unit/gapic/compute_v1/test_disk_types.py b/tests/unit/gapic/compute_v1/test_disk_types.py index abec82e38..1e21e1acf 100644 --- a/tests/unit/gapic/compute_v1/test_disk_types.py +++ b/tests/unit/gapic/compute_v1/test_disk_types.py @@ -101,9 +101,9 @@ def test_disk_types_client_from_service_account_info(client_class, transport_nam assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -156,9 +156,9 @@ def test_disk_types_client_from_service_account_file(client_class, transport_nam assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_disks.py b/tests/unit/gapic/compute_v1/test_disks.py index d0d27bcbe..62cfab0e3 100644 --- a/tests/unit/gapic/compute_v1/test_disks.py +++ b/tests/unit/gapic/compute_v1/test_disks.py @@ -100,9 +100,9 @@ def test_disks_client_from_service_account_info(client_class, transport_name): assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -153,9 +153,9 @@ def test_disks_client_from_service_account_file(client_class, transport_name): assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_external_vpn_gateways.py b/tests/unit/gapic/compute_v1/test_external_vpn_gateways.py index 0357fb224..472994300 100644 --- a/tests/unit/gapic/compute_v1/test_external_vpn_gateways.py +++ b/tests/unit/gapic/compute_v1/test_external_vpn_gateways.py @@ -111,9 +111,9 @@ def test_external_vpn_gateways_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -168,9 +168,9 @@ def test_external_vpn_gateways_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_firewall_policies.py b/tests/unit/gapic/compute_v1/test_firewall_policies.py index deacda2a0..f55b5e7ef 100644 --- a/tests/unit/gapic/compute_v1/test_firewall_policies.py +++ b/tests/unit/gapic/compute_v1/test_firewall_policies.py @@ -109,9 +109,9 @@ def test_firewall_policies_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -166,9 +166,9 @@ def test_firewall_policies_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -907,10 +907,13 @@ def test_add_rule_unary_rest(request_type): } ], "src_ip_ranges": ["src_ip_ranges_value_1", "src_ip_ranges_value_2"], + "src_secure_tags": [{"name": "name_value", "state": "state_value"}], }, "priority": 898, + "rule_name": "rule_name_value", "rule_tuple_count": 1737, "target_resources": ["target_resources_value_1", "target_resources_value_2"], + "target_secure_tags": {}, "target_service_accounts": [ "target_service_accounts_value_1", "target_service_accounts_value_2", @@ -1149,10 +1152,13 @@ def test_add_rule_unary_rest_bad_request( } ], "src_ip_ranges": ["src_ip_ranges_value_1", "src_ip_ranges_value_2"], + "src_secure_tags": [{"name": "name_value", "state": "state_value"}], }, "priority": 898, + "rule_name": "rule_name_value", "rule_tuple_count": 1737, "target_resources": ["target_resources_value_1", "target_resources_value_2"], + "target_secure_tags": {}, "target_service_accounts": [ "target_service_accounts_value_1", "target_service_accounts_value_2", @@ -1880,6 +1886,7 @@ def test_get_rest(request_type): kind="kind_value", name="name_value", parent="parent_value", + region="region_value", rule_tuple_count=1737, self_link="self_link_value", self_link_with_id="self_link_with_id_value", @@ -1904,6 +1911,7 @@ def test_get_rest(request_type): assert response.kind == "kind_value" assert response.name == "name_value" assert response.parent == "parent_value" + assert response.region == "region_value" assert response.rule_tuple_count == 1737 assert response.self_link == "self_link_value" assert response.self_link_with_id == "self_link_with_id_value" @@ -2686,6 +2694,7 @@ def test_get_rule_rest(request_type): enable_logging=True, kind="kind_value", priority=898, + rule_name="rule_name_value", rule_tuple_count=1737, target_resources=["target_resources_value"], target_service_accounts=["target_service_accounts_value"], @@ -2708,6 +2717,7 @@ def test_get_rule_rest(request_type): assert response.enable_logging is True assert response.kind == "kind_value" assert response.priority == 898 + assert response.rule_name == "rule_name_value" assert response.rule_tuple_count == 1737 assert response.target_resources == ["target_resources_value"] assert response.target_service_accounts == ["target_service_accounts_value"] @@ -2968,6 +2978,7 @@ def test_insert_unary_rest(request_type): "kind": "kind_value", "name": "name_value", "parent": "parent_value", + "region": "region_value", "rule_tuple_count": 1737, "rules": [ { @@ -2989,13 +3000,16 @@ def test_insert_unary_rest(request_type): } ], "src_ip_ranges": ["src_ip_ranges_value_1", "src_ip_ranges_value_2"], + "src_secure_tags": [{"name": "name_value", "state": "state_value"}], }, "priority": 898, + "rule_name": "rule_name_value", "rule_tuple_count": 1737, "target_resources": [ "target_resources_value_1", "target_resources_value_2", ], + "target_secure_tags": {}, "target_service_accounts": [ "target_service_accounts_value_1", "target_service_accounts_value_2", @@ -3241,6 +3255,7 @@ def test_insert_unary_rest_bad_request( "kind": "kind_value", "name": "name_value", "parent": "parent_value", + "region": "region_value", "rule_tuple_count": 1737, "rules": [ { @@ -3262,13 +3277,16 @@ def test_insert_unary_rest_bad_request( } ], "src_ip_ranges": ["src_ip_ranges_value_1", "src_ip_ranges_value_2"], + "src_secure_tags": [{"name": "name_value", "state": "state_value"}], }, "priority": 898, + "rule_name": "rule_name_value", "rule_tuple_count": 1737, "target_resources": [ "target_resources_value_1", "target_resources_value_2", ], + "target_secure_tags": {}, "target_service_accounts": [ "target_service_accounts_value_1", "target_service_accounts_value_2", @@ -4022,6 +4040,7 @@ def test_patch_unary_rest(request_type): "kind": "kind_value", "name": "name_value", "parent": "parent_value", + "region": "region_value", "rule_tuple_count": 1737, "rules": [ { @@ -4043,13 +4062,16 @@ def test_patch_unary_rest(request_type): } ], "src_ip_ranges": ["src_ip_ranges_value_1", "src_ip_ranges_value_2"], + "src_secure_tags": [{"name": "name_value", "state": "state_value"}], }, "priority": 898, + "rule_name": "rule_name_value", "rule_tuple_count": 1737, "target_resources": [ "target_resources_value_1", "target_resources_value_2", ], + "target_secure_tags": {}, "target_service_accounts": [ "target_service_accounts_value_1", "target_service_accounts_value_2", @@ -4295,6 +4317,7 @@ def test_patch_unary_rest_bad_request( "kind": "kind_value", "name": "name_value", "parent": "parent_value", + "region": "region_value", "rule_tuple_count": 1737, "rules": [ { @@ -4316,13 +4339,16 @@ def test_patch_unary_rest_bad_request( } ], "src_ip_ranges": ["src_ip_ranges_value_1", "src_ip_ranges_value_2"], + "src_secure_tags": [{"name": "name_value", "state": "state_value"}], }, "priority": 898, + "rule_name": "rule_name_value", "rule_tuple_count": 1737, "target_resources": [ "target_resources_value_1", "target_resources_value_2", ], + "target_secure_tags": {}, "target_service_accounts": [ "target_service_accounts_value_1", "target_service_accounts_value_2", @@ -4454,10 +4480,13 @@ def test_patch_rule_unary_rest(request_type): } ], "src_ip_ranges": ["src_ip_ranges_value_1", "src_ip_ranges_value_2"], + "src_secure_tags": [{"name": "name_value", "state": "state_value"}], }, "priority": 898, + "rule_name": "rule_name_value", "rule_tuple_count": 1737, "target_resources": ["target_resources_value_1", "target_resources_value_2"], + "target_secure_tags": {}, "target_service_accounts": [ "target_service_accounts_value_1", "target_service_accounts_value_2", @@ -4706,10 +4735,13 @@ def test_patch_rule_unary_rest_bad_request( } ], "src_ip_ranges": ["src_ip_ranges_value_1", "src_ip_ranges_value_2"], + "src_secure_tags": [{"name": "name_value", "state": "state_value"}], }, "priority": 898, + "rule_name": "rule_name_value", "rule_tuple_count": 1737, "target_resources": ["target_resources_value_1", "target_resources_value_2"], + "target_secure_tags": {}, "target_service_accounts": [ "target_service_accounts_value_1", "target_service_accounts_value_2", diff --git a/tests/unit/gapic/compute_v1/test_firewalls.py b/tests/unit/gapic/compute_v1/test_firewalls.py index 9bee0b470..702139fe7 100644 --- a/tests/unit/gapic/compute_v1/test_firewalls.py +++ b/tests/unit/gapic/compute_v1/test_firewalls.py @@ -101,9 +101,9 @@ def test_firewalls_client_from_service_account_info(client_class, transport_name assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -156,9 +156,9 @@ def test_firewalls_client_from_service_account_file(client_class, transport_name assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_forwarding_rules.py b/tests/unit/gapic/compute_v1/test_forwarding_rules.py index acae5377a..c6d599a44 100644 --- a/tests/unit/gapic/compute_v1/test_forwarding_rules.py +++ b/tests/unit/gapic/compute_v1/test_forwarding_rules.py @@ -108,9 +108,9 @@ def test_forwarding_rules_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -165,9 +165,9 @@ def test_forwarding_rules_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_global_addresses.py b/tests/unit/gapic/compute_v1/test_global_addresses.py index 673afca97..a0329ea6d 100644 --- a/tests/unit/gapic/compute_v1/test_global_addresses.py +++ b/tests/unit/gapic/compute_v1/test_global_addresses.py @@ -108,9 +108,9 @@ def test_global_addresses_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -165,9 +165,9 @@ def test_global_addresses_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_global_forwarding_rules.py b/tests/unit/gapic/compute_v1/test_global_forwarding_rules.py index aa479b043..1af015d1f 100644 --- a/tests/unit/gapic/compute_v1/test_global_forwarding_rules.py +++ b/tests/unit/gapic/compute_v1/test_global_forwarding_rules.py @@ -111,9 +111,9 @@ def test_global_forwarding_rules_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -168,9 +168,9 @@ def test_global_forwarding_rules_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_global_network_endpoint_groups.py b/tests/unit/gapic/compute_v1/test_global_network_endpoint_groups.py index c8bf2e284..f0497108c 100644 --- a/tests/unit/gapic/compute_v1/test_global_network_endpoint_groups.py +++ b/tests/unit/gapic/compute_v1/test_global_network_endpoint_groups.py @@ -113,9 +113,9 @@ def test_global_network_endpoint_groups_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -170,9 +170,9 @@ def test_global_network_endpoint_groups_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_global_operations.py b/tests/unit/gapic/compute_v1/test_global_operations.py index 639c41048..b37135b31 100644 --- a/tests/unit/gapic/compute_v1/test_global_operations.py +++ b/tests/unit/gapic/compute_v1/test_global_operations.py @@ -109,9 +109,9 @@ def test_global_operations_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -166,9 +166,9 @@ def test_global_operations_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_global_organization_operations.py b/tests/unit/gapic/compute_v1/test_global_organization_operations.py index 42b65b014..ac02a0e57 100644 --- a/tests/unit/gapic/compute_v1/test_global_organization_operations.py +++ b/tests/unit/gapic/compute_v1/test_global_organization_operations.py @@ -113,9 +113,9 @@ def test_global_organization_operations_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -170,9 +170,9 @@ def test_global_organization_operations_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_global_public_delegated_prefixes.py b/tests/unit/gapic/compute_v1/test_global_public_delegated_prefixes.py index 435b5f067..0aae3cd08 100644 --- a/tests/unit/gapic/compute_v1/test_global_public_delegated_prefixes.py +++ b/tests/unit/gapic/compute_v1/test_global_public_delegated_prefixes.py @@ -115,9 +115,9 @@ def test_global_public_delegated_prefixes_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -172,9 +172,9 @@ def test_global_public_delegated_prefixes_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_health_checks.py b/tests/unit/gapic/compute_v1/test_health_checks.py index 32775c53b..cc255411c 100644 --- a/tests/unit/gapic/compute_v1/test_health_checks.py +++ b/tests/unit/gapic/compute_v1/test_health_checks.py @@ -103,9 +103,9 @@ def test_health_checks_client_from_service_account_info(client_class, transport_ assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -158,9 +158,9 @@ def test_health_checks_client_from_service_account_file(client_class, transport_ assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_image_family_views.py b/tests/unit/gapic/compute_v1/test_image_family_views.py index b8ea95f5a..ca6cef236 100644 --- a/tests/unit/gapic/compute_v1/test_image_family_views.py +++ b/tests/unit/gapic/compute_v1/test_image_family_views.py @@ -108,9 +108,9 @@ def test_image_family_views_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -165,9 +165,9 @@ def test_image_family_views_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_images.py b/tests/unit/gapic/compute_v1/test_images.py index bead0a020..0dc939f97 100644 --- a/tests/unit/gapic/compute_v1/test_images.py +++ b/tests/unit/gapic/compute_v1/test_images.py @@ -100,9 +100,9 @@ def test_images_client_from_service_account_info(client_class, transport_name): assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -153,9 +153,9 @@ def test_images_client_from_service_account_file(client_class, transport_name): assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_instance_group_managers.py b/tests/unit/gapic/compute_v1/test_instance_group_managers.py index faece53b9..4dda887a5 100644 --- a/tests/unit/gapic/compute_v1/test_instance_group_managers.py +++ b/tests/unit/gapic/compute_v1/test_instance_group_managers.py @@ -111,9 +111,9 @@ def test_instance_group_managers_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -168,9 +168,9 @@ def test_instance_group_managers_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_instance_groups.py b/tests/unit/gapic/compute_v1/test_instance_groups.py index 651a5fa36..976100e3f 100644 --- a/tests/unit/gapic/compute_v1/test_instance_groups.py +++ b/tests/unit/gapic/compute_v1/test_instance_groups.py @@ -106,9 +106,9 @@ def test_instance_groups_client_from_service_account_info(client_class, transpor assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -161,9 +161,9 @@ def test_instance_groups_client_from_service_account_file(client_class, transpor assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_instance_templates.py b/tests/unit/gapic/compute_v1/test_instance_templates.py index bda147203..afac338bb 100644 --- a/tests/unit/gapic/compute_v1/test_instance_templates.py +++ b/tests/unit/gapic/compute_v1/test_instance_templates.py @@ -109,9 +109,9 @@ def test_instance_templates_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -166,9 +166,9 @@ def test_instance_templates_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -1522,6 +1522,7 @@ def test_insert_unary_rest(request_type): } ], "fingerprint": "fingerprint_value", + "internal_ipv6_prefix_length": 2831, "ipv6_access_configs": {}, "ipv6_access_type": "ipv6_access_type_value", "ipv6_address": "ipv6_address_value", @@ -1908,6 +1909,7 @@ def test_insert_unary_rest_bad_request( } ], "fingerprint": "fingerprint_value", + "internal_ipv6_prefix_length": 2831, "ipv6_access_configs": {}, "ipv6_access_type": "ipv6_access_type_value", "ipv6_address": "ipv6_address_value", diff --git a/tests/unit/gapic/compute_v1/test_instances.py b/tests/unit/gapic/compute_v1/test_instances.py index 65ac6645d..f169868bd 100644 --- a/tests/unit/gapic/compute_v1/test_instances.py +++ b/tests/unit/gapic/compute_v1/test_instances.py @@ -101,9 +101,9 @@ def test_instances_client_from_service_account_info(client_class, transport_name assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -156,9 +156,9 @@ def test_instances_client_from_service_account_file(client_class, transport_name assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -2105,6 +2105,7 @@ def test_bulk_insert_unary_rest(request_type): } ], "fingerprint": "fingerprint_value", + "internal_ipv6_prefix_length": 2831, "ipv6_access_configs": {}, "ipv6_access_type": "ipv6_access_type_value", "ipv6_address": "ipv6_address_value", @@ -2483,6 +2484,7 @@ def test_bulk_insert_unary_rest_bad_request( } ], "fingerprint": "fingerprint_value", + "internal_ipv6_prefix_length": 2831, "ipv6_access_configs": {}, "ipv6_access_type": "ipv6_access_type_value", "ipv6_address": "ipv6_address_value", @@ -5851,6 +5853,7 @@ def test_insert_unary_rest(request_type): } ], "fingerprint": "fingerprint_value", + "internal_ipv6_prefix_length": 2831, "ipv6_access_configs": {}, "ipv6_access_type": "ipv6_access_type_value", "ipv6_address": "ipv6_address_value", @@ -5867,6 +5870,7 @@ def test_insert_unary_rest(request_type): "network_performance_config": { "total_egress_bandwidth_tier": "total_egress_bandwidth_tier_value" }, + "params": {"resource_manager_tags": {}}, "private_ipv6_google_access": "private_ipv6_google_access_value", "reservation_affinity": { "consume_reservation_type": "consume_reservation_type_value", @@ -6246,6 +6250,7 @@ def test_insert_unary_rest_bad_request( } ], "fingerprint": "fingerprint_value", + "internal_ipv6_prefix_length": 2831, "ipv6_access_configs": {}, "ipv6_access_type": "ipv6_access_type_value", "ipv6_address": "ipv6_address_value", @@ -6262,6 +6267,7 @@ def test_insert_unary_rest_bad_request( "network_performance_config": { "total_egress_bandwidth_tier": "total_egress_bandwidth_tier_value" }, + "params": {"resource_manager_tags": {}}, "private_ipv6_google_access": "private_ipv6_google_access_value", "reservation_affinity": { "consume_reservation_type": "consume_reservation_type_value", @@ -14633,6 +14639,7 @@ def test_update_unary_rest(request_type): } ], "fingerprint": "fingerprint_value", + "internal_ipv6_prefix_length": 2831, "ipv6_access_configs": {}, "ipv6_access_type": "ipv6_access_type_value", "ipv6_address": "ipv6_address_value", @@ -14649,6 +14656,7 @@ def test_update_unary_rest(request_type): "network_performance_config": { "total_egress_bandwidth_tier": "total_egress_bandwidth_tier_value" }, + "params": {"resource_manager_tags": {}}, "private_ipv6_google_access": "private_ipv6_google_access_value", "reservation_affinity": { "consume_reservation_type": "consume_reservation_type_value", @@ -15033,6 +15041,7 @@ def test_update_unary_rest_bad_request( } ], "fingerprint": "fingerprint_value", + "internal_ipv6_prefix_length": 2831, "ipv6_access_configs": {}, "ipv6_access_type": "ipv6_access_type_value", "ipv6_address": "ipv6_address_value", @@ -15049,6 +15058,7 @@ def test_update_unary_rest_bad_request( "network_performance_config": { "total_egress_bandwidth_tier": "total_egress_bandwidth_tier_value" }, + "params": {"resource_manager_tags": {}}, "private_ipv6_google_access": "private_ipv6_google_access_value", "reservation_affinity": { "consume_reservation_type": "consume_reservation_type_value", @@ -15929,6 +15939,7 @@ def test_update_network_interface_unary_rest(request_type): } ], "fingerprint": "fingerprint_value", + "internal_ipv6_prefix_length": 2831, "ipv6_access_configs": {}, "ipv6_access_type": "ipv6_access_type_value", "ipv6_address": "ipv6_address_value", @@ -16210,6 +16221,7 @@ def test_update_network_interface_unary_rest_bad_request( } ], "fingerprint": "fingerprint_value", + "internal_ipv6_prefix_length": 2831, "ipv6_access_configs": {}, "ipv6_access_type": "ipv6_access_type_value", "ipv6_address": "ipv6_address_value", diff --git a/tests/unit/gapic/compute_v1/test_interconnect_attachments.py b/tests/unit/gapic/compute_v1/test_interconnect_attachments.py index a0660f217..00689d0d9 100644 --- a/tests/unit/gapic/compute_v1/test_interconnect_attachments.py +++ b/tests/unit/gapic/compute_v1/test_interconnect_attachments.py @@ -111,9 +111,9 @@ def test_interconnect_attachments_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -168,9 +168,9 @@ def test_interconnect_attachments_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_interconnect_locations.py b/tests/unit/gapic/compute_v1/test_interconnect_locations.py index 2711fe6be..d61089b4b 100644 --- a/tests/unit/gapic/compute_v1/test_interconnect_locations.py +++ b/tests/unit/gapic/compute_v1/test_interconnect_locations.py @@ -111,9 +111,9 @@ def test_interconnect_locations_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -168,9 +168,9 @@ def test_interconnect_locations_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_interconnects.py b/tests/unit/gapic/compute_v1/test_interconnects.py index ea56abc41..2ddf5a644 100644 --- a/tests/unit/gapic/compute_v1/test_interconnects.py +++ b/tests/unit/gapic/compute_v1/test_interconnects.py @@ -106,9 +106,9 @@ def test_interconnects_client_from_service_account_info(client_class, transport_ assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -161,9 +161,9 @@ def test_interconnects_client_from_service_account_file(client_class, transport_ assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_license_codes.py b/tests/unit/gapic/compute_v1/test_license_codes.py index 74b9e494c..3c7fdcb12 100644 --- a/tests/unit/gapic/compute_v1/test_license_codes.py +++ b/tests/unit/gapic/compute_v1/test_license_codes.py @@ -102,9 +102,9 @@ def test_license_codes_client_from_service_account_info(client_class, transport_ assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -157,9 +157,9 @@ def test_license_codes_client_from_service_account_file(client_class, transport_ assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_licenses.py b/tests/unit/gapic/compute_v1/test_licenses.py index c3f6b9a60..1bc619985 100644 --- a/tests/unit/gapic/compute_v1/test_licenses.py +++ b/tests/unit/gapic/compute_v1/test_licenses.py @@ -101,9 +101,9 @@ def test_licenses_client_from_service_account_info(client_class, transport_name) assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -156,9 +156,9 @@ def test_licenses_client_from_service_account_file(client_class, transport_name) assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_machine_images.py b/tests/unit/gapic/compute_v1/test_machine_images.py index 9780a16fc..eff0d59cc 100644 --- a/tests/unit/gapic/compute_v1/test_machine_images.py +++ b/tests/unit/gapic/compute_v1/test_machine_images.py @@ -106,9 +106,9 @@ def test_machine_images_client_from_service_account_info(client_class, transport assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -161,9 +161,9 @@ def test_machine_images_client_from_service_account_file(client_class, transport assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -1509,6 +1509,7 @@ def test_insert_unary_rest(request_type): } ], "fingerprint": "fingerprint_value", + "internal_ipv6_prefix_length": 2831, "ipv6_access_configs": {}, "ipv6_access_type": "ipv6_access_type_value", "ipv6_address": "ipv6_address_value", @@ -1946,6 +1947,7 @@ def test_insert_unary_rest_bad_request( } ], "fingerprint": "fingerprint_value", + "internal_ipv6_prefix_length": 2831, "ipv6_access_configs": {}, "ipv6_access_type": "ipv6_access_type_value", "ipv6_address": "ipv6_address_value", diff --git a/tests/unit/gapic/compute_v1/test_machine_types.py b/tests/unit/gapic/compute_v1/test_machine_types.py index b9cd3558a..298497c69 100644 --- a/tests/unit/gapic/compute_v1/test_machine_types.py +++ b/tests/unit/gapic/compute_v1/test_machine_types.py @@ -103,9 +103,9 @@ def test_machine_types_client_from_service_account_info(client_class, transport_ assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -158,9 +158,9 @@ def test_machine_types_client_from_service_account_file(client_class, transport_ assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_network_edge_security_services.py b/tests/unit/gapic/compute_v1/test_network_edge_security_services.py new file mode 100644 index 000000000..c07c55417 --- /dev/null +++ b/tests/unit/gapic/compute_v1/test_network_edge_security_services.py @@ -0,0 +1,2720 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +import os +import mock + +import grpc +from grpc.experimental import aio +from collections.abc import Iterable +import json +import math +import pytest +from proto.marshal.rules.dates import DurationRule, TimestampRule + +from requests import Response +from requests import Request, PreparedRequest +from requests.sessions import Session + +from google.api_core import client_options +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers +from google.api_core import grpc_helpers_async +from google.api_core import path_template +from google.auth import credentials as ga_credentials +from google.auth.exceptions import MutualTLSChannelError +from google.cloud.compute_v1.services.network_edge_security_services import ( + NetworkEdgeSecurityServicesClient, +) +from google.cloud.compute_v1.services.network_edge_security_services import pagers +from google.cloud.compute_v1.services.network_edge_security_services import transports +from google.cloud.compute_v1.types import compute +from google.oauth2 import service_account +import google.auth + + +def client_cert_source_callback(): + return b"cert bytes", b"key bytes" + + +# If default endpoint is localhost, then default mtls endpoint will be the same. +# This method modifies the default endpoint so the client can produce a different +# mtls endpoint for endpoint testing purposes. +def modify_default_endpoint(client): + return ( + "foo.googleapis.com" + if ("localhost" in client.DEFAULT_ENDPOINT) + else client.DEFAULT_ENDPOINT + ) + + +def test__get_default_mtls_endpoint(): + api_endpoint = "example.googleapis.com" + api_mtls_endpoint = "example.mtls.googleapis.com" + sandbox_endpoint = "example.sandbox.googleapis.com" + sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" + non_googleapi = "api.example.com" + + assert NetworkEdgeSecurityServicesClient._get_default_mtls_endpoint(None) is None + assert ( + NetworkEdgeSecurityServicesClient._get_default_mtls_endpoint(api_endpoint) + == api_mtls_endpoint + ) + assert ( + NetworkEdgeSecurityServicesClient._get_default_mtls_endpoint(api_mtls_endpoint) + == api_mtls_endpoint + ) + assert ( + NetworkEdgeSecurityServicesClient._get_default_mtls_endpoint(sandbox_endpoint) + == sandbox_mtls_endpoint + ) + assert ( + NetworkEdgeSecurityServicesClient._get_default_mtls_endpoint( + sandbox_mtls_endpoint + ) + == sandbox_mtls_endpoint + ) + assert ( + NetworkEdgeSecurityServicesClient._get_default_mtls_endpoint(non_googleapi) + == non_googleapi + ) + + +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (NetworkEdgeSecurityServicesClient, "rest"), + ], +) +def test_network_edge_security_services_client_from_service_account_info( + client_class, transport_name +): + creds = ga_credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = client_class.from_service_account_info(info, transport=transport_name) + assert client.transport._credentials == creds + assert isinstance(client, client_class) + + assert client.transport._host == ( + "compute.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://compute.googleapis.com" + ) + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [ + (transports.NetworkEdgeSecurityServicesRestTransport, "rest"), + ], +) +def test_network_edge_security_services_client_service_account_always_use_jwt( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) + + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (NetworkEdgeSecurityServicesClient, "rest"), + ], +) +def test_network_edge_security_services_client_from_service_account_file( + client_class, transport_name +): + creds = ga_credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_file" + ) as factory: + factory.return_value = creds + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) + assert client.transport._credentials == creds + assert isinstance(client, client_class) + + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) + assert client.transport._credentials == creds + assert isinstance(client, client_class) + + assert client.transport._host == ( + "compute.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://compute.googleapis.com" + ) + + +def test_network_edge_security_services_client_get_transport_class(): + transport = NetworkEdgeSecurityServicesClient.get_transport_class() + available_transports = [ + transports.NetworkEdgeSecurityServicesRestTransport, + ] + assert transport in available_transports + + transport = NetworkEdgeSecurityServicesClient.get_transport_class("rest") + assert transport == transports.NetworkEdgeSecurityServicesRestTransport + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name", + [ + ( + NetworkEdgeSecurityServicesClient, + transports.NetworkEdgeSecurityServicesRestTransport, + "rest", + ), + ], +) +@mock.patch.object( + NetworkEdgeSecurityServicesClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(NetworkEdgeSecurityServicesClient), +) +def test_network_edge_security_services_client_client_options( + client_class, transport_class, transport_name +): + # Check that if channel is provided we won't create a new one. + with mock.patch.object( + NetworkEdgeSecurityServicesClient, "get_transport_class" + ) as gtc: + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) + client = client_class(transport=transport) + gtc.assert_not_called() + + # Check that if channel is provided via str we will create a new one. + with mock.patch.object( + NetworkEdgeSecurityServicesClient, "get_transport_class" + ) as gtc: + client = client_class(transport=transport_name) + gtc.assert_called() + + # Check the case api_endpoint is provided. + options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(transport=transport_name, client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host="squid.clam.whelk", + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is + # "never". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is + # "always". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_MTLS_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has + # unsupported value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): + with pytest.raises(MutualTLSChannelError): + client = client_class(transport=transport_name) + + # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"} + ): + with pytest.raises(ValueError): + client = client_class(transport=transport_name) + + # Check the case quota_project_id is provided + options = client_options.ClientOptions(quota_project_id="octopus") + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id="octopus", + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name,use_client_cert_env", + [ + ( + NetworkEdgeSecurityServicesClient, + transports.NetworkEdgeSecurityServicesRestTransport, + "rest", + "true", + ), + ( + NetworkEdgeSecurityServicesClient, + transports.NetworkEdgeSecurityServicesRestTransport, + "rest", + "false", + ), + ], +) +@mock.patch.object( + NetworkEdgeSecurityServicesClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(NetworkEdgeSecurityServicesClient), +) +@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}) +def test_network_edge_security_services_client_mtls_env_auto( + client_class, transport_class, transport_name, use_client_cert_env +): + # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default + # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists. + + # Check the case client_cert_source is provided. Whether client cert is used depends on + # GOOGLE_API_USE_CLIENT_CERTIFICATE value. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + options = client_options.ClientOptions( + client_cert_source=client_cert_source_callback + ) + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + + if use_client_cert_env == "false": + expected_client_cert_source = None + expected_host = client.DEFAULT_ENDPOINT + else: + expected_client_cert_source = client_cert_source_callback + expected_host = client.DEFAULT_MTLS_ENDPOINT + + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + # Check the case ADC client cert is provided. Whether client cert is used depends on + # GOOGLE_API_USE_CLIENT_CERTIFICATE value. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + with mock.patch.object(transport_class, "__init__") as patched: + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, + ): + with mock.patch( + "google.auth.transport.mtls.default_client_cert_source", + return_value=client_cert_source_callback, + ): + if use_client_cert_env == "false": + expected_host = client.DEFAULT_ENDPOINT + expected_client_cert_source = None + else: + expected_host = client.DEFAULT_MTLS_ENDPOINT + expected_client_cert_source = client_cert_source_callback + + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + # Check the case client_cert_source and ADC client cert are not provided. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + with mock.patch.object(transport_class, "__init__") as patched: + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=False, + ): + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + +@pytest.mark.parametrize("client_class", [NetworkEdgeSecurityServicesClient]) +@mock.patch.object( + NetworkEdgeSecurityServicesClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(NetworkEdgeSecurityServicesClient), +) +def test_network_edge_security_services_client_get_mtls_endpoint_and_cert_source( + client_class, +): + mock_client_cert_source = mock.Mock() + + # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "true". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + mock_api_endpoint = "foo" + options = client_options.ClientOptions( + client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint + ) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( + options + ) + assert api_endpoint == mock_api_endpoint + assert cert_source == mock_client_cert_source + + # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "false". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): + mock_client_cert_source = mock.Mock() + mock_api_endpoint = "foo" + options = client_options.ClientOptions( + client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint + ) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( + options + ) + assert api_endpoint == mock_api_endpoint + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "never". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "always". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert doesn't exist. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=False, + ): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert exists. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, + ): + with mock.patch( + "google.auth.transport.mtls.default_client_cert_source", + return_value=mock_client_cert_source, + ): + ( + api_endpoint, + cert_source, + ) = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + assert cert_source == mock_client_cert_source + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name", + [ + ( + NetworkEdgeSecurityServicesClient, + transports.NetworkEdgeSecurityServicesRestTransport, + "rest", + ), + ], +) +def test_network_edge_security_services_client_client_options_scopes( + client_class, transport_class, transport_name +): + # Check the case scopes are provided. + options = client_options.ClientOptions( + scopes=["1", "2"], + ) + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=["1", "2"], + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name,grpc_helpers", + [ + ( + NetworkEdgeSecurityServicesClient, + transports.NetworkEdgeSecurityServicesRestTransport, + "rest", + None, + ), + ], +) +def test_network_edge_security_services_client_client_options_credentials_file( + client_class, transport_class, transport_name, grpc_helpers +): + # Check the case credentials file is provided. + options = client_options.ClientOptions(credentials_file="credentials.json") + + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.AggregatedListNetworkEdgeSecurityServicesRequest, + dict, + ], +) +def test_aggregated_list_rest(request_type): + client = NetworkEdgeSecurityServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1"} + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.NetworkEdgeSecurityServiceAggregatedList( + etag="etag_value", + id="id_value", + kind="kind_value", + next_page_token="next_page_token_value", + self_link="self_link_value", + unreachables=["unreachables_value"], + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.NetworkEdgeSecurityServiceAggregatedList.to_json( + return_value + ) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.aggregated_list(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.AggregatedListPager) + assert response.etag == "etag_value" + assert response.id == "id_value" + assert response.kind == "kind_value" + assert response.next_page_token == "next_page_token_value" + assert response.self_link == "self_link_value" + assert response.unreachables == ["unreachables_value"] + + +def test_aggregated_list_rest_required_fields( + request_type=compute.AggregatedListNetworkEdgeSecurityServicesRequest, +): + transport_class = transports.NetworkEdgeSecurityServicesRestTransport + + request_init = {} + request_init["project"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).aggregated_list._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["project"] = "project_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).aggregated_list._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set( + ( + "filter", + "include_all_scopes", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) + ) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + + client = NetworkEdgeSecurityServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.NetworkEdgeSecurityServiceAggregatedList() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "get", + "query_params": request_init, + } + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = ( + compute.NetworkEdgeSecurityServiceAggregatedList.to_json(return_value) + ) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.aggregated_list(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_aggregated_list_rest_unset_required_fields(): + transport = transports.NetworkEdgeSecurityServicesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.aggregated_list._get_unset_required_fields({}) + assert set(unset_fields) == ( + set( + ( + "filter", + "includeAllScopes", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set(("project",)) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_aggregated_list_rest_interceptors(null_interceptor): + transport = transports.NetworkEdgeSecurityServicesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.NetworkEdgeSecurityServicesRestInterceptor(), + ) + client = NetworkEdgeSecurityServicesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.NetworkEdgeSecurityServicesRestInterceptor, "post_aggregated_list" + ) as post, mock.patch.object( + transports.NetworkEdgeSecurityServicesRestInterceptor, "pre_aggregated_list" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = ( + compute.NetworkEdgeSecurityServiceAggregatedList.to_json( + compute.NetworkEdgeSecurityServiceAggregatedList() + ) + ) + + request = compute.AggregatedListNetworkEdgeSecurityServicesRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.NetworkEdgeSecurityServiceAggregatedList + + client.aggregated_list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_aggregated_list_rest_bad_request( + transport: str = "rest", + request_type=compute.AggregatedListNetworkEdgeSecurityServicesRequest, +): + client = NetworkEdgeSecurityServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1"} + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.aggregated_list(request) + + +def test_aggregated_list_rest_flattened(): + client = NetworkEdgeSecurityServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.NetworkEdgeSecurityServiceAggregatedList() + + # get arguments that satisfy an http rule for this method + sample_request = {"project": "sample1"} + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.NetworkEdgeSecurityServiceAggregatedList.to_json( + return_value + ) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.aggregated_list(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/aggregated/networkEdgeSecurityServices" + % client.transport._host, + args[1], + ) + + +def test_aggregated_list_rest_flattened_error(transport: str = "rest"): + client = NetworkEdgeSecurityServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.aggregated_list( + compute.AggregatedListNetworkEdgeSecurityServicesRequest(), + project="project_value", + ) + + +def test_aggregated_list_rest_pager(transport: str = "rest"): + client = NetworkEdgeSecurityServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # TODO(kbandes): remove this mock unless there's a good reason for it. + # with mock.patch.object(path_template, 'transcode') as transcode: + # Set the response as a series of pages + response = ( + compute.NetworkEdgeSecurityServiceAggregatedList( + items={ + "a": compute.NetworkEdgeSecurityServicesScopedList(), + "b": compute.NetworkEdgeSecurityServicesScopedList(), + "c": compute.NetworkEdgeSecurityServicesScopedList(), + }, + next_page_token="abc", + ), + compute.NetworkEdgeSecurityServiceAggregatedList( + items={}, + next_page_token="def", + ), + compute.NetworkEdgeSecurityServiceAggregatedList( + items={ + "g": compute.NetworkEdgeSecurityServicesScopedList(), + }, + next_page_token="ghi", + ), + compute.NetworkEdgeSecurityServiceAggregatedList( + items={ + "h": compute.NetworkEdgeSecurityServicesScopedList(), + "i": compute.NetworkEdgeSecurityServicesScopedList(), + }, + ), + ) + # Two responses for two calls + response = response + response + + # Wrap the values into proper Response objs + response = tuple( + compute.NetworkEdgeSecurityServiceAggregatedList.to_json(x) + for x in response + ) + return_values = tuple(Response() for i in response) + for return_val, response_val in zip(return_values, response): + return_val._content = response_val.encode("UTF-8") + return_val.status_code = 200 + req.side_effect = return_values + + sample_request = {"project": "sample1"} + + pager = client.aggregated_list(request=sample_request) + + assert isinstance(pager.get("a"), compute.NetworkEdgeSecurityServicesScopedList) + assert pager.get("h") is None + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, tuple) for i in results) + for result in results: + assert isinstance(result, tuple) + assert tuple(type(t) for t in result) == ( + str, + compute.NetworkEdgeSecurityServicesScopedList, + ) + + assert pager.get("a") is None + assert isinstance(pager.get("h"), compute.NetworkEdgeSecurityServicesScopedList) + + pages = list(client.aggregated_list(request=sample_request).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteNetworkEdgeSecurityServiceRequest, + dict, + ], +) +def test_delete_unary_rest(request_type): + client = NetworkEdgeSecurityServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = { + "project": "sample1", + "region": "sample2", + "network_edge_security_service": "sample3", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation( + client_operation_id="client_operation_id_value", + creation_timestamp="creation_timestamp_value", + description="description_value", + end_time="end_time_value", + http_error_message="http_error_message_value", + http_error_status_code=2374, + id=205, + insert_time="insert_time_value", + kind="kind_value", + name="name_value", + operation_group_id="operation_group_id_value", + operation_type="operation_type_value", + progress=885, + region="region_value", + self_link="self_link_value", + start_time="start_time_value", + status=compute.Operation.Status.DONE, + status_message="status_message_value", + target_id=947, + target_link="target_link_value", + user="user_value", + zone="zone_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.delete_unary(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.Operation) + assert response.client_operation_id == "client_operation_id_value" + assert response.creation_timestamp == "creation_timestamp_value" + assert response.description == "description_value" + assert response.end_time == "end_time_value" + assert response.http_error_message == "http_error_message_value" + assert response.http_error_status_code == 2374 + assert response.id == 205 + assert response.insert_time == "insert_time_value" + assert response.kind == "kind_value" + assert response.name == "name_value" + assert response.operation_group_id == "operation_group_id_value" + assert response.operation_type == "operation_type_value" + assert response.progress == 885 + assert response.region == "region_value" + assert response.self_link == "self_link_value" + assert response.start_time == "start_time_value" + assert response.status == compute.Operation.Status.DONE + assert response.status_message == "status_message_value" + assert response.target_id == 947 + assert response.target_link == "target_link_value" + assert response.user == "user_value" + assert response.zone == "zone_value" + + +def test_delete_unary_rest_required_fields( + request_type=compute.DeleteNetworkEdgeSecurityServiceRequest, +): + transport_class = transports.NetworkEdgeSecurityServicesRestTransport + + request_init = {} + request_init["network_edge_security_service"] = "" + request_init["project"] = "" + request_init["region"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).delete._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request[ + "networkEdgeSecurityService" + ] = "network_edge_security_service_value" + jsonified_request["project"] = "project_value" + jsonified_request["region"] = "region_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).delete._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set(("request_id",)) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "networkEdgeSecurityService" in jsonified_request + assert ( + jsonified_request["networkEdgeSecurityService"] + == "network_edge_security_service_value" + ) + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + assert "region" in jsonified_request + assert jsonified_request["region"] == "region_value" + + client = NetworkEdgeSecurityServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "delete", + "query_params": request_init, + } + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.delete_unary(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_delete_unary_rest_unset_required_fields(): + transport = transports.NetworkEdgeSecurityServicesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.delete._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(("requestId",)) + & set( + ( + "networkEdgeSecurityService", + "project", + "region", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_delete_unary_rest_interceptors(null_interceptor): + transport = transports.NetworkEdgeSecurityServicesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.NetworkEdgeSecurityServicesRestInterceptor(), + ) + client = NetworkEdgeSecurityServicesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.NetworkEdgeSecurityServicesRestInterceptor, "post_delete" + ) as post, mock.patch.object( + transports.NetworkEdgeSecurityServicesRestInterceptor, "pre_delete" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.Operation.to_json(compute.Operation()) + + request = compute.DeleteNetworkEdgeSecurityServiceRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.Operation + + client.delete_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_delete_unary_rest_bad_request( + transport: str = "rest", + request_type=compute.DeleteNetworkEdgeSecurityServiceRequest, +): + client = NetworkEdgeSecurityServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = { + "project": "sample1", + "region": "sample2", + "network_edge_security_service": "sample3", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.delete_unary(request) + + +def test_delete_unary_rest_flattened(): + client = NetworkEdgeSecurityServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = { + "project": "sample1", + "region": "sample2", + "network_edge_security_service": "sample3", + } + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + region="region_value", + network_edge_security_service="network_edge_security_service_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.delete_unary(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/regions/{region}/networkEdgeSecurityServices/{network_edge_security_service}" + % client.transport._host, + args[1], + ) + + +def test_delete_unary_rest_flattened_error(transport: str = "rest"): + client = NetworkEdgeSecurityServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.delete_unary( + compute.DeleteNetworkEdgeSecurityServiceRequest(), + project="project_value", + region="region_value", + network_edge_security_service="network_edge_security_service_value", + ) + + +def test_delete_unary_rest_error(): + client = NetworkEdgeSecurityServicesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.GetNetworkEdgeSecurityServiceRequest, + dict, + ], +) +def test_get_rest(request_type): + client = NetworkEdgeSecurityServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = { + "project": "sample1", + "region": "sample2", + "network_edge_security_service": "sample3", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.NetworkEdgeSecurityService( + creation_timestamp="creation_timestamp_value", + description="description_value", + fingerprint="fingerprint_value", + id=205, + kind="kind_value", + name="name_value", + region="region_value", + security_policy="security_policy_value", + self_link="self_link_value", + self_link_with_id="self_link_with_id_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.NetworkEdgeSecurityService.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.get(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.NetworkEdgeSecurityService) + assert response.creation_timestamp == "creation_timestamp_value" + assert response.description == "description_value" + assert response.fingerprint == "fingerprint_value" + assert response.id == 205 + assert response.kind == "kind_value" + assert response.name == "name_value" + assert response.region == "region_value" + assert response.security_policy == "security_policy_value" + assert response.self_link == "self_link_value" + assert response.self_link_with_id == "self_link_with_id_value" + + +def test_get_rest_required_fields( + request_type=compute.GetNetworkEdgeSecurityServiceRequest, +): + transport_class = transports.NetworkEdgeSecurityServicesRestTransport + + request_init = {} + request_init["network_edge_security_service"] = "" + request_init["project"] = "" + request_init["region"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).get._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request[ + "networkEdgeSecurityService" + ] = "network_edge_security_service_value" + jsonified_request["project"] = "project_value" + jsonified_request["region"] = "region_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).get._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "networkEdgeSecurityService" in jsonified_request + assert ( + jsonified_request["networkEdgeSecurityService"] + == "network_edge_security_service_value" + ) + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + assert "region" in jsonified_request + assert jsonified_request["region"] == "region_value" + + client = NetworkEdgeSecurityServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.NetworkEdgeSecurityService() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "get", + "query_params": request_init, + } + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.NetworkEdgeSecurityService.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.get(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_get_rest_unset_required_fields(): + transport = transports.NetworkEdgeSecurityServicesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.get._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(()) + & set( + ( + "networkEdgeSecurityService", + "project", + "region", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_get_rest_interceptors(null_interceptor): + transport = transports.NetworkEdgeSecurityServicesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.NetworkEdgeSecurityServicesRestInterceptor(), + ) + client = NetworkEdgeSecurityServicesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.NetworkEdgeSecurityServicesRestInterceptor, "post_get" + ) as post, mock.patch.object( + transports.NetworkEdgeSecurityServicesRestInterceptor, "pre_get" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.NetworkEdgeSecurityService.to_json( + compute.NetworkEdgeSecurityService() + ) + + request = compute.GetNetworkEdgeSecurityServiceRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.NetworkEdgeSecurityService + + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_get_rest_bad_request( + transport: str = "rest", request_type=compute.GetNetworkEdgeSecurityServiceRequest +): + client = NetworkEdgeSecurityServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = { + "project": "sample1", + "region": "sample2", + "network_edge_security_service": "sample3", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.get(request) + + +def test_get_rest_flattened(): + client = NetworkEdgeSecurityServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.NetworkEdgeSecurityService() + + # get arguments that satisfy an http rule for this method + sample_request = { + "project": "sample1", + "region": "sample2", + "network_edge_security_service": "sample3", + } + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + region="region_value", + network_edge_security_service="network_edge_security_service_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.NetworkEdgeSecurityService.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.get(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/regions/{region}/networkEdgeSecurityServices/{network_edge_security_service}" + % client.transport._host, + args[1], + ) + + +def test_get_rest_flattened_error(transport: str = "rest"): + client = NetworkEdgeSecurityServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get( + compute.GetNetworkEdgeSecurityServiceRequest(), + project="project_value", + region="region_value", + network_edge_security_service="network_edge_security_service_value", + ) + + +def test_get_rest_error(): + client = NetworkEdgeSecurityServicesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertNetworkEdgeSecurityServiceRequest, + dict, + ], +) +def test_insert_unary_rest(request_type): + client = NetworkEdgeSecurityServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "region": "sample2"} + request_init["network_edge_security_service_resource"] = { + "creation_timestamp": "creation_timestamp_value", + "description": "description_value", + "fingerprint": "fingerprint_value", + "id": 205, + "kind": "kind_value", + "name": "name_value", + "region": "region_value", + "security_policy": "security_policy_value", + "self_link": "self_link_value", + "self_link_with_id": "self_link_with_id_value", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation( + client_operation_id="client_operation_id_value", + creation_timestamp="creation_timestamp_value", + description="description_value", + end_time="end_time_value", + http_error_message="http_error_message_value", + http_error_status_code=2374, + id=205, + insert_time="insert_time_value", + kind="kind_value", + name="name_value", + operation_group_id="operation_group_id_value", + operation_type="operation_type_value", + progress=885, + region="region_value", + self_link="self_link_value", + start_time="start_time_value", + status=compute.Operation.Status.DONE, + status_message="status_message_value", + target_id=947, + target_link="target_link_value", + user="user_value", + zone="zone_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.insert_unary(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.Operation) + assert response.client_operation_id == "client_operation_id_value" + assert response.creation_timestamp == "creation_timestamp_value" + assert response.description == "description_value" + assert response.end_time == "end_time_value" + assert response.http_error_message == "http_error_message_value" + assert response.http_error_status_code == 2374 + assert response.id == 205 + assert response.insert_time == "insert_time_value" + assert response.kind == "kind_value" + assert response.name == "name_value" + assert response.operation_group_id == "operation_group_id_value" + assert response.operation_type == "operation_type_value" + assert response.progress == 885 + assert response.region == "region_value" + assert response.self_link == "self_link_value" + assert response.start_time == "start_time_value" + assert response.status == compute.Operation.Status.DONE + assert response.status_message == "status_message_value" + assert response.target_id == 947 + assert response.target_link == "target_link_value" + assert response.user == "user_value" + assert response.zone == "zone_value" + + +def test_insert_unary_rest_required_fields( + request_type=compute.InsertNetworkEdgeSecurityServiceRequest, +): + transport_class = transports.NetworkEdgeSecurityServicesRestTransport + + request_init = {} + request_init["project"] = "" + request_init["region"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).insert._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["project"] = "project_value" + jsonified_request["region"] = "region_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).insert._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set( + ( + "request_id", + "validate_only", + ) + ) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + assert "region" in jsonified_request + assert jsonified_request["region"] == "region_value" + + client = NetworkEdgeSecurityServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "post", + "query_params": request_init, + } + transcode_result["body"] = {} + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.insert_unary(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_insert_unary_rest_unset_required_fields(): + transport = transports.NetworkEdgeSecurityServicesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.insert._get_unset_required_fields({}) + assert set(unset_fields) == ( + set( + ( + "requestId", + "validateOnly", + ) + ) + & set( + ( + "networkEdgeSecurityServiceResource", + "project", + "region", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_insert_unary_rest_interceptors(null_interceptor): + transport = transports.NetworkEdgeSecurityServicesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.NetworkEdgeSecurityServicesRestInterceptor(), + ) + client = NetworkEdgeSecurityServicesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.NetworkEdgeSecurityServicesRestInterceptor, "post_insert" + ) as post, mock.patch.object( + transports.NetworkEdgeSecurityServicesRestInterceptor, "pre_insert" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.Operation.to_json(compute.Operation()) + + request = compute.InsertNetworkEdgeSecurityServiceRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.Operation + + client.insert_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_insert_unary_rest_bad_request( + transport: str = "rest", + request_type=compute.InsertNetworkEdgeSecurityServiceRequest, +): + client = NetworkEdgeSecurityServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "region": "sample2"} + request_init["network_edge_security_service_resource"] = { + "creation_timestamp": "creation_timestamp_value", + "description": "description_value", + "fingerprint": "fingerprint_value", + "id": 205, + "kind": "kind_value", + "name": "name_value", + "region": "region_value", + "security_policy": "security_policy_value", + "self_link": "self_link_value", + "self_link_with_id": "self_link_with_id_value", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.insert_unary(request) + + +def test_insert_unary_rest_flattened(): + client = NetworkEdgeSecurityServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = {"project": "sample1", "region": "sample2"} + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + region="region_value", + network_edge_security_service_resource=compute.NetworkEdgeSecurityService( + creation_timestamp="creation_timestamp_value" + ), + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.insert_unary(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/regions/{region}/networkEdgeSecurityServices" + % client.transport._host, + args[1], + ) + + +def test_insert_unary_rest_flattened_error(transport: str = "rest"): + client = NetworkEdgeSecurityServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.insert_unary( + compute.InsertNetworkEdgeSecurityServiceRequest(), + project="project_value", + region="region_value", + network_edge_security_service_resource=compute.NetworkEdgeSecurityService( + creation_timestamp="creation_timestamp_value" + ), + ) + + +def test_insert_unary_rest_error(): + client = NetworkEdgeSecurityServicesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.PatchNetworkEdgeSecurityServiceRequest, + dict, + ], +) +def test_patch_unary_rest(request_type): + client = NetworkEdgeSecurityServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = { + "project": "sample1", + "region": "sample2", + "network_edge_security_service": "sample3", + } + request_init["network_edge_security_service_resource"] = { + "creation_timestamp": "creation_timestamp_value", + "description": "description_value", + "fingerprint": "fingerprint_value", + "id": 205, + "kind": "kind_value", + "name": "name_value", + "region": "region_value", + "security_policy": "security_policy_value", + "self_link": "self_link_value", + "self_link_with_id": "self_link_with_id_value", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation( + client_operation_id="client_operation_id_value", + creation_timestamp="creation_timestamp_value", + description="description_value", + end_time="end_time_value", + http_error_message="http_error_message_value", + http_error_status_code=2374, + id=205, + insert_time="insert_time_value", + kind="kind_value", + name="name_value", + operation_group_id="operation_group_id_value", + operation_type="operation_type_value", + progress=885, + region="region_value", + self_link="self_link_value", + start_time="start_time_value", + status=compute.Operation.Status.DONE, + status_message="status_message_value", + target_id=947, + target_link="target_link_value", + user="user_value", + zone="zone_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.patch_unary(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.Operation) + assert response.client_operation_id == "client_operation_id_value" + assert response.creation_timestamp == "creation_timestamp_value" + assert response.description == "description_value" + assert response.end_time == "end_time_value" + assert response.http_error_message == "http_error_message_value" + assert response.http_error_status_code == 2374 + assert response.id == 205 + assert response.insert_time == "insert_time_value" + assert response.kind == "kind_value" + assert response.name == "name_value" + assert response.operation_group_id == "operation_group_id_value" + assert response.operation_type == "operation_type_value" + assert response.progress == 885 + assert response.region == "region_value" + assert response.self_link == "self_link_value" + assert response.start_time == "start_time_value" + assert response.status == compute.Operation.Status.DONE + assert response.status_message == "status_message_value" + assert response.target_id == 947 + assert response.target_link == "target_link_value" + assert response.user == "user_value" + assert response.zone == "zone_value" + + +def test_patch_unary_rest_required_fields( + request_type=compute.PatchNetworkEdgeSecurityServiceRequest, +): + transport_class = transports.NetworkEdgeSecurityServicesRestTransport + + request_init = {} + request_init["network_edge_security_service"] = "" + request_init["project"] = "" + request_init["region"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).patch._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request[ + "networkEdgeSecurityService" + ] = "network_edge_security_service_value" + jsonified_request["project"] = "project_value" + jsonified_request["region"] = "region_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).patch._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set( + ( + "paths", + "request_id", + "update_mask", + ) + ) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "networkEdgeSecurityService" in jsonified_request + assert ( + jsonified_request["networkEdgeSecurityService"] + == "network_edge_security_service_value" + ) + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + assert "region" in jsonified_request + assert jsonified_request["region"] == "region_value" + + client = NetworkEdgeSecurityServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "patch", + "query_params": request_init, + } + transcode_result["body"] = {} + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.patch_unary(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_patch_unary_rest_unset_required_fields(): + transport = transports.NetworkEdgeSecurityServicesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.patch._get_unset_required_fields({}) + assert set(unset_fields) == ( + set( + ( + "paths", + "requestId", + "updateMask", + ) + ) + & set( + ( + "networkEdgeSecurityService", + "networkEdgeSecurityServiceResource", + "project", + "region", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_patch_unary_rest_interceptors(null_interceptor): + transport = transports.NetworkEdgeSecurityServicesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.NetworkEdgeSecurityServicesRestInterceptor(), + ) + client = NetworkEdgeSecurityServicesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.NetworkEdgeSecurityServicesRestInterceptor, "post_patch" + ) as post, mock.patch.object( + transports.NetworkEdgeSecurityServicesRestInterceptor, "pre_patch" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.Operation.to_json(compute.Operation()) + + request = compute.PatchNetworkEdgeSecurityServiceRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.Operation + + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_patch_unary_rest_bad_request( + transport: str = "rest", request_type=compute.PatchNetworkEdgeSecurityServiceRequest +): + client = NetworkEdgeSecurityServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = { + "project": "sample1", + "region": "sample2", + "network_edge_security_service": "sample3", + } + request_init["network_edge_security_service_resource"] = { + "creation_timestamp": "creation_timestamp_value", + "description": "description_value", + "fingerprint": "fingerprint_value", + "id": 205, + "kind": "kind_value", + "name": "name_value", + "region": "region_value", + "security_policy": "security_policy_value", + "self_link": "self_link_value", + "self_link_with_id": "self_link_with_id_value", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.patch_unary(request) + + +def test_patch_unary_rest_flattened(): + client = NetworkEdgeSecurityServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = { + "project": "sample1", + "region": "sample2", + "network_edge_security_service": "sample3", + } + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + region="region_value", + network_edge_security_service="network_edge_security_service_value", + network_edge_security_service_resource=compute.NetworkEdgeSecurityService( + creation_timestamp="creation_timestamp_value" + ), + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.patch_unary(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/regions/{region}/networkEdgeSecurityServices/{network_edge_security_service}" + % client.transport._host, + args[1], + ) + + +def test_patch_unary_rest_flattened_error(transport: str = "rest"): + client = NetworkEdgeSecurityServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.patch_unary( + compute.PatchNetworkEdgeSecurityServiceRequest(), + project="project_value", + region="region_value", + network_edge_security_service="network_edge_security_service_value", + network_edge_security_service_resource=compute.NetworkEdgeSecurityService( + creation_timestamp="creation_timestamp_value" + ), + ) + + +def test_patch_unary_rest_error(): + client = NetworkEdgeSecurityServicesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +def test_credentials_transport_error(): + # It is an error to provide credentials and a transport instance. + transport = transports.NetworkEdgeSecurityServicesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = NetworkEdgeSecurityServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # It is an error to provide a credentials file and a transport instance. + transport = transports.NetworkEdgeSecurityServicesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = NetworkEdgeSecurityServicesClient( + client_options={"credentials_file": "credentials.json"}, + transport=transport, + ) + + # It is an error to provide an api_key and a transport instance. + transport = transports.NetworkEdgeSecurityServicesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + options = client_options.ClientOptions() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = NetworkEdgeSecurityServicesClient( + client_options=options, + transport=transport, + ) + + # It is an error to provide an api_key and a credential. + options = mock.Mock() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = NetworkEdgeSecurityServicesClient( + client_options=options, credentials=ga_credentials.AnonymousCredentials() + ) + + # It is an error to provide scopes and a transport instance. + transport = transports.NetworkEdgeSecurityServicesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = NetworkEdgeSecurityServicesClient( + client_options={"scopes": ["1", "2"]}, + transport=transport, + ) + + +def test_transport_instance(): + # A client may be instantiated with a custom transport instance. + transport = transports.NetworkEdgeSecurityServicesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + client = NetworkEdgeSecurityServicesClient(transport=transport) + assert client.transport is transport + + +@pytest.mark.parametrize( + "transport_class", + [ + transports.NetworkEdgeSecurityServicesRestTransport, + ], +) +def test_transport_adc(transport_class): + # Test default credentials are used if not provided. + with mock.patch.object(google.auth, "default") as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + transport_class() + adc.assert_called_once() + + +def test_network_edge_security_services_base_transport_error(): + # Passing both a credentials object and credentials_file should raise an error + with pytest.raises(core_exceptions.DuplicateCredentialArgs): + transport = transports.NetworkEdgeSecurityServicesTransport( + credentials=ga_credentials.AnonymousCredentials(), + credentials_file="credentials.json", + ) + + +def test_network_edge_security_services_base_transport(): + # Instantiate the base transport. + with mock.patch( + "google.cloud.compute_v1.services.network_edge_security_services.transports.NetworkEdgeSecurityServicesTransport.__init__" + ) as Transport: + Transport.return_value = None + transport = transports.NetworkEdgeSecurityServicesTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Every method on the transport should just blindly + # raise NotImplementedError. + methods = ( + "aggregated_list", + "delete", + "get", + "insert", + "patch", + ) + for method in methods: + with pytest.raises(NotImplementedError): + getattr(transport, method)(request=object()) + + with pytest.raises(NotImplementedError): + transport.close() + + +def test_network_edge_security_services_base_transport_with_credentials_file(): + # Instantiate the base transport with a credentials file + with mock.patch.object( + google.auth, "load_credentials_from_file", autospec=True + ) as load_creds, mock.patch( + "google.cloud.compute_v1.services.network_edge_security_services.transports.NetworkEdgeSecurityServicesTransport._prep_wrapped_messages" + ) as Transport: + Transport.return_value = None + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) + transport = transports.NetworkEdgeSecurityServicesTransport( + credentials_file="credentials.json", + quota_project_id="octopus", + ) + load_creds.assert_called_once_with( + "credentials.json", + scopes=None, + default_scopes=( + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/cloud-platform", + ), + quota_project_id="octopus", + ) + + +def test_network_edge_security_services_base_transport_with_adc(): + # Test the default credentials are used if credentials and credentials_file are None. + with mock.patch.object(google.auth, "default", autospec=True) as adc, mock.patch( + "google.cloud.compute_v1.services.network_edge_security_services.transports.NetworkEdgeSecurityServicesTransport._prep_wrapped_messages" + ) as Transport: + Transport.return_value = None + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + transport = transports.NetworkEdgeSecurityServicesTransport() + adc.assert_called_once() + + +def test_network_edge_security_services_auth_adc(): + # If no credentials are provided, we should use ADC credentials. + with mock.patch.object(google.auth, "default", autospec=True) as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + NetworkEdgeSecurityServicesClient() + adc.assert_called_once_with( + scopes=None, + default_scopes=( + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/cloud-platform", + ), + quota_project_id=None, + ) + + +def test_network_edge_security_services_http_transport_client_cert_source_for_mtls(): + cred = ga_credentials.AnonymousCredentials() + with mock.patch( + "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" + ) as mock_configure_mtls_channel: + transports.NetworkEdgeSecurityServicesRestTransport( + credentials=cred, client_cert_source_for_mtls=client_cert_source_callback + ) + mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) + + +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) +def test_network_edge_security_services_host_no_port(transport_name): + client = NetworkEdgeSecurityServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions( + api_endpoint="compute.googleapis.com" + ), + transport=transport_name, + ) + assert client.transport._host == ( + "compute.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://compute.googleapis.com" + ) + + +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) +def test_network_edge_security_services_host_with_port(transport_name): + client = NetworkEdgeSecurityServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions( + api_endpoint="compute.googleapis.com:8000" + ), + transport=transport_name, + ) + assert client.transport._host == ( + "compute.googleapis.com:8000" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://compute.googleapis.com:8000" + ) + + +def test_common_billing_account_path(): + billing_account = "squid" + expected = "billingAccounts/{billing_account}".format( + billing_account=billing_account, + ) + actual = NetworkEdgeSecurityServicesClient.common_billing_account_path( + billing_account + ) + assert expected == actual + + +def test_parse_common_billing_account_path(): + expected = { + "billing_account": "clam", + } + path = NetworkEdgeSecurityServicesClient.common_billing_account_path(**expected) + + # Check that the path construction is reversible. + actual = NetworkEdgeSecurityServicesClient.parse_common_billing_account_path(path) + assert expected == actual + + +def test_common_folder_path(): + folder = "whelk" + expected = "folders/{folder}".format( + folder=folder, + ) + actual = NetworkEdgeSecurityServicesClient.common_folder_path(folder) + assert expected == actual + + +def test_parse_common_folder_path(): + expected = { + "folder": "octopus", + } + path = NetworkEdgeSecurityServicesClient.common_folder_path(**expected) + + # Check that the path construction is reversible. + actual = NetworkEdgeSecurityServicesClient.parse_common_folder_path(path) + assert expected == actual + + +def test_common_organization_path(): + organization = "oyster" + expected = "organizations/{organization}".format( + organization=organization, + ) + actual = NetworkEdgeSecurityServicesClient.common_organization_path(organization) + assert expected == actual + + +def test_parse_common_organization_path(): + expected = { + "organization": "nudibranch", + } + path = NetworkEdgeSecurityServicesClient.common_organization_path(**expected) + + # Check that the path construction is reversible. + actual = NetworkEdgeSecurityServicesClient.parse_common_organization_path(path) + assert expected == actual + + +def test_common_project_path(): + project = "cuttlefish" + expected = "projects/{project}".format( + project=project, + ) + actual = NetworkEdgeSecurityServicesClient.common_project_path(project) + assert expected == actual + + +def test_parse_common_project_path(): + expected = { + "project": "mussel", + } + path = NetworkEdgeSecurityServicesClient.common_project_path(**expected) + + # Check that the path construction is reversible. + actual = NetworkEdgeSecurityServicesClient.parse_common_project_path(path) + assert expected == actual + + +def test_common_location_path(): + project = "winkle" + location = "nautilus" + expected = "projects/{project}/locations/{location}".format( + project=project, + location=location, + ) + actual = NetworkEdgeSecurityServicesClient.common_location_path(project, location) + assert expected == actual + + +def test_parse_common_location_path(): + expected = { + "project": "scallop", + "location": "abalone", + } + path = NetworkEdgeSecurityServicesClient.common_location_path(**expected) + + # Check that the path construction is reversible. + actual = NetworkEdgeSecurityServicesClient.parse_common_location_path(path) + assert expected == actual + + +def test_client_with_default_client_info(): + client_info = gapic_v1.client_info.ClientInfo() + + with mock.patch.object( + transports.NetworkEdgeSecurityServicesTransport, "_prep_wrapped_messages" + ) as prep: + client = NetworkEdgeSecurityServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, + ) + prep.assert_called_once_with(client_info) + + with mock.patch.object( + transports.NetworkEdgeSecurityServicesTransport, "_prep_wrapped_messages" + ) as prep: + transport_class = NetworkEdgeSecurityServicesClient.get_transport_class() + transport = transport_class( + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, + ) + prep.assert_called_once_with(client_info) + + +def test_transport_close(): + transports = { + "rest": "_session", + } + + for transport, close_name in transports.items(): + client = NetworkEdgeSecurityServicesClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport + ) + with mock.patch.object( + type(getattr(client.transport, close_name)), "close" + ) as close: + with client: + close.assert_not_called() + close.assert_called_once() + + +def test_client_ctx(): + transports = [ + "rest", + ] + for transport in transports: + client = NetworkEdgeSecurityServicesClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport + ) + # Test client calls underlying transport. + with mock.patch.object(type(client.transport), "close") as close: + close.assert_not_called() + with client: + pass + close.assert_called() + + +@pytest.mark.parametrize( + "client_class,transport_class", + [ + ( + NetworkEdgeSecurityServicesClient, + transports.NetworkEdgeSecurityServicesRestTransport, + ), + ], +) +def test_api_key_credentials(client_class, transport_class): + with mock.patch.object( + google.auth._default, "get_api_key_credentials", create=True + ) as get_api_key_credentials: + mock_cred = mock.Mock() + get_api_key_credentials.return_value = mock_cred + options = client_options.ClientOptions() + options.api_key = "api_key" + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=mock_cred, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) diff --git a/tests/unit/gapic/compute_v1/test_network_endpoint_groups.py b/tests/unit/gapic/compute_v1/test_network_endpoint_groups.py index a2ecf9f83..9b612f6b1 100644 --- a/tests/unit/gapic/compute_v1/test_network_endpoint_groups.py +++ b/tests/unit/gapic/compute_v1/test_network_endpoint_groups.py @@ -111,9 +111,9 @@ def test_network_endpoint_groups_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -168,9 +168,9 @@ def test_network_endpoint_groups_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_network_firewall_policies.py b/tests/unit/gapic/compute_v1/test_network_firewall_policies.py new file mode 100644 index 000000000..6a9c1150d --- /dev/null +++ b/tests/unit/gapic/compute_v1/test_network_firewall_policies.py @@ -0,0 +1,6465 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +import os +import mock + +import grpc +from grpc.experimental import aio +from collections.abc import Iterable +import json +import math +import pytest +from proto.marshal.rules.dates import DurationRule, TimestampRule + +from requests import Response +from requests import Request, PreparedRequest +from requests.sessions import Session + +from google.api_core import client_options +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers +from google.api_core import grpc_helpers_async +from google.api_core import path_template +from google.auth import credentials as ga_credentials +from google.auth.exceptions import MutualTLSChannelError +from google.cloud.compute_v1.services.network_firewall_policies import ( + NetworkFirewallPoliciesClient, +) +from google.cloud.compute_v1.services.network_firewall_policies import pagers +from google.cloud.compute_v1.services.network_firewall_policies import transports +from google.cloud.compute_v1.types import compute +from google.oauth2 import service_account +import google.auth + + +def client_cert_source_callback(): + return b"cert bytes", b"key bytes" + + +# If default endpoint is localhost, then default mtls endpoint will be the same. +# This method modifies the default endpoint so the client can produce a different +# mtls endpoint for endpoint testing purposes. +def modify_default_endpoint(client): + return ( + "foo.googleapis.com" + if ("localhost" in client.DEFAULT_ENDPOINT) + else client.DEFAULT_ENDPOINT + ) + + +def test__get_default_mtls_endpoint(): + api_endpoint = "example.googleapis.com" + api_mtls_endpoint = "example.mtls.googleapis.com" + sandbox_endpoint = "example.sandbox.googleapis.com" + sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" + non_googleapi = "api.example.com" + + assert NetworkFirewallPoliciesClient._get_default_mtls_endpoint(None) is None + assert ( + NetworkFirewallPoliciesClient._get_default_mtls_endpoint(api_endpoint) + == api_mtls_endpoint + ) + assert ( + NetworkFirewallPoliciesClient._get_default_mtls_endpoint(api_mtls_endpoint) + == api_mtls_endpoint + ) + assert ( + NetworkFirewallPoliciesClient._get_default_mtls_endpoint(sandbox_endpoint) + == sandbox_mtls_endpoint + ) + assert ( + NetworkFirewallPoliciesClient._get_default_mtls_endpoint(sandbox_mtls_endpoint) + == sandbox_mtls_endpoint + ) + assert ( + NetworkFirewallPoliciesClient._get_default_mtls_endpoint(non_googleapi) + == non_googleapi + ) + + +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (NetworkFirewallPoliciesClient, "rest"), + ], +) +def test_network_firewall_policies_client_from_service_account_info( + client_class, transport_name +): + creds = ga_credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = client_class.from_service_account_info(info, transport=transport_name) + assert client.transport._credentials == creds + assert isinstance(client, client_class) + + assert client.transport._host == ( + "compute.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://compute.googleapis.com" + ) + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [ + (transports.NetworkFirewallPoliciesRestTransport, "rest"), + ], +) +def test_network_firewall_policies_client_service_account_always_use_jwt( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) + + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (NetworkFirewallPoliciesClient, "rest"), + ], +) +def test_network_firewall_policies_client_from_service_account_file( + client_class, transport_name +): + creds = ga_credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_file" + ) as factory: + factory.return_value = creds + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) + assert client.transport._credentials == creds + assert isinstance(client, client_class) + + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) + assert client.transport._credentials == creds + assert isinstance(client, client_class) + + assert client.transport._host == ( + "compute.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://compute.googleapis.com" + ) + + +def test_network_firewall_policies_client_get_transport_class(): + transport = NetworkFirewallPoliciesClient.get_transport_class() + available_transports = [ + transports.NetworkFirewallPoliciesRestTransport, + ] + assert transport in available_transports + + transport = NetworkFirewallPoliciesClient.get_transport_class("rest") + assert transport == transports.NetworkFirewallPoliciesRestTransport + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name", + [ + ( + NetworkFirewallPoliciesClient, + transports.NetworkFirewallPoliciesRestTransport, + "rest", + ), + ], +) +@mock.patch.object( + NetworkFirewallPoliciesClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(NetworkFirewallPoliciesClient), +) +def test_network_firewall_policies_client_client_options( + client_class, transport_class, transport_name +): + # Check that if channel is provided we won't create a new one. + with mock.patch.object(NetworkFirewallPoliciesClient, "get_transport_class") as gtc: + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) + client = client_class(transport=transport) + gtc.assert_not_called() + + # Check that if channel is provided via str we will create a new one. + with mock.patch.object(NetworkFirewallPoliciesClient, "get_transport_class") as gtc: + client = client_class(transport=transport_name) + gtc.assert_called() + + # Check the case api_endpoint is provided. + options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(transport=transport_name, client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host="squid.clam.whelk", + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is + # "never". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is + # "always". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_MTLS_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has + # unsupported value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): + with pytest.raises(MutualTLSChannelError): + client = client_class(transport=transport_name) + + # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"} + ): + with pytest.raises(ValueError): + client = client_class(transport=transport_name) + + # Check the case quota_project_id is provided + options = client_options.ClientOptions(quota_project_id="octopus") + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id="octopus", + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name,use_client_cert_env", + [ + ( + NetworkFirewallPoliciesClient, + transports.NetworkFirewallPoliciesRestTransport, + "rest", + "true", + ), + ( + NetworkFirewallPoliciesClient, + transports.NetworkFirewallPoliciesRestTransport, + "rest", + "false", + ), + ], +) +@mock.patch.object( + NetworkFirewallPoliciesClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(NetworkFirewallPoliciesClient), +) +@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}) +def test_network_firewall_policies_client_mtls_env_auto( + client_class, transport_class, transport_name, use_client_cert_env +): + # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default + # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists. + + # Check the case client_cert_source is provided. Whether client cert is used depends on + # GOOGLE_API_USE_CLIENT_CERTIFICATE value. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + options = client_options.ClientOptions( + client_cert_source=client_cert_source_callback + ) + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + + if use_client_cert_env == "false": + expected_client_cert_source = None + expected_host = client.DEFAULT_ENDPOINT + else: + expected_client_cert_source = client_cert_source_callback + expected_host = client.DEFAULT_MTLS_ENDPOINT + + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + # Check the case ADC client cert is provided. Whether client cert is used depends on + # GOOGLE_API_USE_CLIENT_CERTIFICATE value. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + with mock.patch.object(transport_class, "__init__") as patched: + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, + ): + with mock.patch( + "google.auth.transport.mtls.default_client_cert_source", + return_value=client_cert_source_callback, + ): + if use_client_cert_env == "false": + expected_host = client.DEFAULT_ENDPOINT + expected_client_cert_source = None + else: + expected_host = client.DEFAULT_MTLS_ENDPOINT + expected_client_cert_source = client_cert_source_callback + + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + # Check the case client_cert_source and ADC client cert are not provided. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + with mock.patch.object(transport_class, "__init__") as patched: + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=False, + ): + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + +@pytest.mark.parametrize("client_class", [NetworkFirewallPoliciesClient]) +@mock.patch.object( + NetworkFirewallPoliciesClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(NetworkFirewallPoliciesClient), +) +def test_network_firewall_policies_client_get_mtls_endpoint_and_cert_source( + client_class, +): + mock_client_cert_source = mock.Mock() + + # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "true". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + mock_api_endpoint = "foo" + options = client_options.ClientOptions( + client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint + ) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( + options + ) + assert api_endpoint == mock_api_endpoint + assert cert_source == mock_client_cert_source + + # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "false". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): + mock_client_cert_source = mock.Mock() + mock_api_endpoint = "foo" + options = client_options.ClientOptions( + client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint + ) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( + options + ) + assert api_endpoint == mock_api_endpoint + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "never". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "always". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert doesn't exist. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=False, + ): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert exists. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, + ): + with mock.patch( + "google.auth.transport.mtls.default_client_cert_source", + return_value=mock_client_cert_source, + ): + ( + api_endpoint, + cert_source, + ) = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + assert cert_source == mock_client_cert_source + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name", + [ + ( + NetworkFirewallPoliciesClient, + transports.NetworkFirewallPoliciesRestTransport, + "rest", + ), + ], +) +def test_network_firewall_policies_client_client_options_scopes( + client_class, transport_class, transport_name +): + # Check the case scopes are provided. + options = client_options.ClientOptions( + scopes=["1", "2"], + ) + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=["1", "2"], + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name,grpc_helpers", + [ + ( + NetworkFirewallPoliciesClient, + transports.NetworkFirewallPoliciesRestTransport, + "rest", + None, + ), + ], +) +def test_network_firewall_policies_client_client_options_credentials_file( + client_class, transport_class, transport_name, grpc_helpers +): + # Check the case credentials file is provided. + options = client_options.ClientOptions(credentials_file="credentials.json") + + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.AddAssociationNetworkFirewallPolicyRequest, + dict, + ], +) +def test_add_association_unary_rest(request_type): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "firewall_policy": "sample2"} + request_init["firewall_policy_association_resource"] = { + "attachment_target": "attachment_target_value", + "display_name": "display_name_value", + "firewall_policy_id": "firewall_policy_id_value", + "name": "name_value", + "short_name": "short_name_value", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation( + client_operation_id="client_operation_id_value", + creation_timestamp="creation_timestamp_value", + description="description_value", + end_time="end_time_value", + http_error_message="http_error_message_value", + http_error_status_code=2374, + id=205, + insert_time="insert_time_value", + kind="kind_value", + name="name_value", + operation_group_id="operation_group_id_value", + operation_type="operation_type_value", + progress=885, + region="region_value", + self_link="self_link_value", + start_time="start_time_value", + status=compute.Operation.Status.DONE, + status_message="status_message_value", + target_id=947, + target_link="target_link_value", + user="user_value", + zone="zone_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.add_association_unary(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.Operation) + assert response.client_operation_id == "client_operation_id_value" + assert response.creation_timestamp == "creation_timestamp_value" + assert response.description == "description_value" + assert response.end_time == "end_time_value" + assert response.http_error_message == "http_error_message_value" + assert response.http_error_status_code == 2374 + assert response.id == 205 + assert response.insert_time == "insert_time_value" + assert response.kind == "kind_value" + assert response.name == "name_value" + assert response.operation_group_id == "operation_group_id_value" + assert response.operation_type == "operation_type_value" + assert response.progress == 885 + assert response.region == "region_value" + assert response.self_link == "self_link_value" + assert response.start_time == "start_time_value" + assert response.status == compute.Operation.Status.DONE + assert response.status_message == "status_message_value" + assert response.target_id == 947 + assert response.target_link == "target_link_value" + assert response.user == "user_value" + assert response.zone == "zone_value" + + +def test_add_association_unary_rest_required_fields( + request_type=compute.AddAssociationNetworkFirewallPolicyRequest, +): + transport_class = transports.NetworkFirewallPoliciesRestTransport + + request_init = {} + request_init["firewall_policy"] = "" + request_init["project"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).add_association._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["firewallPolicy"] = "firewall_policy_value" + jsonified_request["project"] = "project_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).add_association._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set( + ( + "replace_existing_association", + "request_id", + ) + ) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "firewallPolicy" in jsonified_request + assert jsonified_request["firewallPolicy"] == "firewall_policy_value" + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "post", + "query_params": request_init, + } + transcode_result["body"] = {} + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.add_association_unary(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_add_association_unary_rest_unset_required_fields(): + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.add_association._get_unset_required_fields({}) + assert set(unset_fields) == ( + set( + ( + "replaceExistingAssociation", + "requestId", + ) + ) + & set( + ( + "firewallPolicy", + "firewallPolicyAssociationResource", + "project", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_add_association_unary_rest_interceptors(null_interceptor): + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.NetworkFirewallPoliciesRestInterceptor(), + ) + client = NetworkFirewallPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.NetworkFirewallPoliciesRestInterceptor, "post_add_association" + ) as post, mock.patch.object( + transports.NetworkFirewallPoliciesRestInterceptor, "pre_add_association" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.Operation.to_json(compute.Operation()) + + request = compute.AddAssociationNetworkFirewallPolicyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.Operation + + client.add_association_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_add_association_unary_rest_bad_request( + transport: str = "rest", + request_type=compute.AddAssociationNetworkFirewallPolicyRequest, +): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "firewall_policy": "sample2"} + request_init["firewall_policy_association_resource"] = { + "attachment_target": "attachment_target_value", + "display_name": "display_name_value", + "firewall_policy_id": "firewall_policy_id_value", + "name": "name_value", + "short_name": "short_name_value", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.add_association_unary(request) + + +def test_add_association_unary_rest_flattened(): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = {"project": "sample1", "firewall_policy": "sample2"} + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + firewall_policy="firewall_policy_value", + firewall_policy_association_resource=compute.FirewallPolicyAssociation( + attachment_target="attachment_target_value" + ), + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.add_association_unary(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/global/firewallPolicies/{firewall_policy}/addAssociation" + % client.transport._host, + args[1], + ) + + +def test_add_association_unary_rest_flattened_error(transport: str = "rest"): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.add_association_unary( + compute.AddAssociationNetworkFirewallPolicyRequest(), + project="project_value", + firewall_policy="firewall_policy_value", + firewall_policy_association_resource=compute.FirewallPolicyAssociation( + attachment_target="attachment_target_value" + ), + ) + + +def test_add_association_unary_rest_error(): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.AddRuleNetworkFirewallPolicyRequest, + dict, + ], +) +def test_add_rule_unary_rest(request_type): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "firewall_policy": "sample2"} + request_init["firewall_policy_rule_resource"] = { + "action": "action_value", + "description": "description_value", + "direction": "direction_value", + "disabled": True, + "enable_logging": True, + "kind": "kind_value", + "match": { + "dest_ip_ranges": ["dest_ip_ranges_value_1", "dest_ip_ranges_value_2"], + "layer4_configs": [ + { + "ip_protocol": "ip_protocol_value", + "ports": ["ports_value_1", "ports_value_2"], + } + ], + "src_ip_ranges": ["src_ip_ranges_value_1", "src_ip_ranges_value_2"], + "src_secure_tags": [{"name": "name_value", "state": "state_value"}], + }, + "priority": 898, + "rule_name": "rule_name_value", + "rule_tuple_count": 1737, + "target_resources": ["target_resources_value_1", "target_resources_value_2"], + "target_secure_tags": {}, + "target_service_accounts": [ + "target_service_accounts_value_1", + "target_service_accounts_value_2", + ], + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation( + client_operation_id="client_operation_id_value", + creation_timestamp="creation_timestamp_value", + description="description_value", + end_time="end_time_value", + http_error_message="http_error_message_value", + http_error_status_code=2374, + id=205, + insert_time="insert_time_value", + kind="kind_value", + name="name_value", + operation_group_id="operation_group_id_value", + operation_type="operation_type_value", + progress=885, + region="region_value", + self_link="self_link_value", + start_time="start_time_value", + status=compute.Operation.Status.DONE, + status_message="status_message_value", + target_id=947, + target_link="target_link_value", + user="user_value", + zone="zone_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.add_rule_unary(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.Operation) + assert response.client_operation_id == "client_operation_id_value" + assert response.creation_timestamp == "creation_timestamp_value" + assert response.description == "description_value" + assert response.end_time == "end_time_value" + assert response.http_error_message == "http_error_message_value" + assert response.http_error_status_code == 2374 + assert response.id == 205 + assert response.insert_time == "insert_time_value" + assert response.kind == "kind_value" + assert response.name == "name_value" + assert response.operation_group_id == "operation_group_id_value" + assert response.operation_type == "operation_type_value" + assert response.progress == 885 + assert response.region == "region_value" + assert response.self_link == "self_link_value" + assert response.start_time == "start_time_value" + assert response.status == compute.Operation.Status.DONE + assert response.status_message == "status_message_value" + assert response.target_id == 947 + assert response.target_link == "target_link_value" + assert response.user == "user_value" + assert response.zone == "zone_value" + + +def test_add_rule_unary_rest_required_fields( + request_type=compute.AddRuleNetworkFirewallPolicyRequest, +): + transport_class = transports.NetworkFirewallPoliciesRestTransport + + request_init = {} + request_init["firewall_policy"] = "" + request_init["project"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).add_rule._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["firewallPolicy"] = "firewall_policy_value" + jsonified_request["project"] = "project_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).add_rule._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set( + ( + "max_priority", + "min_priority", + "request_id", + ) + ) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "firewallPolicy" in jsonified_request + assert jsonified_request["firewallPolicy"] == "firewall_policy_value" + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "post", + "query_params": request_init, + } + transcode_result["body"] = {} + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.add_rule_unary(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_add_rule_unary_rest_unset_required_fields(): + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.add_rule._get_unset_required_fields({}) + assert set(unset_fields) == ( + set( + ( + "maxPriority", + "minPriority", + "requestId", + ) + ) + & set( + ( + "firewallPolicy", + "firewallPolicyRuleResource", + "project", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_add_rule_unary_rest_interceptors(null_interceptor): + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.NetworkFirewallPoliciesRestInterceptor(), + ) + client = NetworkFirewallPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.NetworkFirewallPoliciesRestInterceptor, "post_add_rule" + ) as post, mock.patch.object( + transports.NetworkFirewallPoliciesRestInterceptor, "pre_add_rule" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.Operation.to_json(compute.Operation()) + + request = compute.AddRuleNetworkFirewallPolicyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.Operation + + client.add_rule_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_add_rule_unary_rest_bad_request( + transport: str = "rest", request_type=compute.AddRuleNetworkFirewallPolicyRequest +): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "firewall_policy": "sample2"} + request_init["firewall_policy_rule_resource"] = { + "action": "action_value", + "description": "description_value", + "direction": "direction_value", + "disabled": True, + "enable_logging": True, + "kind": "kind_value", + "match": { + "dest_ip_ranges": ["dest_ip_ranges_value_1", "dest_ip_ranges_value_2"], + "layer4_configs": [ + { + "ip_protocol": "ip_protocol_value", + "ports": ["ports_value_1", "ports_value_2"], + } + ], + "src_ip_ranges": ["src_ip_ranges_value_1", "src_ip_ranges_value_2"], + "src_secure_tags": [{"name": "name_value", "state": "state_value"}], + }, + "priority": 898, + "rule_name": "rule_name_value", + "rule_tuple_count": 1737, + "target_resources": ["target_resources_value_1", "target_resources_value_2"], + "target_secure_tags": {}, + "target_service_accounts": [ + "target_service_accounts_value_1", + "target_service_accounts_value_2", + ], + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.add_rule_unary(request) + + +def test_add_rule_unary_rest_flattened(): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = {"project": "sample1", "firewall_policy": "sample2"} + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + firewall_policy="firewall_policy_value", + firewall_policy_rule_resource=compute.FirewallPolicyRule( + action="action_value" + ), + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.add_rule_unary(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/global/firewallPolicies/{firewall_policy}/addRule" + % client.transport._host, + args[1], + ) + + +def test_add_rule_unary_rest_flattened_error(transport: str = "rest"): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.add_rule_unary( + compute.AddRuleNetworkFirewallPolicyRequest(), + project="project_value", + firewall_policy="firewall_policy_value", + firewall_policy_rule_resource=compute.FirewallPolicyRule( + action="action_value" + ), + ) + + +def test_add_rule_unary_rest_error(): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.CloneRulesNetworkFirewallPolicyRequest, + dict, + ], +) +def test_clone_rules_unary_rest(request_type): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "firewall_policy": "sample2"} + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation( + client_operation_id="client_operation_id_value", + creation_timestamp="creation_timestamp_value", + description="description_value", + end_time="end_time_value", + http_error_message="http_error_message_value", + http_error_status_code=2374, + id=205, + insert_time="insert_time_value", + kind="kind_value", + name="name_value", + operation_group_id="operation_group_id_value", + operation_type="operation_type_value", + progress=885, + region="region_value", + self_link="self_link_value", + start_time="start_time_value", + status=compute.Operation.Status.DONE, + status_message="status_message_value", + target_id=947, + target_link="target_link_value", + user="user_value", + zone="zone_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.clone_rules_unary(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.Operation) + assert response.client_operation_id == "client_operation_id_value" + assert response.creation_timestamp == "creation_timestamp_value" + assert response.description == "description_value" + assert response.end_time == "end_time_value" + assert response.http_error_message == "http_error_message_value" + assert response.http_error_status_code == 2374 + assert response.id == 205 + assert response.insert_time == "insert_time_value" + assert response.kind == "kind_value" + assert response.name == "name_value" + assert response.operation_group_id == "operation_group_id_value" + assert response.operation_type == "operation_type_value" + assert response.progress == 885 + assert response.region == "region_value" + assert response.self_link == "self_link_value" + assert response.start_time == "start_time_value" + assert response.status == compute.Operation.Status.DONE + assert response.status_message == "status_message_value" + assert response.target_id == 947 + assert response.target_link == "target_link_value" + assert response.user == "user_value" + assert response.zone == "zone_value" + + +def test_clone_rules_unary_rest_required_fields( + request_type=compute.CloneRulesNetworkFirewallPolicyRequest, +): + transport_class = transports.NetworkFirewallPoliciesRestTransport + + request_init = {} + request_init["firewall_policy"] = "" + request_init["project"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).clone_rules._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["firewallPolicy"] = "firewall_policy_value" + jsonified_request["project"] = "project_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).clone_rules._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set( + ( + "request_id", + "source_firewall_policy", + ) + ) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "firewallPolicy" in jsonified_request + assert jsonified_request["firewallPolicy"] == "firewall_policy_value" + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "post", + "query_params": request_init, + } + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.clone_rules_unary(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_clone_rules_unary_rest_unset_required_fields(): + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.clone_rules._get_unset_required_fields({}) + assert set(unset_fields) == ( + set( + ( + "requestId", + "sourceFirewallPolicy", + ) + ) + & set( + ( + "firewallPolicy", + "project", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_clone_rules_unary_rest_interceptors(null_interceptor): + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.NetworkFirewallPoliciesRestInterceptor(), + ) + client = NetworkFirewallPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.NetworkFirewallPoliciesRestInterceptor, "post_clone_rules" + ) as post, mock.patch.object( + transports.NetworkFirewallPoliciesRestInterceptor, "pre_clone_rules" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.Operation.to_json(compute.Operation()) + + request = compute.CloneRulesNetworkFirewallPolicyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.Operation + + client.clone_rules_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_clone_rules_unary_rest_bad_request( + transport: str = "rest", request_type=compute.CloneRulesNetworkFirewallPolicyRequest +): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "firewall_policy": "sample2"} + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.clone_rules_unary(request) + + +def test_clone_rules_unary_rest_flattened(): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = {"project": "sample1", "firewall_policy": "sample2"} + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + firewall_policy="firewall_policy_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.clone_rules_unary(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/global/firewallPolicies/{firewall_policy}/cloneRules" + % client.transport._host, + args[1], + ) + + +def test_clone_rules_unary_rest_flattened_error(transport: str = "rest"): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.clone_rules_unary( + compute.CloneRulesNetworkFirewallPolicyRequest(), + project="project_value", + firewall_policy="firewall_policy_value", + ) + + +def test_clone_rules_unary_rest_error(): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteNetworkFirewallPolicyRequest, + dict, + ], +) +def test_delete_unary_rest(request_type): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "firewall_policy": "sample2"} + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation( + client_operation_id="client_operation_id_value", + creation_timestamp="creation_timestamp_value", + description="description_value", + end_time="end_time_value", + http_error_message="http_error_message_value", + http_error_status_code=2374, + id=205, + insert_time="insert_time_value", + kind="kind_value", + name="name_value", + operation_group_id="operation_group_id_value", + operation_type="operation_type_value", + progress=885, + region="region_value", + self_link="self_link_value", + start_time="start_time_value", + status=compute.Operation.Status.DONE, + status_message="status_message_value", + target_id=947, + target_link="target_link_value", + user="user_value", + zone="zone_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.delete_unary(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.Operation) + assert response.client_operation_id == "client_operation_id_value" + assert response.creation_timestamp == "creation_timestamp_value" + assert response.description == "description_value" + assert response.end_time == "end_time_value" + assert response.http_error_message == "http_error_message_value" + assert response.http_error_status_code == 2374 + assert response.id == 205 + assert response.insert_time == "insert_time_value" + assert response.kind == "kind_value" + assert response.name == "name_value" + assert response.operation_group_id == "operation_group_id_value" + assert response.operation_type == "operation_type_value" + assert response.progress == 885 + assert response.region == "region_value" + assert response.self_link == "self_link_value" + assert response.start_time == "start_time_value" + assert response.status == compute.Operation.Status.DONE + assert response.status_message == "status_message_value" + assert response.target_id == 947 + assert response.target_link == "target_link_value" + assert response.user == "user_value" + assert response.zone == "zone_value" + + +def test_delete_unary_rest_required_fields( + request_type=compute.DeleteNetworkFirewallPolicyRequest, +): + transport_class = transports.NetworkFirewallPoliciesRestTransport + + request_init = {} + request_init["firewall_policy"] = "" + request_init["project"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).delete._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["firewallPolicy"] = "firewall_policy_value" + jsonified_request["project"] = "project_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).delete._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set(("request_id",)) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "firewallPolicy" in jsonified_request + assert jsonified_request["firewallPolicy"] == "firewall_policy_value" + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "delete", + "query_params": request_init, + } + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.delete_unary(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_delete_unary_rest_unset_required_fields(): + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.delete._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(("requestId",)) + & set( + ( + "firewallPolicy", + "project", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_delete_unary_rest_interceptors(null_interceptor): + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.NetworkFirewallPoliciesRestInterceptor(), + ) + client = NetworkFirewallPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.NetworkFirewallPoliciesRestInterceptor, "post_delete" + ) as post, mock.patch.object( + transports.NetworkFirewallPoliciesRestInterceptor, "pre_delete" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.Operation.to_json(compute.Operation()) + + request = compute.DeleteNetworkFirewallPolicyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.Operation + + client.delete_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_delete_unary_rest_bad_request( + transport: str = "rest", request_type=compute.DeleteNetworkFirewallPolicyRequest +): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "firewall_policy": "sample2"} + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.delete_unary(request) + + +def test_delete_unary_rest_flattened(): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = {"project": "sample1", "firewall_policy": "sample2"} + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + firewall_policy="firewall_policy_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.delete_unary(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/global/firewallPolicies/{firewall_policy}" + % client.transport._host, + args[1], + ) + + +def test_delete_unary_rest_flattened_error(transport: str = "rest"): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.delete_unary( + compute.DeleteNetworkFirewallPolicyRequest(), + project="project_value", + firewall_policy="firewall_policy_value", + ) + + +def test_delete_unary_rest_error(): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.GetNetworkFirewallPolicyRequest, + dict, + ], +) +def test_get_rest(request_type): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "firewall_policy": "sample2"} + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.FirewallPolicy( + creation_timestamp="creation_timestamp_value", + description="description_value", + display_name="display_name_value", + fingerprint="fingerprint_value", + id=205, + kind="kind_value", + name="name_value", + parent="parent_value", + region="region_value", + rule_tuple_count=1737, + self_link="self_link_value", + self_link_with_id="self_link_with_id_value", + short_name="short_name_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.FirewallPolicy.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.get(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.FirewallPolicy) + assert response.creation_timestamp == "creation_timestamp_value" + assert response.description == "description_value" + assert response.display_name == "display_name_value" + assert response.fingerprint == "fingerprint_value" + assert response.id == 205 + assert response.kind == "kind_value" + assert response.name == "name_value" + assert response.parent == "parent_value" + assert response.region == "region_value" + assert response.rule_tuple_count == 1737 + assert response.self_link == "self_link_value" + assert response.self_link_with_id == "self_link_with_id_value" + assert response.short_name == "short_name_value" + + +def test_get_rest_required_fields(request_type=compute.GetNetworkFirewallPolicyRequest): + transport_class = transports.NetworkFirewallPoliciesRestTransport + + request_init = {} + request_init["firewall_policy"] = "" + request_init["project"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).get._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["firewallPolicy"] = "firewall_policy_value" + jsonified_request["project"] = "project_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).get._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "firewallPolicy" in jsonified_request + assert jsonified_request["firewallPolicy"] == "firewall_policy_value" + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.FirewallPolicy() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "get", + "query_params": request_init, + } + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.FirewallPolicy.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.get(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_get_rest_unset_required_fields(): + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.get._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(()) + & set( + ( + "firewallPolicy", + "project", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_get_rest_interceptors(null_interceptor): + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.NetworkFirewallPoliciesRestInterceptor(), + ) + client = NetworkFirewallPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.NetworkFirewallPoliciesRestInterceptor, "post_get" + ) as post, mock.patch.object( + transports.NetworkFirewallPoliciesRestInterceptor, "pre_get" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.FirewallPolicy.to_json( + compute.FirewallPolicy() + ) + + request = compute.GetNetworkFirewallPolicyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.FirewallPolicy + + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_get_rest_bad_request( + transport: str = "rest", request_type=compute.GetNetworkFirewallPolicyRequest +): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "firewall_policy": "sample2"} + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.get(request) + + +def test_get_rest_flattened(): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.FirewallPolicy() + + # get arguments that satisfy an http rule for this method + sample_request = {"project": "sample1", "firewall_policy": "sample2"} + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + firewall_policy="firewall_policy_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.FirewallPolicy.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.get(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/global/firewallPolicies/{firewall_policy}" + % client.transport._host, + args[1], + ) + + +def test_get_rest_flattened_error(transport: str = "rest"): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get( + compute.GetNetworkFirewallPolicyRequest(), + project="project_value", + firewall_policy="firewall_policy_value", + ) + + +def test_get_rest_error(): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.GetAssociationNetworkFirewallPolicyRequest, + dict, + ], +) +def test_get_association_rest(request_type): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "firewall_policy": "sample2"} + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.FirewallPolicyAssociation( + attachment_target="attachment_target_value", + display_name="display_name_value", + firewall_policy_id="firewall_policy_id_value", + name="name_value", + short_name="short_name_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.FirewallPolicyAssociation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.get_association(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.FirewallPolicyAssociation) + assert response.attachment_target == "attachment_target_value" + assert response.display_name == "display_name_value" + assert response.firewall_policy_id == "firewall_policy_id_value" + assert response.name == "name_value" + assert response.short_name == "short_name_value" + + +def test_get_association_rest_required_fields( + request_type=compute.GetAssociationNetworkFirewallPolicyRequest, +): + transport_class = transports.NetworkFirewallPoliciesRestTransport + + request_init = {} + request_init["firewall_policy"] = "" + request_init["project"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).get_association._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["firewallPolicy"] = "firewall_policy_value" + jsonified_request["project"] = "project_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).get_association._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set(("name",)) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "firewallPolicy" in jsonified_request + assert jsonified_request["firewallPolicy"] == "firewall_policy_value" + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.FirewallPolicyAssociation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "get", + "query_params": request_init, + } + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.FirewallPolicyAssociation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.get_association(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_get_association_rest_unset_required_fields(): + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.get_association._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(("name",)) + & set( + ( + "firewallPolicy", + "project", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_get_association_rest_interceptors(null_interceptor): + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.NetworkFirewallPoliciesRestInterceptor(), + ) + client = NetworkFirewallPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.NetworkFirewallPoliciesRestInterceptor, "post_get_association" + ) as post, mock.patch.object( + transports.NetworkFirewallPoliciesRestInterceptor, "pre_get_association" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.FirewallPolicyAssociation.to_json( + compute.FirewallPolicyAssociation() + ) + + request = compute.GetAssociationNetworkFirewallPolicyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.FirewallPolicyAssociation + + client.get_association( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_get_association_rest_bad_request( + transport: str = "rest", + request_type=compute.GetAssociationNetworkFirewallPolicyRequest, +): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "firewall_policy": "sample2"} + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.get_association(request) + + +def test_get_association_rest_flattened(): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.FirewallPolicyAssociation() + + # get arguments that satisfy an http rule for this method + sample_request = {"project": "sample1", "firewall_policy": "sample2"} + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + firewall_policy="firewall_policy_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.FirewallPolicyAssociation.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.get_association(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/global/firewallPolicies/{firewall_policy}/getAssociation" + % client.transport._host, + args[1], + ) + + +def test_get_association_rest_flattened_error(transport: str = "rest"): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_association( + compute.GetAssociationNetworkFirewallPolicyRequest(), + project="project_value", + firewall_policy="firewall_policy_value", + ) + + +def test_get_association_rest_error(): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.GetIamPolicyNetworkFirewallPolicyRequest, + dict, + ], +) +def test_get_iam_policy_rest(request_type): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "resource": "sample2"} + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Policy( + etag="etag_value", + iam_owned=True, + version=774, + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Policy.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.get_iam_policy(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.Policy) + assert response.etag == "etag_value" + assert response.iam_owned is True + assert response.version == 774 + + +def test_get_iam_policy_rest_required_fields( + request_type=compute.GetIamPolicyNetworkFirewallPolicyRequest, +): + transport_class = transports.NetworkFirewallPoliciesRestTransport + + request_init = {} + request_init["project"] = "" + request_init["resource"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).get_iam_policy._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["project"] = "project_value" + jsonified_request["resource"] = "resource_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).get_iam_policy._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set(("options_requested_policy_version",)) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + assert "resource" in jsonified_request + assert jsonified_request["resource"] == "resource_value" + + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.Policy() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "get", + "query_params": request_init, + } + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Policy.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.get_iam_policy(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_get_iam_policy_rest_unset_required_fields(): + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.get_iam_policy._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(("optionsRequestedPolicyVersion",)) + & set( + ( + "project", + "resource", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_get_iam_policy_rest_interceptors(null_interceptor): + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.NetworkFirewallPoliciesRestInterceptor(), + ) + client = NetworkFirewallPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.NetworkFirewallPoliciesRestInterceptor, "post_get_iam_policy" + ) as post, mock.patch.object( + transports.NetworkFirewallPoliciesRestInterceptor, "pre_get_iam_policy" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.Policy.to_json(compute.Policy()) + + request = compute.GetIamPolicyNetworkFirewallPolicyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.Policy + + client.get_iam_policy( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_get_iam_policy_rest_bad_request( + transport: str = "rest", + request_type=compute.GetIamPolicyNetworkFirewallPolicyRequest, +): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "resource": "sample2"} + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.get_iam_policy(request) + + +def test_get_iam_policy_rest_flattened(): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Policy() + + # get arguments that satisfy an http rule for this method + sample_request = {"project": "sample1", "resource": "sample2"} + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + resource="resource_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Policy.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.get_iam_policy(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/global/firewallPolicies/{resource}/getIamPolicy" + % client.transport._host, + args[1], + ) + + +def test_get_iam_policy_rest_flattened_error(transport: str = "rest"): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_iam_policy( + compute.GetIamPolicyNetworkFirewallPolicyRequest(), + project="project_value", + resource="resource_value", + ) + + +def test_get_iam_policy_rest_error(): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.GetRuleNetworkFirewallPolicyRequest, + dict, + ], +) +def test_get_rule_rest(request_type): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "firewall_policy": "sample2"} + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.FirewallPolicyRule( + action="action_value", + description="description_value", + direction="direction_value", + disabled=True, + enable_logging=True, + kind="kind_value", + priority=898, + rule_name="rule_name_value", + rule_tuple_count=1737, + target_resources=["target_resources_value"], + target_service_accounts=["target_service_accounts_value"], + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.FirewallPolicyRule.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.get_rule(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.FirewallPolicyRule) + assert response.action == "action_value" + assert response.description == "description_value" + assert response.direction == "direction_value" + assert response.disabled is True + assert response.enable_logging is True + assert response.kind == "kind_value" + assert response.priority == 898 + assert response.rule_name == "rule_name_value" + assert response.rule_tuple_count == 1737 + assert response.target_resources == ["target_resources_value"] + assert response.target_service_accounts == ["target_service_accounts_value"] + + +def test_get_rule_rest_required_fields( + request_type=compute.GetRuleNetworkFirewallPolicyRequest, +): + transport_class = transports.NetworkFirewallPoliciesRestTransport + + request_init = {} + request_init["firewall_policy"] = "" + request_init["project"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).get_rule._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["firewallPolicy"] = "firewall_policy_value" + jsonified_request["project"] = "project_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).get_rule._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set(("priority",)) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "firewallPolicy" in jsonified_request + assert jsonified_request["firewallPolicy"] == "firewall_policy_value" + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.FirewallPolicyRule() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "get", + "query_params": request_init, + } + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.FirewallPolicyRule.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.get_rule(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_get_rule_rest_unset_required_fields(): + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.get_rule._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(("priority",)) + & set( + ( + "firewallPolicy", + "project", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_get_rule_rest_interceptors(null_interceptor): + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.NetworkFirewallPoliciesRestInterceptor(), + ) + client = NetworkFirewallPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.NetworkFirewallPoliciesRestInterceptor, "post_get_rule" + ) as post, mock.patch.object( + transports.NetworkFirewallPoliciesRestInterceptor, "pre_get_rule" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.FirewallPolicyRule.to_json( + compute.FirewallPolicyRule() + ) + + request = compute.GetRuleNetworkFirewallPolicyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.FirewallPolicyRule + + client.get_rule( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_get_rule_rest_bad_request( + transport: str = "rest", request_type=compute.GetRuleNetworkFirewallPolicyRequest +): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "firewall_policy": "sample2"} + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.get_rule(request) + + +def test_get_rule_rest_flattened(): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.FirewallPolicyRule() + + # get arguments that satisfy an http rule for this method + sample_request = {"project": "sample1", "firewall_policy": "sample2"} + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + firewall_policy="firewall_policy_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.FirewallPolicyRule.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.get_rule(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/global/firewallPolicies/{firewall_policy}/getRule" + % client.transport._host, + args[1], + ) + + +def test_get_rule_rest_flattened_error(transport: str = "rest"): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_rule( + compute.GetRuleNetworkFirewallPolicyRequest(), + project="project_value", + firewall_policy="firewall_policy_value", + ) + + +def test_get_rule_rest_error(): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertNetworkFirewallPolicyRequest, + dict, + ], +) +def test_insert_unary_rest(request_type): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1"} + request_init["firewall_policy_resource"] = { + "associations": [ + { + "attachment_target": "attachment_target_value", + "display_name": "display_name_value", + "firewall_policy_id": "firewall_policy_id_value", + "name": "name_value", + "short_name": "short_name_value", + } + ], + "creation_timestamp": "creation_timestamp_value", + "description": "description_value", + "display_name": "display_name_value", + "fingerprint": "fingerprint_value", + "id": 205, + "kind": "kind_value", + "name": "name_value", + "parent": "parent_value", + "region": "region_value", + "rule_tuple_count": 1737, + "rules": [ + { + "action": "action_value", + "description": "description_value", + "direction": "direction_value", + "disabled": True, + "enable_logging": True, + "kind": "kind_value", + "match": { + "dest_ip_ranges": [ + "dest_ip_ranges_value_1", + "dest_ip_ranges_value_2", + ], + "layer4_configs": [ + { + "ip_protocol": "ip_protocol_value", + "ports": ["ports_value_1", "ports_value_2"], + } + ], + "src_ip_ranges": ["src_ip_ranges_value_1", "src_ip_ranges_value_2"], + "src_secure_tags": [{"name": "name_value", "state": "state_value"}], + }, + "priority": 898, + "rule_name": "rule_name_value", + "rule_tuple_count": 1737, + "target_resources": [ + "target_resources_value_1", + "target_resources_value_2", + ], + "target_secure_tags": {}, + "target_service_accounts": [ + "target_service_accounts_value_1", + "target_service_accounts_value_2", + ], + } + ], + "self_link": "self_link_value", + "self_link_with_id": "self_link_with_id_value", + "short_name": "short_name_value", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation( + client_operation_id="client_operation_id_value", + creation_timestamp="creation_timestamp_value", + description="description_value", + end_time="end_time_value", + http_error_message="http_error_message_value", + http_error_status_code=2374, + id=205, + insert_time="insert_time_value", + kind="kind_value", + name="name_value", + operation_group_id="operation_group_id_value", + operation_type="operation_type_value", + progress=885, + region="region_value", + self_link="self_link_value", + start_time="start_time_value", + status=compute.Operation.Status.DONE, + status_message="status_message_value", + target_id=947, + target_link="target_link_value", + user="user_value", + zone="zone_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.insert_unary(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.Operation) + assert response.client_operation_id == "client_operation_id_value" + assert response.creation_timestamp == "creation_timestamp_value" + assert response.description == "description_value" + assert response.end_time == "end_time_value" + assert response.http_error_message == "http_error_message_value" + assert response.http_error_status_code == 2374 + assert response.id == 205 + assert response.insert_time == "insert_time_value" + assert response.kind == "kind_value" + assert response.name == "name_value" + assert response.operation_group_id == "operation_group_id_value" + assert response.operation_type == "operation_type_value" + assert response.progress == 885 + assert response.region == "region_value" + assert response.self_link == "self_link_value" + assert response.start_time == "start_time_value" + assert response.status == compute.Operation.Status.DONE + assert response.status_message == "status_message_value" + assert response.target_id == 947 + assert response.target_link == "target_link_value" + assert response.user == "user_value" + assert response.zone == "zone_value" + + +def test_insert_unary_rest_required_fields( + request_type=compute.InsertNetworkFirewallPolicyRequest, +): + transport_class = transports.NetworkFirewallPoliciesRestTransport + + request_init = {} + request_init["project"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).insert._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["project"] = "project_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).insert._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set(("request_id",)) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "post", + "query_params": request_init, + } + transcode_result["body"] = {} + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.insert_unary(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_insert_unary_rest_unset_required_fields(): + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.insert._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(("requestId",)) + & set( + ( + "firewallPolicyResource", + "project", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_insert_unary_rest_interceptors(null_interceptor): + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.NetworkFirewallPoliciesRestInterceptor(), + ) + client = NetworkFirewallPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.NetworkFirewallPoliciesRestInterceptor, "post_insert" + ) as post, mock.patch.object( + transports.NetworkFirewallPoliciesRestInterceptor, "pre_insert" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.Operation.to_json(compute.Operation()) + + request = compute.InsertNetworkFirewallPolicyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.Operation + + client.insert_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_insert_unary_rest_bad_request( + transport: str = "rest", request_type=compute.InsertNetworkFirewallPolicyRequest +): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1"} + request_init["firewall_policy_resource"] = { + "associations": [ + { + "attachment_target": "attachment_target_value", + "display_name": "display_name_value", + "firewall_policy_id": "firewall_policy_id_value", + "name": "name_value", + "short_name": "short_name_value", + } + ], + "creation_timestamp": "creation_timestamp_value", + "description": "description_value", + "display_name": "display_name_value", + "fingerprint": "fingerprint_value", + "id": 205, + "kind": "kind_value", + "name": "name_value", + "parent": "parent_value", + "region": "region_value", + "rule_tuple_count": 1737, + "rules": [ + { + "action": "action_value", + "description": "description_value", + "direction": "direction_value", + "disabled": True, + "enable_logging": True, + "kind": "kind_value", + "match": { + "dest_ip_ranges": [ + "dest_ip_ranges_value_1", + "dest_ip_ranges_value_2", + ], + "layer4_configs": [ + { + "ip_protocol": "ip_protocol_value", + "ports": ["ports_value_1", "ports_value_2"], + } + ], + "src_ip_ranges": ["src_ip_ranges_value_1", "src_ip_ranges_value_2"], + "src_secure_tags": [{"name": "name_value", "state": "state_value"}], + }, + "priority": 898, + "rule_name": "rule_name_value", + "rule_tuple_count": 1737, + "target_resources": [ + "target_resources_value_1", + "target_resources_value_2", + ], + "target_secure_tags": {}, + "target_service_accounts": [ + "target_service_accounts_value_1", + "target_service_accounts_value_2", + ], + } + ], + "self_link": "self_link_value", + "self_link_with_id": "self_link_with_id_value", + "short_name": "short_name_value", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.insert_unary(request) + + +def test_insert_unary_rest_flattened(): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = {"project": "sample1"} + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + firewall_policy_resource=compute.FirewallPolicy( + associations=[ + compute.FirewallPolicyAssociation( + attachment_target="attachment_target_value" + ) + ] + ), + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.insert_unary(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/global/firewallPolicies" + % client.transport._host, + args[1], + ) + + +def test_insert_unary_rest_flattened_error(transport: str = "rest"): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.insert_unary( + compute.InsertNetworkFirewallPolicyRequest(), + project="project_value", + firewall_policy_resource=compute.FirewallPolicy( + associations=[ + compute.FirewallPolicyAssociation( + attachment_target="attachment_target_value" + ) + ] + ), + ) + + +def test_insert_unary_rest_error(): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.ListNetworkFirewallPoliciesRequest, + dict, + ], +) +def test_list_rest(request_type): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1"} + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.FirewallPolicyList( + id="id_value", + kind="kind_value", + next_page_token="next_page_token_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.FirewallPolicyList.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.list(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListPager) + assert response.id == "id_value" + assert response.kind == "kind_value" + assert response.next_page_token == "next_page_token_value" + + +def test_list_rest_required_fields( + request_type=compute.ListNetworkFirewallPoliciesRequest, +): + transport_class = transports.NetworkFirewallPoliciesRestTransport + + request_init = {} + request_init["project"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).list._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["project"] = "project_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).list._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set( + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) + ) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.FirewallPolicyList() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "get", + "query_params": request_init, + } + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.FirewallPolicyList.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.list(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_list_rest_unset_required_fields(): + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.list._get_unset_required_fields({}) + assert set(unset_fields) == ( + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set(("project",)) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_list_rest_interceptors(null_interceptor): + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.NetworkFirewallPoliciesRestInterceptor(), + ) + client = NetworkFirewallPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.NetworkFirewallPoliciesRestInterceptor, "post_list" + ) as post, mock.patch.object( + transports.NetworkFirewallPoliciesRestInterceptor, "pre_list" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.FirewallPolicyList.to_json( + compute.FirewallPolicyList() + ) + + request = compute.ListNetworkFirewallPoliciesRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.FirewallPolicyList + + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_list_rest_bad_request( + transport: str = "rest", request_type=compute.ListNetworkFirewallPoliciesRequest +): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1"} + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.list(request) + + +def test_list_rest_flattened(): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.FirewallPolicyList() + + # get arguments that satisfy an http rule for this method + sample_request = {"project": "sample1"} + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.FirewallPolicyList.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.list(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/global/firewallPolicies" + % client.transport._host, + args[1], + ) + + +def test_list_rest_flattened_error(transport: str = "rest"): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list( + compute.ListNetworkFirewallPoliciesRequest(), + project="project_value", + ) + + +def test_list_rest_pager(transport: str = "rest"): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # TODO(kbandes): remove this mock unless there's a good reason for it. + # with mock.patch.object(path_template, 'transcode') as transcode: + # Set the response as a series of pages + response = ( + compute.FirewallPolicyList( + items=[ + compute.FirewallPolicy(), + compute.FirewallPolicy(), + compute.FirewallPolicy(), + ], + next_page_token="abc", + ), + compute.FirewallPolicyList( + items=[], + next_page_token="def", + ), + compute.FirewallPolicyList( + items=[ + compute.FirewallPolicy(), + ], + next_page_token="ghi", + ), + compute.FirewallPolicyList( + items=[ + compute.FirewallPolicy(), + compute.FirewallPolicy(), + ], + ), + ) + # Two responses for two calls + response = response + response + + # Wrap the values into proper Response objs + response = tuple(compute.FirewallPolicyList.to_json(x) for x in response) + return_values = tuple(Response() for i in response) + for return_val, response_val in zip(return_values, response): + return_val._content = response_val.encode("UTF-8") + return_val.status_code = 200 + req.side_effect = return_values + + sample_request = {"project": "sample1"} + + pager = client.list(request=sample_request) + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, compute.FirewallPolicy) for i in results) + + pages = list(client.list(request=sample_request).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.parametrize( + "request_type", + [ + compute.PatchNetworkFirewallPolicyRequest, + dict, + ], +) +def test_patch_unary_rest(request_type): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "firewall_policy": "sample2"} + request_init["firewall_policy_resource"] = { + "associations": [ + { + "attachment_target": "attachment_target_value", + "display_name": "display_name_value", + "firewall_policy_id": "firewall_policy_id_value", + "name": "name_value", + "short_name": "short_name_value", + } + ], + "creation_timestamp": "creation_timestamp_value", + "description": "description_value", + "display_name": "display_name_value", + "fingerprint": "fingerprint_value", + "id": 205, + "kind": "kind_value", + "name": "name_value", + "parent": "parent_value", + "region": "region_value", + "rule_tuple_count": 1737, + "rules": [ + { + "action": "action_value", + "description": "description_value", + "direction": "direction_value", + "disabled": True, + "enable_logging": True, + "kind": "kind_value", + "match": { + "dest_ip_ranges": [ + "dest_ip_ranges_value_1", + "dest_ip_ranges_value_2", + ], + "layer4_configs": [ + { + "ip_protocol": "ip_protocol_value", + "ports": ["ports_value_1", "ports_value_2"], + } + ], + "src_ip_ranges": ["src_ip_ranges_value_1", "src_ip_ranges_value_2"], + "src_secure_tags": [{"name": "name_value", "state": "state_value"}], + }, + "priority": 898, + "rule_name": "rule_name_value", + "rule_tuple_count": 1737, + "target_resources": [ + "target_resources_value_1", + "target_resources_value_2", + ], + "target_secure_tags": {}, + "target_service_accounts": [ + "target_service_accounts_value_1", + "target_service_accounts_value_2", + ], + } + ], + "self_link": "self_link_value", + "self_link_with_id": "self_link_with_id_value", + "short_name": "short_name_value", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation( + client_operation_id="client_operation_id_value", + creation_timestamp="creation_timestamp_value", + description="description_value", + end_time="end_time_value", + http_error_message="http_error_message_value", + http_error_status_code=2374, + id=205, + insert_time="insert_time_value", + kind="kind_value", + name="name_value", + operation_group_id="operation_group_id_value", + operation_type="operation_type_value", + progress=885, + region="region_value", + self_link="self_link_value", + start_time="start_time_value", + status=compute.Operation.Status.DONE, + status_message="status_message_value", + target_id=947, + target_link="target_link_value", + user="user_value", + zone="zone_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.patch_unary(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.Operation) + assert response.client_operation_id == "client_operation_id_value" + assert response.creation_timestamp == "creation_timestamp_value" + assert response.description == "description_value" + assert response.end_time == "end_time_value" + assert response.http_error_message == "http_error_message_value" + assert response.http_error_status_code == 2374 + assert response.id == 205 + assert response.insert_time == "insert_time_value" + assert response.kind == "kind_value" + assert response.name == "name_value" + assert response.operation_group_id == "operation_group_id_value" + assert response.operation_type == "operation_type_value" + assert response.progress == 885 + assert response.region == "region_value" + assert response.self_link == "self_link_value" + assert response.start_time == "start_time_value" + assert response.status == compute.Operation.Status.DONE + assert response.status_message == "status_message_value" + assert response.target_id == 947 + assert response.target_link == "target_link_value" + assert response.user == "user_value" + assert response.zone == "zone_value" + + +def test_patch_unary_rest_required_fields( + request_type=compute.PatchNetworkFirewallPolicyRequest, +): + transport_class = transports.NetworkFirewallPoliciesRestTransport + + request_init = {} + request_init["firewall_policy"] = "" + request_init["project"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).patch._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["firewallPolicy"] = "firewall_policy_value" + jsonified_request["project"] = "project_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).patch._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set(("request_id",)) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "firewallPolicy" in jsonified_request + assert jsonified_request["firewallPolicy"] == "firewall_policy_value" + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "patch", + "query_params": request_init, + } + transcode_result["body"] = {} + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.patch_unary(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_patch_unary_rest_unset_required_fields(): + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.patch._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(("requestId",)) + & set( + ( + "firewallPolicy", + "firewallPolicyResource", + "project", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_patch_unary_rest_interceptors(null_interceptor): + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.NetworkFirewallPoliciesRestInterceptor(), + ) + client = NetworkFirewallPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.NetworkFirewallPoliciesRestInterceptor, "post_patch" + ) as post, mock.patch.object( + transports.NetworkFirewallPoliciesRestInterceptor, "pre_patch" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.Operation.to_json(compute.Operation()) + + request = compute.PatchNetworkFirewallPolicyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.Operation + + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_patch_unary_rest_bad_request( + transport: str = "rest", request_type=compute.PatchNetworkFirewallPolicyRequest +): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "firewall_policy": "sample2"} + request_init["firewall_policy_resource"] = { + "associations": [ + { + "attachment_target": "attachment_target_value", + "display_name": "display_name_value", + "firewall_policy_id": "firewall_policy_id_value", + "name": "name_value", + "short_name": "short_name_value", + } + ], + "creation_timestamp": "creation_timestamp_value", + "description": "description_value", + "display_name": "display_name_value", + "fingerprint": "fingerprint_value", + "id": 205, + "kind": "kind_value", + "name": "name_value", + "parent": "parent_value", + "region": "region_value", + "rule_tuple_count": 1737, + "rules": [ + { + "action": "action_value", + "description": "description_value", + "direction": "direction_value", + "disabled": True, + "enable_logging": True, + "kind": "kind_value", + "match": { + "dest_ip_ranges": [ + "dest_ip_ranges_value_1", + "dest_ip_ranges_value_2", + ], + "layer4_configs": [ + { + "ip_protocol": "ip_protocol_value", + "ports": ["ports_value_1", "ports_value_2"], + } + ], + "src_ip_ranges": ["src_ip_ranges_value_1", "src_ip_ranges_value_2"], + "src_secure_tags": [{"name": "name_value", "state": "state_value"}], + }, + "priority": 898, + "rule_name": "rule_name_value", + "rule_tuple_count": 1737, + "target_resources": [ + "target_resources_value_1", + "target_resources_value_2", + ], + "target_secure_tags": {}, + "target_service_accounts": [ + "target_service_accounts_value_1", + "target_service_accounts_value_2", + ], + } + ], + "self_link": "self_link_value", + "self_link_with_id": "self_link_with_id_value", + "short_name": "short_name_value", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.patch_unary(request) + + +def test_patch_unary_rest_flattened(): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = {"project": "sample1", "firewall_policy": "sample2"} + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + firewall_policy="firewall_policy_value", + firewall_policy_resource=compute.FirewallPolicy( + associations=[ + compute.FirewallPolicyAssociation( + attachment_target="attachment_target_value" + ) + ] + ), + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.patch_unary(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/global/firewallPolicies/{firewall_policy}" + % client.transport._host, + args[1], + ) + + +def test_patch_unary_rest_flattened_error(transport: str = "rest"): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.patch_unary( + compute.PatchNetworkFirewallPolicyRequest(), + project="project_value", + firewall_policy="firewall_policy_value", + firewall_policy_resource=compute.FirewallPolicy( + associations=[ + compute.FirewallPolicyAssociation( + attachment_target="attachment_target_value" + ) + ] + ), + ) + + +def test_patch_unary_rest_error(): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.PatchRuleNetworkFirewallPolicyRequest, + dict, + ], +) +def test_patch_rule_unary_rest(request_type): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "firewall_policy": "sample2"} + request_init["firewall_policy_rule_resource"] = { + "action": "action_value", + "description": "description_value", + "direction": "direction_value", + "disabled": True, + "enable_logging": True, + "kind": "kind_value", + "match": { + "dest_ip_ranges": ["dest_ip_ranges_value_1", "dest_ip_ranges_value_2"], + "layer4_configs": [ + { + "ip_protocol": "ip_protocol_value", + "ports": ["ports_value_1", "ports_value_2"], + } + ], + "src_ip_ranges": ["src_ip_ranges_value_1", "src_ip_ranges_value_2"], + "src_secure_tags": [{"name": "name_value", "state": "state_value"}], + }, + "priority": 898, + "rule_name": "rule_name_value", + "rule_tuple_count": 1737, + "target_resources": ["target_resources_value_1", "target_resources_value_2"], + "target_secure_tags": {}, + "target_service_accounts": [ + "target_service_accounts_value_1", + "target_service_accounts_value_2", + ], + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation( + client_operation_id="client_operation_id_value", + creation_timestamp="creation_timestamp_value", + description="description_value", + end_time="end_time_value", + http_error_message="http_error_message_value", + http_error_status_code=2374, + id=205, + insert_time="insert_time_value", + kind="kind_value", + name="name_value", + operation_group_id="operation_group_id_value", + operation_type="operation_type_value", + progress=885, + region="region_value", + self_link="self_link_value", + start_time="start_time_value", + status=compute.Operation.Status.DONE, + status_message="status_message_value", + target_id=947, + target_link="target_link_value", + user="user_value", + zone="zone_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.patch_rule_unary(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.Operation) + assert response.client_operation_id == "client_operation_id_value" + assert response.creation_timestamp == "creation_timestamp_value" + assert response.description == "description_value" + assert response.end_time == "end_time_value" + assert response.http_error_message == "http_error_message_value" + assert response.http_error_status_code == 2374 + assert response.id == 205 + assert response.insert_time == "insert_time_value" + assert response.kind == "kind_value" + assert response.name == "name_value" + assert response.operation_group_id == "operation_group_id_value" + assert response.operation_type == "operation_type_value" + assert response.progress == 885 + assert response.region == "region_value" + assert response.self_link == "self_link_value" + assert response.start_time == "start_time_value" + assert response.status == compute.Operation.Status.DONE + assert response.status_message == "status_message_value" + assert response.target_id == 947 + assert response.target_link == "target_link_value" + assert response.user == "user_value" + assert response.zone == "zone_value" + + +def test_patch_rule_unary_rest_required_fields( + request_type=compute.PatchRuleNetworkFirewallPolicyRequest, +): + transport_class = transports.NetworkFirewallPoliciesRestTransport + + request_init = {} + request_init["firewall_policy"] = "" + request_init["project"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).patch_rule._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["firewallPolicy"] = "firewall_policy_value" + jsonified_request["project"] = "project_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).patch_rule._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set( + ( + "priority", + "request_id", + ) + ) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "firewallPolicy" in jsonified_request + assert jsonified_request["firewallPolicy"] == "firewall_policy_value" + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "post", + "query_params": request_init, + } + transcode_result["body"] = {} + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.patch_rule_unary(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_patch_rule_unary_rest_unset_required_fields(): + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.patch_rule._get_unset_required_fields({}) + assert set(unset_fields) == ( + set( + ( + "priority", + "requestId", + ) + ) + & set( + ( + "firewallPolicy", + "firewallPolicyRuleResource", + "project", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_patch_rule_unary_rest_interceptors(null_interceptor): + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.NetworkFirewallPoliciesRestInterceptor(), + ) + client = NetworkFirewallPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.NetworkFirewallPoliciesRestInterceptor, "post_patch_rule" + ) as post, mock.patch.object( + transports.NetworkFirewallPoliciesRestInterceptor, "pre_patch_rule" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.Operation.to_json(compute.Operation()) + + request = compute.PatchRuleNetworkFirewallPolicyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.Operation + + client.patch_rule_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_patch_rule_unary_rest_bad_request( + transport: str = "rest", request_type=compute.PatchRuleNetworkFirewallPolicyRequest +): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "firewall_policy": "sample2"} + request_init["firewall_policy_rule_resource"] = { + "action": "action_value", + "description": "description_value", + "direction": "direction_value", + "disabled": True, + "enable_logging": True, + "kind": "kind_value", + "match": { + "dest_ip_ranges": ["dest_ip_ranges_value_1", "dest_ip_ranges_value_2"], + "layer4_configs": [ + { + "ip_protocol": "ip_protocol_value", + "ports": ["ports_value_1", "ports_value_2"], + } + ], + "src_ip_ranges": ["src_ip_ranges_value_1", "src_ip_ranges_value_2"], + "src_secure_tags": [{"name": "name_value", "state": "state_value"}], + }, + "priority": 898, + "rule_name": "rule_name_value", + "rule_tuple_count": 1737, + "target_resources": ["target_resources_value_1", "target_resources_value_2"], + "target_secure_tags": {}, + "target_service_accounts": [ + "target_service_accounts_value_1", + "target_service_accounts_value_2", + ], + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.patch_rule_unary(request) + + +def test_patch_rule_unary_rest_flattened(): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = {"project": "sample1", "firewall_policy": "sample2"} + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + firewall_policy="firewall_policy_value", + firewall_policy_rule_resource=compute.FirewallPolicyRule( + action="action_value" + ), + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.patch_rule_unary(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/global/firewallPolicies/{firewall_policy}/patchRule" + % client.transport._host, + args[1], + ) + + +def test_patch_rule_unary_rest_flattened_error(transport: str = "rest"): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.patch_rule_unary( + compute.PatchRuleNetworkFirewallPolicyRequest(), + project="project_value", + firewall_policy="firewall_policy_value", + firewall_policy_rule_resource=compute.FirewallPolicyRule( + action="action_value" + ), + ) + + +def test_patch_rule_unary_rest_error(): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.RemoveAssociationNetworkFirewallPolicyRequest, + dict, + ], +) +def test_remove_association_unary_rest(request_type): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "firewall_policy": "sample2"} + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation( + client_operation_id="client_operation_id_value", + creation_timestamp="creation_timestamp_value", + description="description_value", + end_time="end_time_value", + http_error_message="http_error_message_value", + http_error_status_code=2374, + id=205, + insert_time="insert_time_value", + kind="kind_value", + name="name_value", + operation_group_id="operation_group_id_value", + operation_type="operation_type_value", + progress=885, + region="region_value", + self_link="self_link_value", + start_time="start_time_value", + status=compute.Operation.Status.DONE, + status_message="status_message_value", + target_id=947, + target_link="target_link_value", + user="user_value", + zone="zone_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.remove_association_unary(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.Operation) + assert response.client_operation_id == "client_operation_id_value" + assert response.creation_timestamp == "creation_timestamp_value" + assert response.description == "description_value" + assert response.end_time == "end_time_value" + assert response.http_error_message == "http_error_message_value" + assert response.http_error_status_code == 2374 + assert response.id == 205 + assert response.insert_time == "insert_time_value" + assert response.kind == "kind_value" + assert response.name == "name_value" + assert response.operation_group_id == "operation_group_id_value" + assert response.operation_type == "operation_type_value" + assert response.progress == 885 + assert response.region == "region_value" + assert response.self_link == "self_link_value" + assert response.start_time == "start_time_value" + assert response.status == compute.Operation.Status.DONE + assert response.status_message == "status_message_value" + assert response.target_id == 947 + assert response.target_link == "target_link_value" + assert response.user == "user_value" + assert response.zone == "zone_value" + + +def test_remove_association_unary_rest_required_fields( + request_type=compute.RemoveAssociationNetworkFirewallPolicyRequest, +): + transport_class = transports.NetworkFirewallPoliciesRestTransport + + request_init = {} + request_init["firewall_policy"] = "" + request_init["project"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).remove_association._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["firewallPolicy"] = "firewall_policy_value" + jsonified_request["project"] = "project_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).remove_association._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set( + ( + "name", + "request_id", + ) + ) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "firewallPolicy" in jsonified_request + assert jsonified_request["firewallPolicy"] == "firewall_policy_value" + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "post", + "query_params": request_init, + } + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.remove_association_unary(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_remove_association_unary_rest_unset_required_fields(): + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.remove_association._get_unset_required_fields({}) + assert set(unset_fields) == ( + set( + ( + "name", + "requestId", + ) + ) + & set( + ( + "firewallPolicy", + "project", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_remove_association_unary_rest_interceptors(null_interceptor): + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.NetworkFirewallPoliciesRestInterceptor(), + ) + client = NetworkFirewallPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.NetworkFirewallPoliciesRestInterceptor, "post_remove_association" + ) as post, mock.patch.object( + transports.NetworkFirewallPoliciesRestInterceptor, "pre_remove_association" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.Operation.to_json(compute.Operation()) + + request = compute.RemoveAssociationNetworkFirewallPolicyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.Operation + + client.remove_association_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_remove_association_unary_rest_bad_request( + transport: str = "rest", + request_type=compute.RemoveAssociationNetworkFirewallPolicyRequest, +): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "firewall_policy": "sample2"} + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.remove_association_unary(request) + + +def test_remove_association_unary_rest_flattened(): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = {"project": "sample1", "firewall_policy": "sample2"} + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + firewall_policy="firewall_policy_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.remove_association_unary(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/global/firewallPolicies/{firewall_policy}/removeAssociation" + % client.transport._host, + args[1], + ) + + +def test_remove_association_unary_rest_flattened_error(transport: str = "rest"): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.remove_association_unary( + compute.RemoveAssociationNetworkFirewallPolicyRequest(), + project="project_value", + firewall_policy="firewall_policy_value", + ) + + +def test_remove_association_unary_rest_error(): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.RemoveRuleNetworkFirewallPolicyRequest, + dict, + ], +) +def test_remove_rule_unary_rest(request_type): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "firewall_policy": "sample2"} + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation( + client_operation_id="client_operation_id_value", + creation_timestamp="creation_timestamp_value", + description="description_value", + end_time="end_time_value", + http_error_message="http_error_message_value", + http_error_status_code=2374, + id=205, + insert_time="insert_time_value", + kind="kind_value", + name="name_value", + operation_group_id="operation_group_id_value", + operation_type="operation_type_value", + progress=885, + region="region_value", + self_link="self_link_value", + start_time="start_time_value", + status=compute.Operation.Status.DONE, + status_message="status_message_value", + target_id=947, + target_link="target_link_value", + user="user_value", + zone="zone_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.remove_rule_unary(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.Operation) + assert response.client_operation_id == "client_operation_id_value" + assert response.creation_timestamp == "creation_timestamp_value" + assert response.description == "description_value" + assert response.end_time == "end_time_value" + assert response.http_error_message == "http_error_message_value" + assert response.http_error_status_code == 2374 + assert response.id == 205 + assert response.insert_time == "insert_time_value" + assert response.kind == "kind_value" + assert response.name == "name_value" + assert response.operation_group_id == "operation_group_id_value" + assert response.operation_type == "operation_type_value" + assert response.progress == 885 + assert response.region == "region_value" + assert response.self_link == "self_link_value" + assert response.start_time == "start_time_value" + assert response.status == compute.Operation.Status.DONE + assert response.status_message == "status_message_value" + assert response.target_id == 947 + assert response.target_link == "target_link_value" + assert response.user == "user_value" + assert response.zone == "zone_value" + + +def test_remove_rule_unary_rest_required_fields( + request_type=compute.RemoveRuleNetworkFirewallPolicyRequest, +): + transport_class = transports.NetworkFirewallPoliciesRestTransport + + request_init = {} + request_init["firewall_policy"] = "" + request_init["project"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).remove_rule._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["firewallPolicy"] = "firewall_policy_value" + jsonified_request["project"] = "project_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).remove_rule._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set( + ( + "priority", + "request_id", + ) + ) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "firewallPolicy" in jsonified_request + assert jsonified_request["firewallPolicy"] == "firewall_policy_value" + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "post", + "query_params": request_init, + } + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.remove_rule_unary(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_remove_rule_unary_rest_unset_required_fields(): + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.remove_rule._get_unset_required_fields({}) + assert set(unset_fields) == ( + set( + ( + "priority", + "requestId", + ) + ) + & set( + ( + "firewallPolicy", + "project", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_remove_rule_unary_rest_interceptors(null_interceptor): + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.NetworkFirewallPoliciesRestInterceptor(), + ) + client = NetworkFirewallPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.NetworkFirewallPoliciesRestInterceptor, "post_remove_rule" + ) as post, mock.patch.object( + transports.NetworkFirewallPoliciesRestInterceptor, "pre_remove_rule" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.Operation.to_json(compute.Operation()) + + request = compute.RemoveRuleNetworkFirewallPolicyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.Operation + + client.remove_rule_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_remove_rule_unary_rest_bad_request( + transport: str = "rest", request_type=compute.RemoveRuleNetworkFirewallPolicyRequest +): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "firewall_policy": "sample2"} + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.remove_rule_unary(request) + + +def test_remove_rule_unary_rest_flattened(): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = {"project": "sample1", "firewall_policy": "sample2"} + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + firewall_policy="firewall_policy_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.remove_rule_unary(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/global/firewallPolicies/{firewall_policy}/removeRule" + % client.transport._host, + args[1], + ) + + +def test_remove_rule_unary_rest_flattened_error(transport: str = "rest"): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.remove_rule_unary( + compute.RemoveRuleNetworkFirewallPolicyRequest(), + project="project_value", + firewall_policy="firewall_policy_value", + ) + + +def test_remove_rule_unary_rest_error(): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.SetIamPolicyNetworkFirewallPolicyRequest, + dict, + ], +) +def test_set_iam_policy_rest(request_type): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "resource": "sample2"} + request_init["global_set_policy_request_resource"] = { + "bindings": [ + { + "binding_id": "binding_id_value", + "condition": { + "description": "description_value", + "expression": "expression_value", + "location": "location_value", + "title": "title_value", + }, + "members": ["members_value_1", "members_value_2"], + "role": "role_value", + } + ], + "etag": "etag_value", + "policy": { + "audit_configs": [ + { + "audit_log_configs": [ + { + "exempted_members": [ + "exempted_members_value_1", + "exempted_members_value_2", + ], + "ignore_child_exemptions": True, + "log_type": "log_type_value", + } + ], + "exempted_members": [ + "exempted_members_value_1", + "exempted_members_value_2", + ], + "service": "service_value", + } + ], + "bindings": {}, + "etag": "etag_value", + "iam_owned": True, + "rules": [ + { + "action": "action_value", + "conditions": [ + { + "iam": "iam_value", + "op": "op_value", + "svc": "svc_value", + "sys": "sys_value", + "values": ["values_value_1", "values_value_2"], + } + ], + "description": "description_value", + "ins": ["ins_value_1", "ins_value_2"], + "log_configs": [ + { + "cloud_audit": { + "authorization_logging_options": { + "permission_type": "permission_type_value" + }, + "log_name": "log_name_value", + }, + "counter": { + "custom_fields": [ + {"name": "name_value", "value": "value_value"} + ], + "field": "field_value", + "metric": "metric_value", + }, + "data_access": {"log_mode": "log_mode_value"}, + } + ], + "not_ins": ["not_ins_value_1", "not_ins_value_2"], + "permissions": ["permissions_value_1", "permissions_value_2"], + } + ], + "version": 774, + }, + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Policy( + etag="etag_value", + iam_owned=True, + version=774, + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Policy.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.set_iam_policy(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.Policy) + assert response.etag == "etag_value" + assert response.iam_owned is True + assert response.version == 774 + + +def test_set_iam_policy_rest_required_fields( + request_type=compute.SetIamPolicyNetworkFirewallPolicyRequest, +): + transport_class = transports.NetworkFirewallPoliciesRestTransport + + request_init = {} + request_init["project"] = "" + request_init["resource"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).set_iam_policy._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["project"] = "project_value" + jsonified_request["resource"] = "resource_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).set_iam_policy._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + assert "resource" in jsonified_request + assert jsonified_request["resource"] == "resource_value" + + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.Policy() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "post", + "query_params": request_init, + } + transcode_result["body"] = {} + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Policy.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.set_iam_policy(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_set_iam_policy_rest_unset_required_fields(): + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.set_iam_policy._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(()) + & set( + ( + "globalSetPolicyRequestResource", + "project", + "resource", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_set_iam_policy_rest_interceptors(null_interceptor): + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.NetworkFirewallPoliciesRestInterceptor(), + ) + client = NetworkFirewallPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.NetworkFirewallPoliciesRestInterceptor, "post_set_iam_policy" + ) as post, mock.patch.object( + transports.NetworkFirewallPoliciesRestInterceptor, "pre_set_iam_policy" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.Policy.to_json(compute.Policy()) + + request = compute.SetIamPolicyNetworkFirewallPolicyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.Policy + + client.set_iam_policy( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_set_iam_policy_rest_bad_request( + transport: str = "rest", + request_type=compute.SetIamPolicyNetworkFirewallPolicyRequest, +): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "resource": "sample2"} + request_init["global_set_policy_request_resource"] = { + "bindings": [ + { + "binding_id": "binding_id_value", + "condition": { + "description": "description_value", + "expression": "expression_value", + "location": "location_value", + "title": "title_value", + }, + "members": ["members_value_1", "members_value_2"], + "role": "role_value", + } + ], + "etag": "etag_value", + "policy": { + "audit_configs": [ + { + "audit_log_configs": [ + { + "exempted_members": [ + "exempted_members_value_1", + "exempted_members_value_2", + ], + "ignore_child_exemptions": True, + "log_type": "log_type_value", + } + ], + "exempted_members": [ + "exempted_members_value_1", + "exempted_members_value_2", + ], + "service": "service_value", + } + ], + "bindings": {}, + "etag": "etag_value", + "iam_owned": True, + "rules": [ + { + "action": "action_value", + "conditions": [ + { + "iam": "iam_value", + "op": "op_value", + "svc": "svc_value", + "sys": "sys_value", + "values": ["values_value_1", "values_value_2"], + } + ], + "description": "description_value", + "ins": ["ins_value_1", "ins_value_2"], + "log_configs": [ + { + "cloud_audit": { + "authorization_logging_options": { + "permission_type": "permission_type_value" + }, + "log_name": "log_name_value", + }, + "counter": { + "custom_fields": [ + {"name": "name_value", "value": "value_value"} + ], + "field": "field_value", + "metric": "metric_value", + }, + "data_access": {"log_mode": "log_mode_value"}, + } + ], + "not_ins": ["not_ins_value_1", "not_ins_value_2"], + "permissions": ["permissions_value_1", "permissions_value_2"], + } + ], + "version": 774, + }, + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.set_iam_policy(request) + + +def test_set_iam_policy_rest_flattened(): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Policy() + + # get arguments that satisfy an http rule for this method + sample_request = {"project": "sample1", "resource": "sample2"} + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + resource="resource_value", + global_set_policy_request_resource=compute.GlobalSetPolicyRequest( + bindings=[compute.Binding(binding_id="binding_id_value")] + ), + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Policy.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.set_iam_policy(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/global/firewallPolicies/{resource}/setIamPolicy" + % client.transport._host, + args[1], + ) + + +def test_set_iam_policy_rest_flattened_error(transport: str = "rest"): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.set_iam_policy( + compute.SetIamPolicyNetworkFirewallPolicyRequest(), + project="project_value", + resource="resource_value", + global_set_policy_request_resource=compute.GlobalSetPolicyRequest( + bindings=[compute.Binding(binding_id="binding_id_value")] + ), + ) + + +def test_set_iam_policy_rest_error(): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.TestIamPermissionsNetworkFirewallPolicyRequest, + dict, + ], +) +def test_test_iam_permissions_rest(request_type): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "resource": "sample2"} + request_init["test_permissions_request_resource"] = { + "permissions": ["permissions_value_1", "permissions_value_2"] + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.TestPermissionsResponse( + permissions=["permissions_value"], + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.TestPermissionsResponse.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.test_iam_permissions(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.TestPermissionsResponse) + assert response.permissions == ["permissions_value"] + + +def test_test_iam_permissions_rest_required_fields( + request_type=compute.TestIamPermissionsNetworkFirewallPolicyRequest, +): + transport_class = transports.NetworkFirewallPoliciesRestTransport + + request_init = {} + request_init["project"] = "" + request_init["resource"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).test_iam_permissions._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["project"] = "project_value" + jsonified_request["resource"] = "resource_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).test_iam_permissions._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + assert "resource" in jsonified_request + assert jsonified_request["resource"] == "resource_value" + + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.TestPermissionsResponse() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "post", + "query_params": request_init, + } + transcode_result["body"] = {} + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.TestPermissionsResponse.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.test_iam_permissions(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_test_iam_permissions_rest_unset_required_fields(): + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.test_iam_permissions._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(()) + & set( + ( + "project", + "resource", + "testPermissionsRequestResource", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_test_iam_permissions_rest_interceptors(null_interceptor): + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.NetworkFirewallPoliciesRestInterceptor(), + ) + client = NetworkFirewallPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.NetworkFirewallPoliciesRestInterceptor, "post_test_iam_permissions" + ) as post, mock.patch.object( + transports.NetworkFirewallPoliciesRestInterceptor, "pre_test_iam_permissions" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.TestPermissionsResponse.to_json( + compute.TestPermissionsResponse() + ) + + request = compute.TestIamPermissionsNetworkFirewallPolicyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.TestPermissionsResponse + + client.test_iam_permissions( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_test_iam_permissions_rest_bad_request( + transport: str = "rest", + request_type=compute.TestIamPermissionsNetworkFirewallPolicyRequest, +): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "resource": "sample2"} + request_init["test_permissions_request_resource"] = { + "permissions": ["permissions_value_1", "permissions_value_2"] + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.test_iam_permissions(request) + + +def test_test_iam_permissions_rest_flattened(): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.TestPermissionsResponse() + + # get arguments that satisfy an http rule for this method + sample_request = {"project": "sample1", "resource": "sample2"} + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + resource="resource_value", + test_permissions_request_resource=compute.TestPermissionsRequest( + permissions=["permissions_value"] + ), + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.TestPermissionsResponse.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.test_iam_permissions(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/global/firewallPolicies/{resource}/testIamPermissions" + % client.transport._host, + args[1], + ) + + +def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.test_iam_permissions( + compute.TestIamPermissionsNetworkFirewallPolicyRequest(), + project="project_value", + resource="resource_value", + test_permissions_request_resource=compute.TestPermissionsRequest( + permissions=["permissions_value"] + ), + ) + + +def test_test_iam_permissions_rest_error(): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +def test_credentials_transport_error(): + # It is an error to provide credentials and a transport instance. + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # It is an error to provide a credentials file and a transport instance. + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = NetworkFirewallPoliciesClient( + client_options={"credentials_file": "credentials.json"}, + transport=transport, + ) + + # It is an error to provide an api_key and a transport instance. + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + options = client_options.ClientOptions() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = NetworkFirewallPoliciesClient( + client_options=options, + transport=transport, + ) + + # It is an error to provide an api_key and a credential. + options = mock.Mock() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = NetworkFirewallPoliciesClient( + client_options=options, credentials=ga_credentials.AnonymousCredentials() + ) + + # It is an error to provide scopes and a transport instance. + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = NetworkFirewallPoliciesClient( + client_options={"scopes": ["1", "2"]}, + transport=transport, + ) + + +def test_transport_instance(): + # A client may be instantiated with a custom transport instance. + transport = transports.NetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + client = NetworkFirewallPoliciesClient(transport=transport) + assert client.transport is transport + + +@pytest.mark.parametrize( + "transport_class", + [ + transports.NetworkFirewallPoliciesRestTransport, + ], +) +def test_transport_adc(transport_class): + # Test default credentials are used if not provided. + with mock.patch.object(google.auth, "default") as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + transport_class() + adc.assert_called_once() + + +def test_network_firewall_policies_base_transport_error(): + # Passing both a credentials object and credentials_file should raise an error + with pytest.raises(core_exceptions.DuplicateCredentialArgs): + transport = transports.NetworkFirewallPoliciesTransport( + credentials=ga_credentials.AnonymousCredentials(), + credentials_file="credentials.json", + ) + + +def test_network_firewall_policies_base_transport(): + # Instantiate the base transport. + with mock.patch( + "google.cloud.compute_v1.services.network_firewall_policies.transports.NetworkFirewallPoliciesTransport.__init__" + ) as Transport: + Transport.return_value = None + transport = transports.NetworkFirewallPoliciesTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Every method on the transport should just blindly + # raise NotImplementedError. + methods = ( + "add_association", + "add_rule", + "clone_rules", + "delete", + "get", + "get_association", + "get_iam_policy", + "get_rule", + "insert", + "list", + "patch", + "patch_rule", + "remove_association", + "remove_rule", + "set_iam_policy", + "test_iam_permissions", + ) + for method in methods: + with pytest.raises(NotImplementedError): + getattr(transport, method)(request=object()) + + with pytest.raises(NotImplementedError): + transport.close() + + +def test_network_firewall_policies_base_transport_with_credentials_file(): + # Instantiate the base transport with a credentials file + with mock.patch.object( + google.auth, "load_credentials_from_file", autospec=True + ) as load_creds, mock.patch( + "google.cloud.compute_v1.services.network_firewall_policies.transports.NetworkFirewallPoliciesTransport._prep_wrapped_messages" + ) as Transport: + Transport.return_value = None + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) + transport = transports.NetworkFirewallPoliciesTransport( + credentials_file="credentials.json", + quota_project_id="octopus", + ) + load_creds.assert_called_once_with( + "credentials.json", + scopes=None, + default_scopes=( + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/cloud-platform", + ), + quota_project_id="octopus", + ) + + +def test_network_firewall_policies_base_transport_with_adc(): + # Test the default credentials are used if credentials and credentials_file are None. + with mock.patch.object(google.auth, "default", autospec=True) as adc, mock.patch( + "google.cloud.compute_v1.services.network_firewall_policies.transports.NetworkFirewallPoliciesTransport._prep_wrapped_messages" + ) as Transport: + Transport.return_value = None + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + transport = transports.NetworkFirewallPoliciesTransport() + adc.assert_called_once() + + +def test_network_firewall_policies_auth_adc(): + # If no credentials are provided, we should use ADC credentials. + with mock.patch.object(google.auth, "default", autospec=True) as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + NetworkFirewallPoliciesClient() + adc.assert_called_once_with( + scopes=None, + default_scopes=( + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/cloud-platform", + ), + quota_project_id=None, + ) + + +def test_network_firewall_policies_http_transport_client_cert_source_for_mtls(): + cred = ga_credentials.AnonymousCredentials() + with mock.patch( + "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" + ) as mock_configure_mtls_channel: + transports.NetworkFirewallPoliciesRestTransport( + credentials=cred, client_cert_source_for_mtls=client_cert_source_callback + ) + mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) + + +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) +def test_network_firewall_policies_host_no_port(transport_name): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions( + api_endpoint="compute.googleapis.com" + ), + transport=transport_name, + ) + assert client.transport._host == ( + "compute.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://compute.googleapis.com" + ) + + +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) +def test_network_firewall_policies_host_with_port(transport_name): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions( + api_endpoint="compute.googleapis.com:8000" + ), + transport=transport_name, + ) + assert client.transport._host == ( + "compute.googleapis.com:8000" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://compute.googleapis.com:8000" + ) + + +def test_common_billing_account_path(): + billing_account = "squid" + expected = "billingAccounts/{billing_account}".format( + billing_account=billing_account, + ) + actual = NetworkFirewallPoliciesClient.common_billing_account_path(billing_account) + assert expected == actual + + +def test_parse_common_billing_account_path(): + expected = { + "billing_account": "clam", + } + path = NetworkFirewallPoliciesClient.common_billing_account_path(**expected) + + # Check that the path construction is reversible. + actual = NetworkFirewallPoliciesClient.parse_common_billing_account_path(path) + assert expected == actual + + +def test_common_folder_path(): + folder = "whelk" + expected = "folders/{folder}".format( + folder=folder, + ) + actual = NetworkFirewallPoliciesClient.common_folder_path(folder) + assert expected == actual + + +def test_parse_common_folder_path(): + expected = { + "folder": "octopus", + } + path = NetworkFirewallPoliciesClient.common_folder_path(**expected) + + # Check that the path construction is reversible. + actual = NetworkFirewallPoliciesClient.parse_common_folder_path(path) + assert expected == actual + + +def test_common_organization_path(): + organization = "oyster" + expected = "organizations/{organization}".format( + organization=organization, + ) + actual = NetworkFirewallPoliciesClient.common_organization_path(organization) + assert expected == actual + + +def test_parse_common_organization_path(): + expected = { + "organization": "nudibranch", + } + path = NetworkFirewallPoliciesClient.common_organization_path(**expected) + + # Check that the path construction is reversible. + actual = NetworkFirewallPoliciesClient.parse_common_organization_path(path) + assert expected == actual + + +def test_common_project_path(): + project = "cuttlefish" + expected = "projects/{project}".format( + project=project, + ) + actual = NetworkFirewallPoliciesClient.common_project_path(project) + assert expected == actual + + +def test_parse_common_project_path(): + expected = { + "project": "mussel", + } + path = NetworkFirewallPoliciesClient.common_project_path(**expected) + + # Check that the path construction is reversible. + actual = NetworkFirewallPoliciesClient.parse_common_project_path(path) + assert expected == actual + + +def test_common_location_path(): + project = "winkle" + location = "nautilus" + expected = "projects/{project}/locations/{location}".format( + project=project, + location=location, + ) + actual = NetworkFirewallPoliciesClient.common_location_path(project, location) + assert expected == actual + + +def test_parse_common_location_path(): + expected = { + "project": "scallop", + "location": "abalone", + } + path = NetworkFirewallPoliciesClient.common_location_path(**expected) + + # Check that the path construction is reversible. + actual = NetworkFirewallPoliciesClient.parse_common_location_path(path) + assert expected == actual + + +def test_client_with_default_client_info(): + client_info = gapic_v1.client_info.ClientInfo() + + with mock.patch.object( + transports.NetworkFirewallPoliciesTransport, "_prep_wrapped_messages" + ) as prep: + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, + ) + prep.assert_called_once_with(client_info) + + with mock.patch.object( + transports.NetworkFirewallPoliciesTransport, "_prep_wrapped_messages" + ) as prep: + transport_class = NetworkFirewallPoliciesClient.get_transport_class() + transport = transport_class( + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, + ) + prep.assert_called_once_with(client_info) + + +def test_transport_close(): + transports = { + "rest": "_session", + } + + for transport, close_name in transports.items(): + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport + ) + with mock.patch.object( + type(getattr(client.transport, close_name)), "close" + ) as close: + with client: + close.assert_not_called() + close.assert_called_once() + + +def test_client_ctx(): + transports = [ + "rest", + ] + for transport in transports: + client = NetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport + ) + # Test client calls underlying transport. + with mock.patch.object(type(client.transport), "close") as close: + close.assert_not_called() + with client: + pass + close.assert_called() + + +@pytest.mark.parametrize( + "client_class,transport_class", + [ + ( + NetworkFirewallPoliciesClient, + transports.NetworkFirewallPoliciesRestTransport, + ), + ], +) +def test_api_key_credentials(client_class, transport_class): + with mock.patch.object( + google.auth._default, "get_api_key_credentials", create=True + ) as get_api_key_credentials: + mock_cred = mock.Mock() + get_api_key_credentials.return_value = mock_cred + options = client_options.ClientOptions() + options.api_key = "api_key" + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=mock_cred, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) diff --git a/tests/unit/gapic/compute_v1/test_networks.py b/tests/unit/gapic/compute_v1/test_networks.py index 9b0abd0c3..c4dfe670c 100644 --- a/tests/unit/gapic/compute_v1/test_networks.py +++ b/tests/unit/gapic/compute_v1/test_networks.py @@ -101,9 +101,9 @@ def test_networks_client_from_service_account_info(client_class, transport_name) assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -156,9 +156,9 @@ def test_networks_client_from_service_account_file(client_class, transport_name) assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -1194,12 +1194,16 @@ def test_get_rest(request_type): auto_create_subnetworks=True, creation_timestamp="creation_timestamp_value", description="description_value", + enable_ula_internal_ipv6=True, gateway_i_pv4="gateway_i_pv4_value", id=205, + internal_ipv6_range="internal_ipv6_range_value", kind="kind_value", mtu=342, name="name_value", + network_firewall_policy_enforcement_order="network_firewall_policy_enforcement_order_value", self_link="self_link_value", + self_link_with_id="self_link_with_id_value", subnetworks=["subnetworks_value"], ) @@ -1217,12 +1221,19 @@ def test_get_rest(request_type): assert response.auto_create_subnetworks is True assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" + assert response.enable_ula_internal_ipv6 is True assert response.gateway_i_pv4 == "gateway_i_pv4_value" assert response.id == 205 + assert response.internal_ipv6_range == "internal_ipv6_range_value" assert response.kind == "kind_value" assert response.mtu == 342 assert response.name == "name_value" + assert ( + response.network_firewall_policy_enforcement_order + == "network_firewall_policy_enforcement_order_value" + ) assert response.self_link == "self_link_value" + assert response.self_link_with_id == "self_link_with_id_value" assert response.subnetworks == ["subnetworks_value"] @@ -1748,11 +1759,14 @@ def test_insert_unary_rest(request_type): "auto_create_subnetworks": True, "creation_timestamp": "creation_timestamp_value", "description": "description_value", + "enable_ula_internal_ipv6": True, "gateway_i_pv4": "gateway_i_pv4_value", "id": 205, + "internal_ipv6_range": "internal_ipv6_range_value", "kind": "kind_value", "mtu": 342, "name": "name_value", + "network_firewall_policy_enforcement_order": "network_firewall_policy_enforcement_order_value", "peerings": [ { "auto_create_routes": True, @@ -1770,6 +1784,7 @@ def test_insert_unary_rest(request_type): ], "routing_config": {"routing_mode": "routing_mode_value"}, "self_link": "self_link_value", + "self_link_with_id": "self_link_with_id_value", "subnetworks": ["subnetworks_value_1", "subnetworks_value_2"], } request = request_type(request_init) @@ -1990,11 +2005,14 @@ def test_insert_unary_rest_bad_request( "auto_create_subnetworks": True, "creation_timestamp": "creation_timestamp_value", "description": "description_value", + "enable_ula_internal_ipv6": True, "gateway_i_pv4": "gateway_i_pv4_value", "id": 205, + "internal_ipv6_range": "internal_ipv6_range_value", "kind": "kind_value", "mtu": 342, "name": "name_value", + "network_firewall_policy_enforcement_order": "network_firewall_policy_enforcement_order_value", "peerings": [ { "auto_create_routes": True, @@ -2012,6 +2030,7 @@ def test_insert_unary_rest_bad_request( ], "routing_config": {"routing_mode": "routing_mode_value"}, "self_link": "self_link_value", + "self_link_with_id": "self_link_with_id_value", "subnetworks": ["subnetworks_value_1", "subnetworks_value_2"], } request = request_type(request_init) @@ -2799,11 +2818,14 @@ def test_patch_unary_rest(request_type): "auto_create_subnetworks": True, "creation_timestamp": "creation_timestamp_value", "description": "description_value", + "enable_ula_internal_ipv6": True, "gateway_i_pv4": "gateway_i_pv4_value", "id": 205, + "internal_ipv6_range": "internal_ipv6_range_value", "kind": "kind_value", "mtu": 342, "name": "name_value", + "network_firewall_policy_enforcement_order": "network_firewall_policy_enforcement_order_value", "peerings": [ { "auto_create_routes": True, @@ -2821,6 +2843,7 @@ def test_patch_unary_rest(request_type): ], "routing_config": {"routing_mode": "routing_mode_value"}, "self_link": "self_link_value", + "self_link_with_id": "self_link_with_id_value", "subnetworks": ["subnetworks_value_1", "subnetworks_value_2"], } request = request_type(request_init) @@ -3046,11 +3069,14 @@ def test_patch_unary_rest_bad_request( "auto_create_subnetworks": True, "creation_timestamp": "creation_timestamp_value", "description": "description_value", + "enable_ula_internal_ipv6": True, "gateway_i_pv4": "gateway_i_pv4_value", "id": 205, + "internal_ipv6_range": "internal_ipv6_range_value", "kind": "kind_value", "mtu": 342, "name": "name_value", + "network_firewall_policy_enforcement_order": "network_firewall_policy_enforcement_order_value", "peerings": [ { "auto_create_routes": True, @@ -3068,6 +3094,7 @@ def test_patch_unary_rest_bad_request( ], "routing_config": {"routing_mode": "routing_mode_value"}, "self_link": "self_link_value", + "self_link_with_id": "self_link_with_id_value", "subnetworks": ["subnetworks_value_1", "subnetworks_value_2"], } request = request_type(request_init) diff --git a/tests/unit/gapic/compute_v1/test_node_groups.py b/tests/unit/gapic/compute_v1/test_node_groups.py index 946143c97..6d1be053f 100644 --- a/tests/unit/gapic/compute_v1/test_node_groups.py +++ b/tests/unit/gapic/compute_v1/test_node_groups.py @@ -103,9 +103,9 @@ def test_node_groups_client_from_service_account_info(client_class, transport_na assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -158,9 +158,9 @@ def test_node_groups_client_from_service_account_file(client_class, transport_na assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_node_templates.py b/tests/unit/gapic/compute_v1/test_node_templates.py index 024622509..f0531d7d9 100644 --- a/tests/unit/gapic/compute_v1/test_node_templates.py +++ b/tests/unit/gapic/compute_v1/test_node_templates.py @@ -106,9 +106,9 @@ def test_node_templates_client_from_service_account_info(client_class, transport assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -161,9 +161,9 @@ def test_node_templates_client_from_service_account_file(client_class, transport assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_node_types.py b/tests/unit/gapic/compute_v1/test_node_types.py index 6b761a88f..0b71b2fe5 100644 --- a/tests/unit/gapic/compute_v1/test_node_types.py +++ b/tests/unit/gapic/compute_v1/test_node_types.py @@ -101,9 +101,9 @@ def test_node_types_client_from_service_account_info(client_class, transport_nam assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -156,9 +156,9 @@ def test_node_types_client_from_service_account_file(client_class, transport_nam assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_packet_mirrorings.py b/tests/unit/gapic/compute_v1/test_packet_mirrorings.py index 710e25d90..80151400a 100644 --- a/tests/unit/gapic/compute_v1/test_packet_mirrorings.py +++ b/tests/unit/gapic/compute_v1/test_packet_mirrorings.py @@ -109,9 +109,9 @@ def test_packet_mirrorings_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -166,9 +166,9 @@ def test_packet_mirrorings_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_projects.py b/tests/unit/gapic/compute_v1/test_projects.py index cb82dc404..d62e29f39 100644 --- a/tests/unit/gapic/compute_v1/test_projects.py +++ b/tests/unit/gapic/compute_v1/test_projects.py @@ -101,9 +101,9 @@ def test_projects_client_from_service_account_info(client_class, transport_name) assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -156,9 +156,9 @@ def test_projects_client_from_service_account_file(client_class, transport_name) assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_public_advertised_prefixes.py b/tests/unit/gapic/compute_v1/test_public_advertised_prefixes.py index 7aa17a1e7..5c4a90d50 100644 --- a/tests/unit/gapic/compute_v1/test_public_advertised_prefixes.py +++ b/tests/unit/gapic/compute_v1/test_public_advertised_prefixes.py @@ -111,9 +111,9 @@ def test_public_advertised_prefixes_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -168,9 +168,9 @@ def test_public_advertised_prefixes_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_public_delegated_prefixes.py b/tests/unit/gapic/compute_v1/test_public_delegated_prefixes.py index b4b608c72..24808c89e 100644 --- a/tests/unit/gapic/compute_v1/test_public_delegated_prefixes.py +++ b/tests/unit/gapic/compute_v1/test_public_delegated_prefixes.py @@ -111,9 +111,9 @@ def test_public_delegated_prefixes_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -168,9 +168,9 @@ def test_public_delegated_prefixes_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_region_autoscalers.py b/tests/unit/gapic/compute_v1/test_region_autoscalers.py index 4c5718cfd..1d42f2dc7 100644 --- a/tests/unit/gapic/compute_v1/test_region_autoscalers.py +++ b/tests/unit/gapic/compute_v1/test_region_autoscalers.py @@ -109,9 +109,9 @@ def test_region_autoscalers_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -166,9 +166,9 @@ def test_region_autoscalers_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_region_backend_services.py b/tests/unit/gapic/compute_v1/test_region_backend_services.py index ea21ceb37..50b071919 100644 --- a/tests/unit/gapic/compute_v1/test_region_backend_services.py +++ b/tests/unit/gapic/compute_v1/test_region_backend_services.py @@ -111,9 +111,9 @@ def test_region_backend_services_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -168,9 +168,9 @@ def test_region_backend_services_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -1592,6 +1592,7 @@ def test_insert_unary_rest(request_type): "connection_draining": {"draining_timeout_sec": 2124}, "connection_tracking_policy": { "connection_persistence_on_unhealthy_backends": "connection_persistence_on_unhealthy_backends_value", + "enable_strong_affinity": True, "idle_timeout_sec": 1694, "tracking_mode": "tracking_mode_value", }, @@ -1632,6 +1633,12 @@ def test_insert_unary_rest(request_type): "id": 205, "kind": "kind_value", "load_balancing_scheme": "load_balancing_scheme_value", + "locality_lb_policies": [ + { + "custom_policy": {"data": "data_value", "name": "name_value"}, + "policy": {"name": "name_value"}, + } + ], "locality_lb_policy": "locality_lb_policy_value", "log_config": {"enable": True, "sample_rate": 0.1165}, "max_stream_duration": {}, @@ -1954,6 +1961,7 @@ def test_insert_unary_rest_bad_request( "connection_draining": {"draining_timeout_sec": 2124}, "connection_tracking_policy": { "connection_persistence_on_unhealthy_backends": "connection_persistence_on_unhealthy_backends_value", + "enable_strong_affinity": True, "idle_timeout_sec": 1694, "tracking_mode": "tracking_mode_value", }, @@ -1994,6 +2002,12 @@ def test_insert_unary_rest_bad_request( "id": 205, "kind": "kind_value", "load_balancing_scheme": "load_balancing_scheme_value", + "locality_lb_policies": [ + { + "custom_policy": {"data": "data_value", "name": "name_value"}, + "policy": {"name": "name_value"}, + } + ], "locality_lb_policy": "locality_lb_policy_value", "log_config": {"enable": True, "sample_rate": 0.1165}, "max_stream_duration": {}, @@ -2547,6 +2561,7 @@ def test_patch_unary_rest(request_type): "connection_draining": {"draining_timeout_sec": 2124}, "connection_tracking_policy": { "connection_persistence_on_unhealthy_backends": "connection_persistence_on_unhealthy_backends_value", + "enable_strong_affinity": True, "idle_timeout_sec": 1694, "tracking_mode": "tracking_mode_value", }, @@ -2587,6 +2602,12 @@ def test_patch_unary_rest(request_type): "id": 205, "kind": "kind_value", "load_balancing_scheme": "load_balancing_scheme_value", + "locality_lb_policies": [ + { + "custom_policy": {"data": "data_value", "name": "name_value"}, + "policy": {"name": "name_value"}, + } + ], "locality_lb_policy": "locality_lb_policy_value", "log_config": {"enable": True, "sample_rate": 0.1165}, "max_stream_duration": {}, @@ -2918,6 +2939,7 @@ def test_patch_unary_rest_bad_request( "connection_draining": {"draining_timeout_sec": 2124}, "connection_tracking_policy": { "connection_persistence_on_unhealthy_backends": "connection_persistence_on_unhealthy_backends_value", + "enable_strong_affinity": True, "idle_timeout_sec": 1694, "tracking_mode": "tracking_mode_value", }, @@ -2958,6 +2980,12 @@ def test_patch_unary_rest_bad_request( "id": 205, "kind": "kind_value", "load_balancing_scheme": "load_balancing_scheme_value", + "locality_lb_policies": [ + { + "custom_policy": {"data": "data_value", "name": "name_value"}, + "policy": {"name": "name_value"}, + } + ], "locality_lb_policy": "locality_lb_policy_value", "log_config": {"enable": True, "sample_rate": 0.1165}, "max_stream_duration": {}, @@ -3167,6 +3195,7 @@ def test_update_unary_rest(request_type): "connection_draining": {"draining_timeout_sec": 2124}, "connection_tracking_policy": { "connection_persistence_on_unhealthy_backends": "connection_persistence_on_unhealthy_backends_value", + "enable_strong_affinity": True, "idle_timeout_sec": 1694, "tracking_mode": "tracking_mode_value", }, @@ -3207,6 +3236,12 @@ def test_update_unary_rest(request_type): "id": 205, "kind": "kind_value", "load_balancing_scheme": "load_balancing_scheme_value", + "locality_lb_policies": [ + { + "custom_policy": {"data": "data_value", "name": "name_value"}, + "policy": {"name": "name_value"}, + } + ], "locality_lb_policy": "locality_lb_policy_value", "log_config": {"enable": True, "sample_rate": 0.1165}, "max_stream_duration": {}, @@ -3538,6 +3573,7 @@ def test_update_unary_rest_bad_request( "connection_draining": {"draining_timeout_sec": 2124}, "connection_tracking_policy": { "connection_persistence_on_unhealthy_backends": "connection_persistence_on_unhealthy_backends_value", + "enable_strong_affinity": True, "idle_timeout_sec": 1694, "tracking_mode": "tracking_mode_value", }, @@ -3578,6 +3614,12 @@ def test_update_unary_rest_bad_request( "id": 205, "kind": "kind_value", "load_balancing_scheme": "load_balancing_scheme_value", + "locality_lb_policies": [ + { + "custom_policy": {"data": "data_value", "name": "name_value"}, + "policy": {"name": "name_value"}, + } + ], "locality_lb_policy": "locality_lb_policy_value", "log_config": {"enable": True, "sample_rate": 0.1165}, "max_stream_duration": {}, diff --git a/tests/unit/gapic/compute_v1/test_region_commitments.py b/tests/unit/gapic/compute_v1/test_region_commitments.py index 119d9ce89..2a67fbc09 100644 --- a/tests/unit/gapic/compute_v1/test_region_commitments.py +++ b/tests/unit/gapic/compute_v1/test_region_commitments.py @@ -109,9 +109,9 @@ def test_region_commitments_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -166,9 +166,9 @@ def test_region_commitments_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -1242,6 +1242,7 @@ def test_insert_unary_rest(request_type): "self_link": "self_link_value", "share_settings": {"project_map": {}, "share_type": "share_type_value"}, "specific_reservation": { + "assured_count": 1407, "count": 553, "in_use_count": 1291, "instance_properties": { @@ -1527,6 +1528,7 @@ def test_insert_unary_rest_bad_request( "self_link": "self_link_value", "share_settings": {"project_map": {}, "share_type": "share_type_value"}, "specific_reservation": { + "assured_count": 1407, "count": 553, "in_use_count": 1291, "instance_properties": { @@ -2033,6 +2035,7 @@ def test_update_unary_rest(request_type): "self_link": "self_link_value", "share_settings": {"project_map": {}, "share_type": "share_type_value"}, "specific_reservation": { + "assured_count": 1407, "count": 553, "in_use_count": 1291, "instance_properties": { @@ -2335,6 +2338,7 @@ def test_update_unary_rest_bad_request( "self_link": "self_link_value", "share_settings": {"project_map": {}, "share_type": "share_type_value"}, "specific_reservation": { + "assured_count": 1407, "count": 553, "in_use_count": 1291, "instance_properties": { diff --git a/tests/unit/gapic/compute_v1/test_region_disk_types.py b/tests/unit/gapic/compute_v1/test_region_disk_types.py index 4e5535b2d..514755885 100644 --- a/tests/unit/gapic/compute_v1/test_region_disk_types.py +++ b/tests/unit/gapic/compute_v1/test_region_disk_types.py @@ -108,9 +108,9 @@ def test_region_disk_types_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -165,9 +165,9 @@ def test_region_disk_types_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_region_disks.py b/tests/unit/gapic/compute_v1/test_region_disks.py index 4889dead0..3bbce144f 100644 --- a/tests/unit/gapic/compute_v1/test_region_disks.py +++ b/tests/unit/gapic/compute_v1/test_region_disks.py @@ -103,9 +103,9 @@ def test_region_disks_client_from_service_account_info(client_class, transport_n assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -158,9 +158,9 @@ def test_region_disks_client_from_service_account_file(client_class, transport_n assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_region_health_check_services.py b/tests/unit/gapic/compute_v1/test_region_health_check_services.py index 42728e1dc..090195bae 100644 --- a/tests/unit/gapic/compute_v1/test_region_health_check_services.py +++ b/tests/unit/gapic/compute_v1/test_region_health_check_services.py @@ -113,9 +113,9 @@ def test_region_health_check_services_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -170,9 +170,9 @@ def test_region_health_check_services_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_region_health_checks.py b/tests/unit/gapic/compute_v1/test_region_health_checks.py index cd6af12c4..f32742aec 100644 --- a/tests/unit/gapic/compute_v1/test_region_health_checks.py +++ b/tests/unit/gapic/compute_v1/test_region_health_checks.py @@ -111,9 +111,9 @@ def test_region_health_checks_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -168,9 +168,9 @@ def test_region_health_checks_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_region_instance_group_managers.py b/tests/unit/gapic/compute_v1/test_region_instance_group_managers.py index d8d80c824..1337bca92 100644 --- a/tests/unit/gapic/compute_v1/test_region_instance_group_managers.py +++ b/tests/unit/gapic/compute_v1/test_region_instance_group_managers.py @@ -113,9 +113,9 @@ def test_region_instance_group_managers_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -170,9 +170,9 @@ def test_region_instance_group_managers_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_region_instance_groups.py b/tests/unit/gapic/compute_v1/test_region_instance_groups.py index 3cb75b487..ccc74fbe1 100644 --- a/tests/unit/gapic/compute_v1/test_region_instance_groups.py +++ b/tests/unit/gapic/compute_v1/test_region_instance_groups.py @@ -111,9 +111,9 @@ def test_region_instance_groups_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -168,9 +168,9 @@ def test_region_instance_groups_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_region_instances.py b/tests/unit/gapic/compute_v1/test_region_instances.py index 9a5ccbe48..61e696f1e 100644 --- a/tests/unit/gapic/compute_v1/test_region_instances.py +++ b/tests/unit/gapic/compute_v1/test_region_instances.py @@ -107,9 +107,9 @@ def test_region_instances_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -164,9 +164,9 @@ def test_region_instances_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -642,6 +642,7 @@ def test_bulk_insert_unary_rest(request_type): } ], "fingerprint": "fingerprint_value", + "internal_ipv6_prefix_length": 2831, "ipv6_access_configs": {}, "ipv6_access_type": "ipv6_access_type_value", "ipv6_address": "ipv6_address_value", @@ -1022,6 +1023,7 @@ def test_bulk_insert_unary_rest_bad_request( } ], "fingerprint": "fingerprint_value", + "internal_ipv6_prefix_length": 2831, "ipv6_access_configs": {}, "ipv6_access_type": "ipv6_access_type_value", "ipv6_address": "ipv6_address_value", diff --git a/tests/unit/gapic/compute_v1/test_region_network_endpoint_groups.py b/tests/unit/gapic/compute_v1/test_region_network_endpoint_groups.py index 3572f65a1..2420386ea 100644 --- a/tests/unit/gapic/compute_v1/test_region_network_endpoint_groups.py +++ b/tests/unit/gapic/compute_v1/test_region_network_endpoint_groups.py @@ -113,9 +113,9 @@ def test_region_network_endpoint_groups_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -170,9 +170,9 @@ def test_region_network_endpoint_groups_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_region_network_firewall_policies.py b/tests/unit/gapic/compute_v1/test_region_network_firewall_policies.py new file mode 100644 index 000000000..8a793d00c --- /dev/null +++ b/tests/unit/gapic/compute_v1/test_region_network_firewall_policies.py @@ -0,0 +1,7059 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +import os +import mock + +import grpc +from grpc.experimental import aio +from collections.abc import Iterable +import json +import math +import pytest +from proto.marshal.rules.dates import DurationRule, TimestampRule + +from requests import Response +from requests import Request, PreparedRequest +from requests.sessions import Session + +from google.api_core import client_options +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers +from google.api_core import grpc_helpers_async +from google.api_core import path_template +from google.auth import credentials as ga_credentials +from google.auth.exceptions import MutualTLSChannelError +from google.cloud.compute_v1.services.region_network_firewall_policies import ( + RegionNetworkFirewallPoliciesClient, +) +from google.cloud.compute_v1.services.region_network_firewall_policies import pagers +from google.cloud.compute_v1.services.region_network_firewall_policies import transports +from google.cloud.compute_v1.types import compute +from google.oauth2 import service_account +import google.auth + + +def client_cert_source_callback(): + return b"cert bytes", b"key bytes" + + +# If default endpoint is localhost, then default mtls endpoint will be the same. +# This method modifies the default endpoint so the client can produce a different +# mtls endpoint for endpoint testing purposes. +def modify_default_endpoint(client): + return ( + "foo.googleapis.com" + if ("localhost" in client.DEFAULT_ENDPOINT) + else client.DEFAULT_ENDPOINT + ) + + +def test__get_default_mtls_endpoint(): + api_endpoint = "example.googleapis.com" + api_mtls_endpoint = "example.mtls.googleapis.com" + sandbox_endpoint = "example.sandbox.googleapis.com" + sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" + non_googleapi = "api.example.com" + + assert RegionNetworkFirewallPoliciesClient._get_default_mtls_endpoint(None) is None + assert ( + RegionNetworkFirewallPoliciesClient._get_default_mtls_endpoint(api_endpoint) + == api_mtls_endpoint + ) + assert ( + RegionNetworkFirewallPoliciesClient._get_default_mtls_endpoint( + api_mtls_endpoint + ) + == api_mtls_endpoint + ) + assert ( + RegionNetworkFirewallPoliciesClient._get_default_mtls_endpoint(sandbox_endpoint) + == sandbox_mtls_endpoint + ) + assert ( + RegionNetworkFirewallPoliciesClient._get_default_mtls_endpoint( + sandbox_mtls_endpoint + ) + == sandbox_mtls_endpoint + ) + assert ( + RegionNetworkFirewallPoliciesClient._get_default_mtls_endpoint(non_googleapi) + == non_googleapi + ) + + +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (RegionNetworkFirewallPoliciesClient, "rest"), + ], +) +def test_region_network_firewall_policies_client_from_service_account_info( + client_class, transport_name +): + creds = ga_credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = client_class.from_service_account_info(info, transport=transport_name) + assert client.transport._credentials == creds + assert isinstance(client, client_class) + + assert client.transport._host == ( + "compute.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://compute.googleapis.com" + ) + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [ + (transports.RegionNetworkFirewallPoliciesRestTransport, "rest"), + ], +) +def test_region_network_firewall_policies_client_service_account_always_use_jwt( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) + + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (RegionNetworkFirewallPoliciesClient, "rest"), + ], +) +def test_region_network_firewall_policies_client_from_service_account_file( + client_class, transport_name +): + creds = ga_credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_file" + ) as factory: + factory.return_value = creds + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) + assert client.transport._credentials == creds + assert isinstance(client, client_class) + + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) + assert client.transport._credentials == creds + assert isinstance(client, client_class) + + assert client.transport._host == ( + "compute.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://compute.googleapis.com" + ) + + +def test_region_network_firewall_policies_client_get_transport_class(): + transport = RegionNetworkFirewallPoliciesClient.get_transport_class() + available_transports = [ + transports.RegionNetworkFirewallPoliciesRestTransport, + ] + assert transport in available_transports + + transport = RegionNetworkFirewallPoliciesClient.get_transport_class("rest") + assert transport == transports.RegionNetworkFirewallPoliciesRestTransport + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name", + [ + ( + RegionNetworkFirewallPoliciesClient, + transports.RegionNetworkFirewallPoliciesRestTransport, + "rest", + ), + ], +) +@mock.patch.object( + RegionNetworkFirewallPoliciesClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(RegionNetworkFirewallPoliciesClient), +) +def test_region_network_firewall_policies_client_client_options( + client_class, transport_class, transport_name +): + # Check that if channel is provided we won't create a new one. + with mock.patch.object( + RegionNetworkFirewallPoliciesClient, "get_transport_class" + ) as gtc: + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) + client = client_class(transport=transport) + gtc.assert_not_called() + + # Check that if channel is provided via str we will create a new one. + with mock.patch.object( + RegionNetworkFirewallPoliciesClient, "get_transport_class" + ) as gtc: + client = client_class(transport=transport_name) + gtc.assert_called() + + # Check the case api_endpoint is provided. + options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(transport=transport_name, client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host="squid.clam.whelk", + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is + # "never". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is + # "always". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_MTLS_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has + # unsupported value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): + with pytest.raises(MutualTLSChannelError): + client = client_class(transport=transport_name) + + # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"} + ): + with pytest.raises(ValueError): + client = client_class(transport=transport_name) + + # Check the case quota_project_id is provided + options = client_options.ClientOptions(quota_project_id="octopus") + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id="octopus", + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name,use_client_cert_env", + [ + ( + RegionNetworkFirewallPoliciesClient, + transports.RegionNetworkFirewallPoliciesRestTransport, + "rest", + "true", + ), + ( + RegionNetworkFirewallPoliciesClient, + transports.RegionNetworkFirewallPoliciesRestTransport, + "rest", + "false", + ), + ], +) +@mock.patch.object( + RegionNetworkFirewallPoliciesClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(RegionNetworkFirewallPoliciesClient), +) +@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}) +def test_region_network_firewall_policies_client_mtls_env_auto( + client_class, transport_class, transport_name, use_client_cert_env +): + # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default + # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists. + + # Check the case client_cert_source is provided. Whether client cert is used depends on + # GOOGLE_API_USE_CLIENT_CERTIFICATE value. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + options = client_options.ClientOptions( + client_cert_source=client_cert_source_callback + ) + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + + if use_client_cert_env == "false": + expected_client_cert_source = None + expected_host = client.DEFAULT_ENDPOINT + else: + expected_client_cert_source = client_cert_source_callback + expected_host = client.DEFAULT_MTLS_ENDPOINT + + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + # Check the case ADC client cert is provided. Whether client cert is used depends on + # GOOGLE_API_USE_CLIENT_CERTIFICATE value. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + with mock.patch.object(transport_class, "__init__") as patched: + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, + ): + with mock.patch( + "google.auth.transport.mtls.default_client_cert_source", + return_value=client_cert_source_callback, + ): + if use_client_cert_env == "false": + expected_host = client.DEFAULT_ENDPOINT + expected_client_cert_source = None + else: + expected_host = client.DEFAULT_MTLS_ENDPOINT + expected_client_cert_source = client_cert_source_callback + + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + # Check the case client_cert_source and ADC client cert are not provided. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + with mock.patch.object(transport_class, "__init__") as patched: + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=False, + ): + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + +@pytest.mark.parametrize("client_class", [RegionNetworkFirewallPoliciesClient]) +@mock.patch.object( + RegionNetworkFirewallPoliciesClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(RegionNetworkFirewallPoliciesClient), +) +def test_region_network_firewall_policies_client_get_mtls_endpoint_and_cert_source( + client_class, +): + mock_client_cert_source = mock.Mock() + + # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "true". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + mock_api_endpoint = "foo" + options = client_options.ClientOptions( + client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint + ) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( + options + ) + assert api_endpoint == mock_api_endpoint + assert cert_source == mock_client_cert_source + + # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "false". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): + mock_client_cert_source = mock.Mock() + mock_api_endpoint = "foo" + options = client_options.ClientOptions( + client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint + ) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( + options + ) + assert api_endpoint == mock_api_endpoint + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "never". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "always". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert doesn't exist. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=False, + ): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert exists. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, + ): + with mock.patch( + "google.auth.transport.mtls.default_client_cert_source", + return_value=mock_client_cert_source, + ): + ( + api_endpoint, + cert_source, + ) = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + assert cert_source == mock_client_cert_source + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name", + [ + ( + RegionNetworkFirewallPoliciesClient, + transports.RegionNetworkFirewallPoliciesRestTransport, + "rest", + ), + ], +) +def test_region_network_firewall_policies_client_client_options_scopes( + client_class, transport_class, transport_name +): + # Check the case scopes are provided. + options = client_options.ClientOptions( + scopes=["1", "2"], + ) + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=["1", "2"], + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name,grpc_helpers", + [ + ( + RegionNetworkFirewallPoliciesClient, + transports.RegionNetworkFirewallPoliciesRestTransport, + "rest", + None, + ), + ], +) +def test_region_network_firewall_policies_client_client_options_credentials_file( + client_class, transport_class, transport_name, grpc_helpers +): + # Check the case credentials file is provided. + options = client_options.ClientOptions(credentials_file="credentials.json") + + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.AddAssociationRegionNetworkFirewallPolicyRequest, + dict, + ], +) +def test_add_association_unary_rest(request_type): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = { + "project": "sample1", + "region": "sample2", + "firewall_policy": "sample3", + } + request_init["firewall_policy_association_resource"] = { + "attachment_target": "attachment_target_value", + "display_name": "display_name_value", + "firewall_policy_id": "firewall_policy_id_value", + "name": "name_value", + "short_name": "short_name_value", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation( + client_operation_id="client_operation_id_value", + creation_timestamp="creation_timestamp_value", + description="description_value", + end_time="end_time_value", + http_error_message="http_error_message_value", + http_error_status_code=2374, + id=205, + insert_time="insert_time_value", + kind="kind_value", + name="name_value", + operation_group_id="operation_group_id_value", + operation_type="operation_type_value", + progress=885, + region="region_value", + self_link="self_link_value", + start_time="start_time_value", + status=compute.Operation.Status.DONE, + status_message="status_message_value", + target_id=947, + target_link="target_link_value", + user="user_value", + zone="zone_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.add_association_unary(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.Operation) + assert response.client_operation_id == "client_operation_id_value" + assert response.creation_timestamp == "creation_timestamp_value" + assert response.description == "description_value" + assert response.end_time == "end_time_value" + assert response.http_error_message == "http_error_message_value" + assert response.http_error_status_code == 2374 + assert response.id == 205 + assert response.insert_time == "insert_time_value" + assert response.kind == "kind_value" + assert response.name == "name_value" + assert response.operation_group_id == "operation_group_id_value" + assert response.operation_type == "operation_type_value" + assert response.progress == 885 + assert response.region == "region_value" + assert response.self_link == "self_link_value" + assert response.start_time == "start_time_value" + assert response.status == compute.Operation.Status.DONE + assert response.status_message == "status_message_value" + assert response.target_id == 947 + assert response.target_link == "target_link_value" + assert response.user == "user_value" + assert response.zone == "zone_value" + + +def test_add_association_unary_rest_required_fields( + request_type=compute.AddAssociationRegionNetworkFirewallPolicyRequest, +): + transport_class = transports.RegionNetworkFirewallPoliciesRestTransport + + request_init = {} + request_init["firewall_policy"] = "" + request_init["project"] = "" + request_init["region"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).add_association._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["firewallPolicy"] = "firewall_policy_value" + jsonified_request["project"] = "project_value" + jsonified_request["region"] = "region_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).add_association._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set( + ( + "replace_existing_association", + "request_id", + ) + ) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "firewallPolicy" in jsonified_request + assert jsonified_request["firewallPolicy"] == "firewall_policy_value" + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + assert "region" in jsonified_request + assert jsonified_request["region"] == "region_value" + + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "post", + "query_params": request_init, + } + transcode_result["body"] = {} + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.add_association_unary(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_add_association_unary_rest_unset_required_fields(): + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.add_association._get_unset_required_fields({}) + assert set(unset_fields) == ( + set( + ( + "replaceExistingAssociation", + "requestId", + ) + ) + & set( + ( + "firewallPolicy", + "firewallPolicyAssociationResource", + "project", + "region", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_add_association_unary_rest_interceptors(null_interceptor): + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.RegionNetworkFirewallPoliciesRestInterceptor(), + ) + client = RegionNetworkFirewallPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.RegionNetworkFirewallPoliciesRestInterceptor, "post_add_association" + ) as post, mock.patch.object( + transports.RegionNetworkFirewallPoliciesRestInterceptor, "pre_add_association" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.Operation.to_json(compute.Operation()) + + request = compute.AddAssociationRegionNetworkFirewallPolicyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.Operation + + client.add_association_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_add_association_unary_rest_bad_request( + transport: str = "rest", + request_type=compute.AddAssociationRegionNetworkFirewallPolicyRequest, +): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = { + "project": "sample1", + "region": "sample2", + "firewall_policy": "sample3", + } + request_init["firewall_policy_association_resource"] = { + "attachment_target": "attachment_target_value", + "display_name": "display_name_value", + "firewall_policy_id": "firewall_policy_id_value", + "name": "name_value", + "short_name": "short_name_value", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.add_association_unary(request) + + +def test_add_association_unary_rest_flattened(): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = { + "project": "sample1", + "region": "sample2", + "firewall_policy": "sample3", + } + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + region="region_value", + firewall_policy="firewall_policy_value", + firewall_policy_association_resource=compute.FirewallPolicyAssociation( + attachment_target="attachment_target_value" + ), + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.add_association_unary(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/regions/{region}/firewallPolicies/{firewall_policy}/addAssociation" + % client.transport._host, + args[1], + ) + + +def test_add_association_unary_rest_flattened_error(transport: str = "rest"): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.add_association_unary( + compute.AddAssociationRegionNetworkFirewallPolicyRequest(), + project="project_value", + region="region_value", + firewall_policy="firewall_policy_value", + firewall_policy_association_resource=compute.FirewallPolicyAssociation( + attachment_target="attachment_target_value" + ), + ) + + +def test_add_association_unary_rest_error(): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.AddRuleRegionNetworkFirewallPolicyRequest, + dict, + ], +) +def test_add_rule_unary_rest(request_type): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = { + "project": "sample1", + "region": "sample2", + "firewall_policy": "sample3", + } + request_init["firewall_policy_rule_resource"] = { + "action": "action_value", + "description": "description_value", + "direction": "direction_value", + "disabled": True, + "enable_logging": True, + "kind": "kind_value", + "match": { + "dest_ip_ranges": ["dest_ip_ranges_value_1", "dest_ip_ranges_value_2"], + "layer4_configs": [ + { + "ip_protocol": "ip_protocol_value", + "ports": ["ports_value_1", "ports_value_2"], + } + ], + "src_ip_ranges": ["src_ip_ranges_value_1", "src_ip_ranges_value_2"], + "src_secure_tags": [{"name": "name_value", "state": "state_value"}], + }, + "priority": 898, + "rule_name": "rule_name_value", + "rule_tuple_count": 1737, + "target_resources": ["target_resources_value_1", "target_resources_value_2"], + "target_secure_tags": {}, + "target_service_accounts": [ + "target_service_accounts_value_1", + "target_service_accounts_value_2", + ], + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation( + client_operation_id="client_operation_id_value", + creation_timestamp="creation_timestamp_value", + description="description_value", + end_time="end_time_value", + http_error_message="http_error_message_value", + http_error_status_code=2374, + id=205, + insert_time="insert_time_value", + kind="kind_value", + name="name_value", + operation_group_id="operation_group_id_value", + operation_type="operation_type_value", + progress=885, + region="region_value", + self_link="self_link_value", + start_time="start_time_value", + status=compute.Operation.Status.DONE, + status_message="status_message_value", + target_id=947, + target_link="target_link_value", + user="user_value", + zone="zone_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.add_rule_unary(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.Operation) + assert response.client_operation_id == "client_operation_id_value" + assert response.creation_timestamp == "creation_timestamp_value" + assert response.description == "description_value" + assert response.end_time == "end_time_value" + assert response.http_error_message == "http_error_message_value" + assert response.http_error_status_code == 2374 + assert response.id == 205 + assert response.insert_time == "insert_time_value" + assert response.kind == "kind_value" + assert response.name == "name_value" + assert response.operation_group_id == "operation_group_id_value" + assert response.operation_type == "operation_type_value" + assert response.progress == 885 + assert response.region == "region_value" + assert response.self_link == "self_link_value" + assert response.start_time == "start_time_value" + assert response.status == compute.Operation.Status.DONE + assert response.status_message == "status_message_value" + assert response.target_id == 947 + assert response.target_link == "target_link_value" + assert response.user == "user_value" + assert response.zone == "zone_value" + + +def test_add_rule_unary_rest_required_fields( + request_type=compute.AddRuleRegionNetworkFirewallPolicyRequest, +): + transport_class = transports.RegionNetworkFirewallPoliciesRestTransport + + request_init = {} + request_init["firewall_policy"] = "" + request_init["project"] = "" + request_init["region"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).add_rule._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["firewallPolicy"] = "firewall_policy_value" + jsonified_request["project"] = "project_value" + jsonified_request["region"] = "region_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).add_rule._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set( + ( + "max_priority", + "min_priority", + "request_id", + ) + ) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "firewallPolicy" in jsonified_request + assert jsonified_request["firewallPolicy"] == "firewall_policy_value" + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + assert "region" in jsonified_request + assert jsonified_request["region"] == "region_value" + + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "post", + "query_params": request_init, + } + transcode_result["body"] = {} + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.add_rule_unary(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_add_rule_unary_rest_unset_required_fields(): + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.add_rule._get_unset_required_fields({}) + assert set(unset_fields) == ( + set( + ( + "maxPriority", + "minPriority", + "requestId", + ) + ) + & set( + ( + "firewallPolicy", + "firewallPolicyRuleResource", + "project", + "region", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_add_rule_unary_rest_interceptors(null_interceptor): + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.RegionNetworkFirewallPoliciesRestInterceptor(), + ) + client = RegionNetworkFirewallPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.RegionNetworkFirewallPoliciesRestInterceptor, "post_add_rule" + ) as post, mock.patch.object( + transports.RegionNetworkFirewallPoliciesRestInterceptor, "pre_add_rule" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.Operation.to_json(compute.Operation()) + + request = compute.AddRuleRegionNetworkFirewallPolicyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.Operation + + client.add_rule_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_add_rule_unary_rest_bad_request( + transport: str = "rest", + request_type=compute.AddRuleRegionNetworkFirewallPolicyRequest, +): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = { + "project": "sample1", + "region": "sample2", + "firewall_policy": "sample3", + } + request_init["firewall_policy_rule_resource"] = { + "action": "action_value", + "description": "description_value", + "direction": "direction_value", + "disabled": True, + "enable_logging": True, + "kind": "kind_value", + "match": { + "dest_ip_ranges": ["dest_ip_ranges_value_1", "dest_ip_ranges_value_2"], + "layer4_configs": [ + { + "ip_protocol": "ip_protocol_value", + "ports": ["ports_value_1", "ports_value_2"], + } + ], + "src_ip_ranges": ["src_ip_ranges_value_1", "src_ip_ranges_value_2"], + "src_secure_tags": [{"name": "name_value", "state": "state_value"}], + }, + "priority": 898, + "rule_name": "rule_name_value", + "rule_tuple_count": 1737, + "target_resources": ["target_resources_value_1", "target_resources_value_2"], + "target_secure_tags": {}, + "target_service_accounts": [ + "target_service_accounts_value_1", + "target_service_accounts_value_2", + ], + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.add_rule_unary(request) + + +def test_add_rule_unary_rest_flattened(): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = { + "project": "sample1", + "region": "sample2", + "firewall_policy": "sample3", + } + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + region="region_value", + firewall_policy="firewall_policy_value", + firewall_policy_rule_resource=compute.FirewallPolicyRule( + action="action_value" + ), + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.add_rule_unary(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/regions/{region}/firewallPolicies/{firewall_policy}/addRule" + % client.transport._host, + args[1], + ) + + +def test_add_rule_unary_rest_flattened_error(transport: str = "rest"): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.add_rule_unary( + compute.AddRuleRegionNetworkFirewallPolicyRequest(), + project="project_value", + region="region_value", + firewall_policy="firewall_policy_value", + firewall_policy_rule_resource=compute.FirewallPolicyRule( + action="action_value" + ), + ) + + +def test_add_rule_unary_rest_error(): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.CloneRulesRegionNetworkFirewallPolicyRequest, + dict, + ], +) +def test_clone_rules_unary_rest(request_type): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = { + "project": "sample1", + "region": "sample2", + "firewall_policy": "sample3", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation( + client_operation_id="client_operation_id_value", + creation_timestamp="creation_timestamp_value", + description="description_value", + end_time="end_time_value", + http_error_message="http_error_message_value", + http_error_status_code=2374, + id=205, + insert_time="insert_time_value", + kind="kind_value", + name="name_value", + operation_group_id="operation_group_id_value", + operation_type="operation_type_value", + progress=885, + region="region_value", + self_link="self_link_value", + start_time="start_time_value", + status=compute.Operation.Status.DONE, + status_message="status_message_value", + target_id=947, + target_link="target_link_value", + user="user_value", + zone="zone_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.clone_rules_unary(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.Operation) + assert response.client_operation_id == "client_operation_id_value" + assert response.creation_timestamp == "creation_timestamp_value" + assert response.description == "description_value" + assert response.end_time == "end_time_value" + assert response.http_error_message == "http_error_message_value" + assert response.http_error_status_code == 2374 + assert response.id == 205 + assert response.insert_time == "insert_time_value" + assert response.kind == "kind_value" + assert response.name == "name_value" + assert response.operation_group_id == "operation_group_id_value" + assert response.operation_type == "operation_type_value" + assert response.progress == 885 + assert response.region == "region_value" + assert response.self_link == "self_link_value" + assert response.start_time == "start_time_value" + assert response.status == compute.Operation.Status.DONE + assert response.status_message == "status_message_value" + assert response.target_id == 947 + assert response.target_link == "target_link_value" + assert response.user == "user_value" + assert response.zone == "zone_value" + + +def test_clone_rules_unary_rest_required_fields( + request_type=compute.CloneRulesRegionNetworkFirewallPolicyRequest, +): + transport_class = transports.RegionNetworkFirewallPoliciesRestTransport + + request_init = {} + request_init["firewall_policy"] = "" + request_init["project"] = "" + request_init["region"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).clone_rules._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["firewallPolicy"] = "firewall_policy_value" + jsonified_request["project"] = "project_value" + jsonified_request["region"] = "region_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).clone_rules._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set( + ( + "request_id", + "source_firewall_policy", + ) + ) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "firewallPolicy" in jsonified_request + assert jsonified_request["firewallPolicy"] == "firewall_policy_value" + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + assert "region" in jsonified_request + assert jsonified_request["region"] == "region_value" + + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "post", + "query_params": request_init, + } + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.clone_rules_unary(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_clone_rules_unary_rest_unset_required_fields(): + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.clone_rules._get_unset_required_fields({}) + assert set(unset_fields) == ( + set( + ( + "requestId", + "sourceFirewallPolicy", + ) + ) + & set( + ( + "firewallPolicy", + "project", + "region", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_clone_rules_unary_rest_interceptors(null_interceptor): + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.RegionNetworkFirewallPoliciesRestInterceptor(), + ) + client = RegionNetworkFirewallPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.RegionNetworkFirewallPoliciesRestInterceptor, "post_clone_rules" + ) as post, mock.patch.object( + transports.RegionNetworkFirewallPoliciesRestInterceptor, "pre_clone_rules" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.Operation.to_json(compute.Operation()) + + request = compute.CloneRulesRegionNetworkFirewallPolicyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.Operation + + client.clone_rules_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_clone_rules_unary_rest_bad_request( + transport: str = "rest", + request_type=compute.CloneRulesRegionNetworkFirewallPolicyRequest, +): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = { + "project": "sample1", + "region": "sample2", + "firewall_policy": "sample3", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.clone_rules_unary(request) + + +def test_clone_rules_unary_rest_flattened(): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = { + "project": "sample1", + "region": "sample2", + "firewall_policy": "sample3", + } + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + region="region_value", + firewall_policy="firewall_policy_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.clone_rules_unary(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/regions/{region}/firewallPolicies/{firewall_policy}/cloneRules" + % client.transport._host, + args[1], + ) + + +def test_clone_rules_unary_rest_flattened_error(transport: str = "rest"): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.clone_rules_unary( + compute.CloneRulesRegionNetworkFirewallPolicyRequest(), + project="project_value", + region="region_value", + firewall_policy="firewall_policy_value", + ) + + +def test_clone_rules_unary_rest_error(): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteRegionNetworkFirewallPolicyRequest, + dict, + ], +) +def test_delete_unary_rest(request_type): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = { + "project": "sample1", + "region": "sample2", + "firewall_policy": "sample3", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation( + client_operation_id="client_operation_id_value", + creation_timestamp="creation_timestamp_value", + description="description_value", + end_time="end_time_value", + http_error_message="http_error_message_value", + http_error_status_code=2374, + id=205, + insert_time="insert_time_value", + kind="kind_value", + name="name_value", + operation_group_id="operation_group_id_value", + operation_type="operation_type_value", + progress=885, + region="region_value", + self_link="self_link_value", + start_time="start_time_value", + status=compute.Operation.Status.DONE, + status_message="status_message_value", + target_id=947, + target_link="target_link_value", + user="user_value", + zone="zone_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.delete_unary(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.Operation) + assert response.client_operation_id == "client_operation_id_value" + assert response.creation_timestamp == "creation_timestamp_value" + assert response.description == "description_value" + assert response.end_time == "end_time_value" + assert response.http_error_message == "http_error_message_value" + assert response.http_error_status_code == 2374 + assert response.id == 205 + assert response.insert_time == "insert_time_value" + assert response.kind == "kind_value" + assert response.name == "name_value" + assert response.operation_group_id == "operation_group_id_value" + assert response.operation_type == "operation_type_value" + assert response.progress == 885 + assert response.region == "region_value" + assert response.self_link == "self_link_value" + assert response.start_time == "start_time_value" + assert response.status == compute.Operation.Status.DONE + assert response.status_message == "status_message_value" + assert response.target_id == 947 + assert response.target_link == "target_link_value" + assert response.user == "user_value" + assert response.zone == "zone_value" + + +def test_delete_unary_rest_required_fields( + request_type=compute.DeleteRegionNetworkFirewallPolicyRequest, +): + transport_class = transports.RegionNetworkFirewallPoliciesRestTransport + + request_init = {} + request_init["firewall_policy"] = "" + request_init["project"] = "" + request_init["region"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).delete._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["firewallPolicy"] = "firewall_policy_value" + jsonified_request["project"] = "project_value" + jsonified_request["region"] = "region_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).delete._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set(("request_id",)) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "firewallPolicy" in jsonified_request + assert jsonified_request["firewallPolicy"] == "firewall_policy_value" + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + assert "region" in jsonified_request + assert jsonified_request["region"] == "region_value" + + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "delete", + "query_params": request_init, + } + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.delete_unary(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_delete_unary_rest_unset_required_fields(): + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.delete._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(("requestId",)) + & set( + ( + "firewallPolicy", + "project", + "region", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_delete_unary_rest_interceptors(null_interceptor): + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.RegionNetworkFirewallPoliciesRestInterceptor(), + ) + client = RegionNetworkFirewallPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.RegionNetworkFirewallPoliciesRestInterceptor, "post_delete" + ) as post, mock.patch.object( + transports.RegionNetworkFirewallPoliciesRestInterceptor, "pre_delete" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.Operation.to_json(compute.Operation()) + + request = compute.DeleteRegionNetworkFirewallPolicyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.Operation + + client.delete_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_delete_unary_rest_bad_request( + transport: str = "rest", + request_type=compute.DeleteRegionNetworkFirewallPolicyRequest, +): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = { + "project": "sample1", + "region": "sample2", + "firewall_policy": "sample3", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.delete_unary(request) + + +def test_delete_unary_rest_flattened(): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = { + "project": "sample1", + "region": "sample2", + "firewall_policy": "sample3", + } + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + region="region_value", + firewall_policy="firewall_policy_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.delete_unary(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/regions/{region}/firewallPolicies/{firewall_policy}" + % client.transport._host, + args[1], + ) + + +def test_delete_unary_rest_flattened_error(transport: str = "rest"): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.delete_unary( + compute.DeleteRegionNetworkFirewallPolicyRequest(), + project="project_value", + region="region_value", + firewall_policy="firewall_policy_value", + ) + + +def test_delete_unary_rest_error(): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.GetRegionNetworkFirewallPolicyRequest, + dict, + ], +) +def test_get_rest(request_type): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = { + "project": "sample1", + "region": "sample2", + "firewall_policy": "sample3", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.FirewallPolicy( + creation_timestamp="creation_timestamp_value", + description="description_value", + display_name="display_name_value", + fingerprint="fingerprint_value", + id=205, + kind="kind_value", + name="name_value", + parent="parent_value", + region="region_value", + rule_tuple_count=1737, + self_link="self_link_value", + self_link_with_id="self_link_with_id_value", + short_name="short_name_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.FirewallPolicy.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.get(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.FirewallPolicy) + assert response.creation_timestamp == "creation_timestamp_value" + assert response.description == "description_value" + assert response.display_name == "display_name_value" + assert response.fingerprint == "fingerprint_value" + assert response.id == 205 + assert response.kind == "kind_value" + assert response.name == "name_value" + assert response.parent == "parent_value" + assert response.region == "region_value" + assert response.rule_tuple_count == 1737 + assert response.self_link == "self_link_value" + assert response.self_link_with_id == "self_link_with_id_value" + assert response.short_name == "short_name_value" + + +def test_get_rest_required_fields( + request_type=compute.GetRegionNetworkFirewallPolicyRequest, +): + transport_class = transports.RegionNetworkFirewallPoliciesRestTransport + + request_init = {} + request_init["firewall_policy"] = "" + request_init["project"] = "" + request_init["region"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).get._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["firewallPolicy"] = "firewall_policy_value" + jsonified_request["project"] = "project_value" + jsonified_request["region"] = "region_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).get._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "firewallPolicy" in jsonified_request + assert jsonified_request["firewallPolicy"] == "firewall_policy_value" + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + assert "region" in jsonified_request + assert jsonified_request["region"] == "region_value" + + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.FirewallPolicy() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "get", + "query_params": request_init, + } + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.FirewallPolicy.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.get(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_get_rest_unset_required_fields(): + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.get._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(()) + & set( + ( + "firewallPolicy", + "project", + "region", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_get_rest_interceptors(null_interceptor): + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.RegionNetworkFirewallPoliciesRestInterceptor(), + ) + client = RegionNetworkFirewallPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.RegionNetworkFirewallPoliciesRestInterceptor, "post_get" + ) as post, mock.patch.object( + transports.RegionNetworkFirewallPoliciesRestInterceptor, "pre_get" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.FirewallPolicy.to_json( + compute.FirewallPolicy() + ) + + request = compute.GetRegionNetworkFirewallPolicyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.FirewallPolicy + + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_get_rest_bad_request( + transport: str = "rest", request_type=compute.GetRegionNetworkFirewallPolicyRequest +): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = { + "project": "sample1", + "region": "sample2", + "firewall_policy": "sample3", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.get(request) + + +def test_get_rest_flattened(): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.FirewallPolicy() + + # get arguments that satisfy an http rule for this method + sample_request = { + "project": "sample1", + "region": "sample2", + "firewall_policy": "sample3", + } + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + region="region_value", + firewall_policy="firewall_policy_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.FirewallPolicy.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.get(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/regions/{region}/firewallPolicies/{firewall_policy}" + % client.transport._host, + args[1], + ) + + +def test_get_rest_flattened_error(transport: str = "rest"): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get( + compute.GetRegionNetworkFirewallPolicyRequest(), + project="project_value", + region="region_value", + firewall_policy="firewall_policy_value", + ) + + +def test_get_rest_error(): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.GetAssociationRegionNetworkFirewallPolicyRequest, + dict, + ], +) +def test_get_association_rest(request_type): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = { + "project": "sample1", + "region": "sample2", + "firewall_policy": "sample3", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.FirewallPolicyAssociation( + attachment_target="attachment_target_value", + display_name="display_name_value", + firewall_policy_id="firewall_policy_id_value", + name="name_value", + short_name="short_name_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.FirewallPolicyAssociation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.get_association(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.FirewallPolicyAssociation) + assert response.attachment_target == "attachment_target_value" + assert response.display_name == "display_name_value" + assert response.firewall_policy_id == "firewall_policy_id_value" + assert response.name == "name_value" + assert response.short_name == "short_name_value" + + +def test_get_association_rest_required_fields( + request_type=compute.GetAssociationRegionNetworkFirewallPolicyRequest, +): + transport_class = transports.RegionNetworkFirewallPoliciesRestTransport + + request_init = {} + request_init["firewall_policy"] = "" + request_init["project"] = "" + request_init["region"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).get_association._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["firewallPolicy"] = "firewall_policy_value" + jsonified_request["project"] = "project_value" + jsonified_request["region"] = "region_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).get_association._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set(("name",)) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "firewallPolicy" in jsonified_request + assert jsonified_request["firewallPolicy"] == "firewall_policy_value" + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + assert "region" in jsonified_request + assert jsonified_request["region"] == "region_value" + + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.FirewallPolicyAssociation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "get", + "query_params": request_init, + } + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.FirewallPolicyAssociation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.get_association(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_get_association_rest_unset_required_fields(): + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.get_association._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(("name",)) + & set( + ( + "firewallPolicy", + "project", + "region", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_get_association_rest_interceptors(null_interceptor): + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.RegionNetworkFirewallPoliciesRestInterceptor(), + ) + client = RegionNetworkFirewallPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.RegionNetworkFirewallPoliciesRestInterceptor, "post_get_association" + ) as post, mock.patch.object( + transports.RegionNetworkFirewallPoliciesRestInterceptor, "pre_get_association" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.FirewallPolicyAssociation.to_json( + compute.FirewallPolicyAssociation() + ) + + request = compute.GetAssociationRegionNetworkFirewallPolicyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.FirewallPolicyAssociation + + client.get_association( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_get_association_rest_bad_request( + transport: str = "rest", + request_type=compute.GetAssociationRegionNetworkFirewallPolicyRequest, +): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = { + "project": "sample1", + "region": "sample2", + "firewall_policy": "sample3", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.get_association(request) + + +def test_get_association_rest_flattened(): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.FirewallPolicyAssociation() + + # get arguments that satisfy an http rule for this method + sample_request = { + "project": "sample1", + "region": "sample2", + "firewall_policy": "sample3", + } + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + region="region_value", + firewall_policy="firewall_policy_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.FirewallPolicyAssociation.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.get_association(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/regions/{region}/firewallPolicies/{firewall_policy}/getAssociation" + % client.transport._host, + args[1], + ) + + +def test_get_association_rest_flattened_error(transport: str = "rest"): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_association( + compute.GetAssociationRegionNetworkFirewallPolicyRequest(), + project="project_value", + region="region_value", + firewall_policy="firewall_policy_value", + ) + + +def test_get_association_rest_error(): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest, + dict, + ], +) +def test_get_effective_firewalls_rest(request_type): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "region": "sample2"} + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = ( + compute.RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse() + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = ( + compute.RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse.to_json( + return_value + ) + ) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.get_effective_firewalls(request) + + # Establish that the response is the type that we expect. + assert isinstance( + response, compute.RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse + ) + + +def test_get_effective_firewalls_rest_required_fields( + request_type=compute.GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest, +): + transport_class = transports.RegionNetworkFirewallPoliciesRestTransport + + request_init = {} + request_init["network"] = "" + request_init["project"] = "" + request_init["region"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + assert "network" not in jsonified_request + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).get_effective_firewalls._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + assert "network" in jsonified_request + assert jsonified_request["network"] == request_init["network"] + + jsonified_request["network"] = "network_value" + jsonified_request["project"] = "project_value" + jsonified_request["region"] = "region_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).get_effective_firewalls._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set(("network",)) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "network" in jsonified_request + assert jsonified_request["network"] == "network_value" + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + assert "region" in jsonified_request + assert jsonified_request["region"] == "region_value" + + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "get", + "query_params": request_init, + } + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse.to_json( + return_value + ) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.get_effective_firewalls(request) + + expected_params = [ + ( + "network", + "", + ), + ] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_get_effective_firewalls_rest_unset_required_fields(): + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.get_effective_firewalls._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(("network",)) + & set( + ( + "network", + "project", + "region", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_get_effective_firewalls_rest_interceptors(null_interceptor): + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.RegionNetworkFirewallPoliciesRestInterceptor(), + ) + client = RegionNetworkFirewallPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.RegionNetworkFirewallPoliciesRestInterceptor, + "post_get_effective_firewalls", + ) as post, mock.patch.object( + transports.RegionNetworkFirewallPoliciesRestInterceptor, + "pre_get_effective_firewalls", + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = ( + compute.RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse.to_json( + compute.RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse() + ) + ) + + request = compute.GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = ( + compute.RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse + ) + + client.get_effective_firewalls( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_get_effective_firewalls_rest_bad_request( + transport: str = "rest", + request_type=compute.GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest, +): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "region": "sample2"} + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.get_effective_firewalls(request) + + +def test_get_effective_firewalls_rest_flattened(): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = ( + compute.RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse() + ) + + # get arguments that satisfy an http rule for this method + sample_request = {"project": "sample1", "region": "sample2"} + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + region="region_value", + network="network_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = ( + compute.RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse.to_json( + return_value + ) + ) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.get_effective_firewalls(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/regions/{region}/firewallPolicies/getEffectiveFirewalls" + % client.transport._host, + args[1], + ) + + +def test_get_effective_firewalls_rest_flattened_error(transport: str = "rest"): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_effective_firewalls( + compute.GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest(), + project="project_value", + region="region_value", + network="network_value", + ) + + +def test_get_effective_firewalls_rest_error(): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.GetIamPolicyRegionNetworkFirewallPolicyRequest, + dict, + ], +) +def test_get_iam_policy_rest(request_type): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "region": "sample2", "resource": "sample3"} + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Policy( + etag="etag_value", + iam_owned=True, + version=774, + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Policy.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.get_iam_policy(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.Policy) + assert response.etag == "etag_value" + assert response.iam_owned is True + assert response.version == 774 + + +def test_get_iam_policy_rest_required_fields( + request_type=compute.GetIamPolicyRegionNetworkFirewallPolicyRequest, +): + transport_class = transports.RegionNetworkFirewallPoliciesRestTransport + + request_init = {} + request_init["project"] = "" + request_init["region"] = "" + request_init["resource"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).get_iam_policy._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["project"] = "project_value" + jsonified_request["region"] = "region_value" + jsonified_request["resource"] = "resource_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).get_iam_policy._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set(("options_requested_policy_version",)) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + assert "region" in jsonified_request + assert jsonified_request["region"] == "region_value" + assert "resource" in jsonified_request + assert jsonified_request["resource"] == "resource_value" + + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.Policy() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "get", + "query_params": request_init, + } + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Policy.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.get_iam_policy(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_get_iam_policy_rest_unset_required_fields(): + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.get_iam_policy._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(("optionsRequestedPolicyVersion",)) + & set( + ( + "project", + "region", + "resource", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_get_iam_policy_rest_interceptors(null_interceptor): + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.RegionNetworkFirewallPoliciesRestInterceptor(), + ) + client = RegionNetworkFirewallPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.RegionNetworkFirewallPoliciesRestInterceptor, "post_get_iam_policy" + ) as post, mock.patch.object( + transports.RegionNetworkFirewallPoliciesRestInterceptor, "pre_get_iam_policy" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.Policy.to_json(compute.Policy()) + + request = compute.GetIamPolicyRegionNetworkFirewallPolicyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.Policy + + client.get_iam_policy( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_get_iam_policy_rest_bad_request( + transport: str = "rest", + request_type=compute.GetIamPolicyRegionNetworkFirewallPolicyRequest, +): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "region": "sample2", "resource": "sample3"} + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.get_iam_policy(request) + + +def test_get_iam_policy_rest_flattened(): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Policy() + + # get arguments that satisfy an http rule for this method + sample_request = { + "project": "sample1", + "region": "sample2", + "resource": "sample3", + } + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + region="region_value", + resource="resource_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Policy.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.get_iam_policy(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/regions/{region}/firewallPolicies/{resource}/getIamPolicy" + % client.transport._host, + args[1], + ) + + +def test_get_iam_policy_rest_flattened_error(transport: str = "rest"): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_iam_policy( + compute.GetIamPolicyRegionNetworkFirewallPolicyRequest(), + project="project_value", + region="region_value", + resource="resource_value", + ) + + +def test_get_iam_policy_rest_error(): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.GetRuleRegionNetworkFirewallPolicyRequest, + dict, + ], +) +def test_get_rule_rest(request_type): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = { + "project": "sample1", + "region": "sample2", + "firewall_policy": "sample3", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.FirewallPolicyRule( + action="action_value", + description="description_value", + direction="direction_value", + disabled=True, + enable_logging=True, + kind="kind_value", + priority=898, + rule_name="rule_name_value", + rule_tuple_count=1737, + target_resources=["target_resources_value"], + target_service_accounts=["target_service_accounts_value"], + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.FirewallPolicyRule.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.get_rule(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.FirewallPolicyRule) + assert response.action == "action_value" + assert response.description == "description_value" + assert response.direction == "direction_value" + assert response.disabled is True + assert response.enable_logging is True + assert response.kind == "kind_value" + assert response.priority == 898 + assert response.rule_name == "rule_name_value" + assert response.rule_tuple_count == 1737 + assert response.target_resources == ["target_resources_value"] + assert response.target_service_accounts == ["target_service_accounts_value"] + + +def test_get_rule_rest_required_fields( + request_type=compute.GetRuleRegionNetworkFirewallPolicyRequest, +): + transport_class = transports.RegionNetworkFirewallPoliciesRestTransport + + request_init = {} + request_init["firewall_policy"] = "" + request_init["project"] = "" + request_init["region"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).get_rule._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["firewallPolicy"] = "firewall_policy_value" + jsonified_request["project"] = "project_value" + jsonified_request["region"] = "region_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).get_rule._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set(("priority",)) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "firewallPolicy" in jsonified_request + assert jsonified_request["firewallPolicy"] == "firewall_policy_value" + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + assert "region" in jsonified_request + assert jsonified_request["region"] == "region_value" + + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.FirewallPolicyRule() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "get", + "query_params": request_init, + } + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.FirewallPolicyRule.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.get_rule(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_get_rule_rest_unset_required_fields(): + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.get_rule._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(("priority",)) + & set( + ( + "firewallPolicy", + "project", + "region", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_get_rule_rest_interceptors(null_interceptor): + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.RegionNetworkFirewallPoliciesRestInterceptor(), + ) + client = RegionNetworkFirewallPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.RegionNetworkFirewallPoliciesRestInterceptor, "post_get_rule" + ) as post, mock.patch.object( + transports.RegionNetworkFirewallPoliciesRestInterceptor, "pre_get_rule" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.FirewallPolicyRule.to_json( + compute.FirewallPolicyRule() + ) + + request = compute.GetRuleRegionNetworkFirewallPolicyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.FirewallPolicyRule + + client.get_rule( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_get_rule_rest_bad_request( + transport: str = "rest", + request_type=compute.GetRuleRegionNetworkFirewallPolicyRequest, +): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = { + "project": "sample1", + "region": "sample2", + "firewall_policy": "sample3", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.get_rule(request) + + +def test_get_rule_rest_flattened(): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.FirewallPolicyRule() + + # get arguments that satisfy an http rule for this method + sample_request = { + "project": "sample1", + "region": "sample2", + "firewall_policy": "sample3", + } + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + region="region_value", + firewall_policy="firewall_policy_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.FirewallPolicyRule.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.get_rule(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/regions/{region}/firewallPolicies/{firewall_policy}/getRule" + % client.transport._host, + args[1], + ) + + +def test_get_rule_rest_flattened_error(transport: str = "rest"): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_rule( + compute.GetRuleRegionNetworkFirewallPolicyRequest(), + project="project_value", + region="region_value", + firewall_policy="firewall_policy_value", + ) + + +def test_get_rule_rest_error(): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertRegionNetworkFirewallPolicyRequest, + dict, + ], +) +def test_insert_unary_rest(request_type): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "region": "sample2"} + request_init["firewall_policy_resource"] = { + "associations": [ + { + "attachment_target": "attachment_target_value", + "display_name": "display_name_value", + "firewall_policy_id": "firewall_policy_id_value", + "name": "name_value", + "short_name": "short_name_value", + } + ], + "creation_timestamp": "creation_timestamp_value", + "description": "description_value", + "display_name": "display_name_value", + "fingerprint": "fingerprint_value", + "id": 205, + "kind": "kind_value", + "name": "name_value", + "parent": "parent_value", + "region": "region_value", + "rule_tuple_count": 1737, + "rules": [ + { + "action": "action_value", + "description": "description_value", + "direction": "direction_value", + "disabled": True, + "enable_logging": True, + "kind": "kind_value", + "match": { + "dest_ip_ranges": [ + "dest_ip_ranges_value_1", + "dest_ip_ranges_value_2", + ], + "layer4_configs": [ + { + "ip_protocol": "ip_protocol_value", + "ports": ["ports_value_1", "ports_value_2"], + } + ], + "src_ip_ranges": ["src_ip_ranges_value_1", "src_ip_ranges_value_2"], + "src_secure_tags": [{"name": "name_value", "state": "state_value"}], + }, + "priority": 898, + "rule_name": "rule_name_value", + "rule_tuple_count": 1737, + "target_resources": [ + "target_resources_value_1", + "target_resources_value_2", + ], + "target_secure_tags": {}, + "target_service_accounts": [ + "target_service_accounts_value_1", + "target_service_accounts_value_2", + ], + } + ], + "self_link": "self_link_value", + "self_link_with_id": "self_link_with_id_value", + "short_name": "short_name_value", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation( + client_operation_id="client_operation_id_value", + creation_timestamp="creation_timestamp_value", + description="description_value", + end_time="end_time_value", + http_error_message="http_error_message_value", + http_error_status_code=2374, + id=205, + insert_time="insert_time_value", + kind="kind_value", + name="name_value", + operation_group_id="operation_group_id_value", + operation_type="operation_type_value", + progress=885, + region="region_value", + self_link="self_link_value", + start_time="start_time_value", + status=compute.Operation.Status.DONE, + status_message="status_message_value", + target_id=947, + target_link="target_link_value", + user="user_value", + zone="zone_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.insert_unary(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.Operation) + assert response.client_operation_id == "client_operation_id_value" + assert response.creation_timestamp == "creation_timestamp_value" + assert response.description == "description_value" + assert response.end_time == "end_time_value" + assert response.http_error_message == "http_error_message_value" + assert response.http_error_status_code == 2374 + assert response.id == 205 + assert response.insert_time == "insert_time_value" + assert response.kind == "kind_value" + assert response.name == "name_value" + assert response.operation_group_id == "operation_group_id_value" + assert response.operation_type == "operation_type_value" + assert response.progress == 885 + assert response.region == "region_value" + assert response.self_link == "self_link_value" + assert response.start_time == "start_time_value" + assert response.status == compute.Operation.Status.DONE + assert response.status_message == "status_message_value" + assert response.target_id == 947 + assert response.target_link == "target_link_value" + assert response.user == "user_value" + assert response.zone == "zone_value" + + +def test_insert_unary_rest_required_fields( + request_type=compute.InsertRegionNetworkFirewallPolicyRequest, +): + transport_class = transports.RegionNetworkFirewallPoliciesRestTransport + + request_init = {} + request_init["project"] = "" + request_init["region"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).insert._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["project"] = "project_value" + jsonified_request["region"] = "region_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).insert._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set(("request_id",)) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + assert "region" in jsonified_request + assert jsonified_request["region"] == "region_value" + + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "post", + "query_params": request_init, + } + transcode_result["body"] = {} + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.insert_unary(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_insert_unary_rest_unset_required_fields(): + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.insert._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(("requestId",)) + & set( + ( + "firewallPolicyResource", + "project", + "region", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_insert_unary_rest_interceptors(null_interceptor): + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.RegionNetworkFirewallPoliciesRestInterceptor(), + ) + client = RegionNetworkFirewallPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.RegionNetworkFirewallPoliciesRestInterceptor, "post_insert" + ) as post, mock.patch.object( + transports.RegionNetworkFirewallPoliciesRestInterceptor, "pre_insert" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.Operation.to_json(compute.Operation()) + + request = compute.InsertRegionNetworkFirewallPolicyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.Operation + + client.insert_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_insert_unary_rest_bad_request( + transport: str = "rest", + request_type=compute.InsertRegionNetworkFirewallPolicyRequest, +): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "region": "sample2"} + request_init["firewall_policy_resource"] = { + "associations": [ + { + "attachment_target": "attachment_target_value", + "display_name": "display_name_value", + "firewall_policy_id": "firewall_policy_id_value", + "name": "name_value", + "short_name": "short_name_value", + } + ], + "creation_timestamp": "creation_timestamp_value", + "description": "description_value", + "display_name": "display_name_value", + "fingerprint": "fingerprint_value", + "id": 205, + "kind": "kind_value", + "name": "name_value", + "parent": "parent_value", + "region": "region_value", + "rule_tuple_count": 1737, + "rules": [ + { + "action": "action_value", + "description": "description_value", + "direction": "direction_value", + "disabled": True, + "enable_logging": True, + "kind": "kind_value", + "match": { + "dest_ip_ranges": [ + "dest_ip_ranges_value_1", + "dest_ip_ranges_value_2", + ], + "layer4_configs": [ + { + "ip_protocol": "ip_protocol_value", + "ports": ["ports_value_1", "ports_value_2"], + } + ], + "src_ip_ranges": ["src_ip_ranges_value_1", "src_ip_ranges_value_2"], + "src_secure_tags": [{"name": "name_value", "state": "state_value"}], + }, + "priority": 898, + "rule_name": "rule_name_value", + "rule_tuple_count": 1737, + "target_resources": [ + "target_resources_value_1", + "target_resources_value_2", + ], + "target_secure_tags": {}, + "target_service_accounts": [ + "target_service_accounts_value_1", + "target_service_accounts_value_2", + ], + } + ], + "self_link": "self_link_value", + "self_link_with_id": "self_link_with_id_value", + "short_name": "short_name_value", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.insert_unary(request) + + +def test_insert_unary_rest_flattened(): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = {"project": "sample1", "region": "sample2"} + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + region="region_value", + firewall_policy_resource=compute.FirewallPolicy( + associations=[ + compute.FirewallPolicyAssociation( + attachment_target="attachment_target_value" + ) + ] + ), + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.insert_unary(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/regions/{region}/firewallPolicies" + % client.transport._host, + args[1], + ) + + +def test_insert_unary_rest_flattened_error(transport: str = "rest"): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.insert_unary( + compute.InsertRegionNetworkFirewallPolicyRequest(), + project="project_value", + region="region_value", + firewall_policy_resource=compute.FirewallPolicy( + associations=[ + compute.FirewallPolicyAssociation( + attachment_target="attachment_target_value" + ) + ] + ), + ) + + +def test_insert_unary_rest_error(): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.ListRegionNetworkFirewallPoliciesRequest, + dict, + ], +) +def test_list_rest(request_type): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "region": "sample2"} + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.FirewallPolicyList( + id="id_value", + kind="kind_value", + next_page_token="next_page_token_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.FirewallPolicyList.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.list(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListPager) + assert response.id == "id_value" + assert response.kind == "kind_value" + assert response.next_page_token == "next_page_token_value" + + +def test_list_rest_required_fields( + request_type=compute.ListRegionNetworkFirewallPoliciesRequest, +): + transport_class = transports.RegionNetworkFirewallPoliciesRestTransport + + request_init = {} + request_init["project"] = "" + request_init["region"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).list._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["project"] = "project_value" + jsonified_request["region"] = "region_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).list._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set( + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) + ) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + assert "region" in jsonified_request + assert jsonified_request["region"] == "region_value" + + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.FirewallPolicyList() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "get", + "query_params": request_init, + } + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.FirewallPolicyList.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.list(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_list_rest_unset_required_fields(): + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.list._get_unset_required_fields({}) + assert set(unset_fields) == ( + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "region", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_list_rest_interceptors(null_interceptor): + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.RegionNetworkFirewallPoliciesRestInterceptor(), + ) + client = RegionNetworkFirewallPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.RegionNetworkFirewallPoliciesRestInterceptor, "post_list" + ) as post, mock.patch.object( + transports.RegionNetworkFirewallPoliciesRestInterceptor, "pre_list" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.FirewallPolicyList.to_json( + compute.FirewallPolicyList() + ) + + request = compute.ListRegionNetworkFirewallPoliciesRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.FirewallPolicyList + + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_list_rest_bad_request( + transport: str = "rest", + request_type=compute.ListRegionNetworkFirewallPoliciesRequest, +): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "region": "sample2"} + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.list(request) + + +def test_list_rest_flattened(): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.FirewallPolicyList() + + # get arguments that satisfy an http rule for this method + sample_request = {"project": "sample1", "region": "sample2"} + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + region="region_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.FirewallPolicyList.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.list(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/regions/{region}/firewallPolicies" + % client.transport._host, + args[1], + ) + + +def test_list_rest_flattened_error(transport: str = "rest"): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list( + compute.ListRegionNetworkFirewallPoliciesRequest(), + project="project_value", + region="region_value", + ) + + +def test_list_rest_pager(transport: str = "rest"): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # TODO(kbandes): remove this mock unless there's a good reason for it. + # with mock.patch.object(path_template, 'transcode') as transcode: + # Set the response as a series of pages + response = ( + compute.FirewallPolicyList( + items=[ + compute.FirewallPolicy(), + compute.FirewallPolicy(), + compute.FirewallPolicy(), + ], + next_page_token="abc", + ), + compute.FirewallPolicyList( + items=[], + next_page_token="def", + ), + compute.FirewallPolicyList( + items=[ + compute.FirewallPolicy(), + ], + next_page_token="ghi", + ), + compute.FirewallPolicyList( + items=[ + compute.FirewallPolicy(), + compute.FirewallPolicy(), + ], + ), + ) + # Two responses for two calls + response = response + response + + # Wrap the values into proper Response objs + response = tuple(compute.FirewallPolicyList.to_json(x) for x in response) + return_values = tuple(Response() for i in response) + for return_val, response_val in zip(return_values, response): + return_val._content = response_val.encode("UTF-8") + return_val.status_code = 200 + req.side_effect = return_values + + sample_request = {"project": "sample1", "region": "sample2"} + + pager = client.list(request=sample_request) + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, compute.FirewallPolicy) for i in results) + + pages = list(client.list(request=sample_request).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.parametrize( + "request_type", + [ + compute.PatchRegionNetworkFirewallPolicyRequest, + dict, + ], +) +def test_patch_unary_rest(request_type): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = { + "project": "sample1", + "region": "sample2", + "firewall_policy": "sample3", + } + request_init["firewall_policy_resource"] = { + "associations": [ + { + "attachment_target": "attachment_target_value", + "display_name": "display_name_value", + "firewall_policy_id": "firewall_policy_id_value", + "name": "name_value", + "short_name": "short_name_value", + } + ], + "creation_timestamp": "creation_timestamp_value", + "description": "description_value", + "display_name": "display_name_value", + "fingerprint": "fingerprint_value", + "id": 205, + "kind": "kind_value", + "name": "name_value", + "parent": "parent_value", + "region": "region_value", + "rule_tuple_count": 1737, + "rules": [ + { + "action": "action_value", + "description": "description_value", + "direction": "direction_value", + "disabled": True, + "enable_logging": True, + "kind": "kind_value", + "match": { + "dest_ip_ranges": [ + "dest_ip_ranges_value_1", + "dest_ip_ranges_value_2", + ], + "layer4_configs": [ + { + "ip_protocol": "ip_protocol_value", + "ports": ["ports_value_1", "ports_value_2"], + } + ], + "src_ip_ranges": ["src_ip_ranges_value_1", "src_ip_ranges_value_2"], + "src_secure_tags": [{"name": "name_value", "state": "state_value"}], + }, + "priority": 898, + "rule_name": "rule_name_value", + "rule_tuple_count": 1737, + "target_resources": [ + "target_resources_value_1", + "target_resources_value_2", + ], + "target_secure_tags": {}, + "target_service_accounts": [ + "target_service_accounts_value_1", + "target_service_accounts_value_2", + ], + } + ], + "self_link": "self_link_value", + "self_link_with_id": "self_link_with_id_value", + "short_name": "short_name_value", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation( + client_operation_id="client_operation_id_value", + creation_timestamp="creation_timestamp_value", + description="description_value", + end_time="end_time_value", + http_error_message="http_error_message_value", + http_error_status_code=2374, + id=205, + insert_time="insert_time_value", + kind="kind_value", + name="name_value", + operation_group_id="operation_group_id_value", + operation_type="operation_type_value", + progress=885, + region="region_value", + self_link="self_link_value", + start_time="start_time_value", + status=compute.Operation.Status.DONE, + status_message="status_message_value", + target_id=947, + target_link="target_link_value", + user="user_value", + zone="zone_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.patch_unary(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.Operation) + assert response.client_operation_id == "client_operation_id_value" + assert response.creation_timestamp == "creation_timestamp_value" + assert response.description == "description_value" + assert response.end_time == "end_time_value" + assert response.http_error_message == "http_error_message_value" + assert response.http_error_status_code == 2374 + assert response.id == 205 + assert response.insert_time == "insert_time_value" + assert response.kind == "kind_value" + assert response.name == "name_value" + assert response.operation_group_id == "operation_group_id_value" + assert response.operation_type == "operation_type_value" + assert response.progress == 885 + assert response.region == "region_value" + assert response.self_link == "self_link_value" + assert response.start_time == "start_time_value" + assert response.status == compute.Operation.Status.DONE + assert response.status_message == "status_message_value" + assert response.target_id == 947 + assert response.target_link == "target_link_value" + assert response.user == "user_value" + assert response.zone == "zone_value" + + +def test_patch_unary_rest_required_fields( + request_type=compute.PatchRegionNetworkFirewallPolicyRequest, +): + transport_class = transports.RegionNetworkFirewallPoliciesRestTransport + + request_init = {} + request_init["firewall_policy"] = "" + request_init["project"] = "" + request_init["region"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).patch._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["firewallPolicy"] = "firewall_policy_value" + jsonified_request["project"] = "project_value" + jsonified_request["region"] = "region_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).patch._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set(("request_id",)) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "firewallPolicy" in jsonified_request + assert jsonified_request["firewallPolicy"] == "firewall_policy_value" + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + assert "region" in jsonified_request + assert jsonified_request["region"] == "region_value" + + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "patch", + "query_params": request_init, + } + transcode_result["body"] = {} + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.patch_unary(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_patch_unary_rest_unset_required_fields(): + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.patch._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(("requestId",)) + & set( + ( + "firewallPolicy", + "firewallPolicyResource", + "project", + "region", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_patch_unary_rest_interceptors(null_interceptor): + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.RegionNetworkFirewallPoliciesRestInterceptor(), + ) + client = RegionNetworkFirewallPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.RegionNetworkFirewallPoliciesRestInterceptor, "post_patch" + ) as post, mock.patch.object( + transports.RegionNetworkFirewallPoliciesRestInterceptor, "pre_patch" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.Operation.to_json(compute.Operation()) + + request = compute.PatchRegionNetworkFirewallPolicyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.Operation + + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_patch_unary_rest_bad_request( + transport: str = "rest", + request_type=compute.PatchRegionNetworkFirewallPolicyRequest, +): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = { + "project": "sample1", + "region": "sample2", + "firewall_policy": "sample3", + } + request_init["firewall_policy_resource"] = { + "associations": [ + { + "attachment_target": "attachment_target_value", + "display_name": "display_name_value", + "firewall_policy_id": "firewall_policy_id_value", + "name": "name_value", + "short_name": "short_name_value", + } + ], + "creation_timestamp": "creation_timestamp_value", + "description": "description_value", + "display_name": "display_name_value", + "fingerprint": "fingerprint_value", + "id": 205, + "kind": "kind_value", + "name": "name_value", + "parent": "parent_value", + "region": "region_value", + "rule_tuple_count": 1737, + "rules": [ + { + "action": "action_value", + "description": "description_value", + "direction": "direction_value", + "disabled": True, + "enable_logging": True, + "kind": "kind_value", + "match": { + "dest_ip_ranges": [ + "dest_ip_ranges_value_1", + "dest_ip_ranges_value_2", + ], + "layer4_configs": [ + { + "ip_protocol": "ip_protocol_value", + "ports": ["ports_value_1", "ports_value_2"], + } + ], + "src_ip_ranges": ["src_ip_ranges_value_1", "src_ip_ranges_value_2"], + "src_secure_tags": [{"name": "name_value", "state": "state_value"}], + }, + "priority": 898, + "rule_name": "rule_name_value", + "rule_tuple_count": 1737, + "target_resources": [ + "target_resources_value_1", + "target_resources_value_2", + ], + "target_secure_tags": {}, + "target_service_accounts": [ + "target_service_accounts_value_1", + "target_service_accounts_value_2", + ], + } + ], + "self_link": "self_link_value", + "self_link_with_id": "self_link_with_id_value", + "short_name": "short_name_value", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.patch_unary(request) + + +def test_patch_unary_rest_flattened(): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = { + "project": "sample1", + "region": "sample2", + "firewall_policy": "sample3", + } + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + region="region_value", + firewall_policy="firewall_policy_value", + firewall_policy_resource=compute.FirewallPolicy( + associations=[ + compute.FirewallPolicyAssociation( + attachment_target="attachment_target_value" + ) + ] + ), + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.patch_unary(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/regions/{region}/firewallPolicies/{firewall_policy}" + % client.transport._host, + args[1], + ) + + +def test_patch_unary_rest_flattened_error(transport: str = "rest"): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.patch_unary( + compute.PatchRegionNetworkFirewallPolicyRequest(), + project="project_value", + region="region_value", + firewall_policy="firewall_policy_value", + firewall_policy_resource=compute.FirewallPolicy( + associations=[ + compute.FirewallPolicyAssociation( + attachment_target="attachment_target_value" + ) + ] + ), + ) + + +def test_patch_unary_rest_error(): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.PatchRuleRegionNetworkFirewallPolicyRequest, + dict, + ], +) +def test_patch_rule_unary_rest(request_type): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = { + "project": "sample1", + "region": "sample2", + "firewall_policy": "sample3", + } + request_init["firewall_policy_rule_resource"] = { + "action": "action_value", + "description": "description_value", + "direction": "direction_value", + "disabled": True, + "enable_logging": True, + "kind": "kind_value", + "match": { + "dest_ip_ranges": ["dest_ip_ranges_value_1", "dest_ip_ranges_value_2"], + "layer4_configs": [ + { + "ip_protocol": "ip_protocol_value", + "ports": ["ports_value_1", "ports_value_2"], + } + ], + "src_ip_ranges": ["src_ip_ranges_value_1", "src_ip_ranges_value_2"], + "src_secure_tags": [{"name": "name_value", "state": "state_value"}], + }, + "priority": 898, + "rule_name": "rule_name_value", + "rule_tuple_count": 1737, + "target_resources": ["target_resources_value_1", "target_resources_value_2"], + "target_secure_tags": {}, + "target_service_accounts": [ + "target_service_accounts_value_1", + "target_service_accounts_value_2", + ], + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation( + client_operation_id="client_operation_id_value", + creation_timestamp="creation_timestamp_value", + description="description_value", + end_time="end_time_value", + http_error_message="http_error_message_value", + http_error_status_code=2374, + id=205, + insert_time="insert_time_value", + kind="kind_value", + name="name_value", + operation_group_id="operation_group_id_value", + operation_type="operation_type_value", + progress=885, + region="region_value", + self_link="self_link_value", + start_time="start_time_value", + status=compute.Operation.Status.DONE, + status_message="status_message_value", + target_id=947, + target_link="target_link_value", + user="user_value", + zone="zone_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.patch_rule_unary(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.Operation) + assert response.client_operation_id == "client_operation_id_value" + assert response.creation_timestamp == "creation_timestamp_value" + assert response.description == "description_value" + assert response.end_time == "end_time_value" + assert response.http_error_message == "http_error_message_value" + assert response.http_error_status_code == 2374 + assert response.id == 205 + assert response.insert_time == "insert_time_value" + assert response.kind == "kind_value" + assert response.name == "name_value" + assert response.operation_group_id == "operation_group_id_value" + assert response.operation_type == "operation_type_value" + assert response.progress == 885 + assert response.region == "region_value" + assert response.self_link == "self_link_value" + assert response.start_time == "start_time_value" + assert response.status == compute.Operation.Status.DONE + assert response.status_message == "status_message_value" + assert response.target_id == 947 + assert response.target_link == "target_link_value" + assert response.user == "user_value" + assert response.zone == "zone_value" + + +def test_patch_rule_unary_rest_required_fields( + request_type=compute.PatchRuleRegionNetworkFirewallPolicyRequest, +): + transport_class = transports.RegionNetworkFirewallPoliciesRestTransport + + request_init = {} + request_init["firewall_policy"] = "" + request_init["project"] = "" + request_init["region"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).patch_rule._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["firewallPolicy"] = "firewall_policy_value" + jsonified_request["project"] = "project_value" + jsonified_request["region"] = "region_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).patch_rule._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set( + ( + "priority", + "request_id", + ) + ) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "firewallPolicy" in jsonified_request + assert jsonified_request["firewallPolicy"] == "firewall_policy_value" + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + assert "region" in jsonified_request + assert jsonified_request["region"] == "region_value" + + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "post", + "query_params": request_init, + } + transcode_result["body"] = {} + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.patch_rule_unary(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_patch_rule_unary_rest_unset_required_fields(): + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.patch_rule._get_unset_required_fields({}) + assert set(unset_fields) == ( + set( + ( + "priority", + "requestId", + ) + ) + & set( + ( + "firewallPolicy", + "firewallPolicyRuleResource", + "project", + "region", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_patch_rule_unary_rest_interceptors(null_interceptor): + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.RegionNetworkFirewallPoliciesRestInterceptor(), + ) + client = RegionNetworkFirewallPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.RegionNetworkFirewallPoliciesRestInterceptor, "post_patch_rule" + ) as post, mock.patch.object( + transports.RegionNetworkFirewallPoliciesRestInterceptor, "pre_patch_rule" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.Operation.to_json(compute.Operation()) + + request = compute.PatchRuleRegionNetworkFirewallPolicyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.Operation + + client.patch_rule_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_patch_rule_unary_rest_bad_request( + transport: str = "rest", + request_type=compute.PatchRuleRegionNetworkFirewallPolicyRequest, +): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = { + "project": "sample1", + "region": "sample2", + "firewall_policy": "sample3", + } + request_init["firewall_policy_rule_resource"] = { + "action": "action_value", + "description": "description_value", + "direction": "direction_value", + "disabled": True, + "enable_logging": True, + "kind": "kind_value", + "match": { + "dest_ip_ranges": ["dest_ip_ranges_value_1", "dest_ip_ranges_value_2"], + "layer4_configs": [ + { + "ip_protocol": "ip_protocol_value", + "ports": ["ports_value_1", "ports_value_2"], + } + ], + "src_ip_ranges": ["src_ip_ranges_value_1", "src_ip_ranges_value_2"], + "src_secure_tags": [{"name": "name_value", "state": "state_value"}], + }, + "priority": 898, + "rule_name": "rule_name_value", + "rule_tuple_count": 1737, + "target_resources": ["target_resources_value_1", "target_resources_value_2"], + "target_secure_tags": {}, + "target_service_accounts": [ + "target_service_accounts_value_1", + "target_service_accounts_value_2", + ], + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.patch_rule_unary(request) + + +def test_patch_rule_unary_rest_flattened(): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = { + "project": "sample1", + "region": "sample2", + "firewall_policy": "sample3", + } + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + region="region_value", + firewall_policy="firewall_policy_value", + firewall_policy_rule_resource=compute.FirewallPolicyRule( + action="action_value" + ), + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.patch_rule_unary(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/regions/{region}/firewallPolicies/{firewall_policy}/patchRule" + % client.transport._host, + args[1], + ) + + +def test_patch_rule_unary_rest_flattened_error(transport: str = "rest"): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.patch_rule_unary( + compute.PatchRuleRegionNetworkFirewallPolicyRequest(), + project="project_value", + region="region_value", + firewall_policy="firewall_policy_value", + firewall_policy_rule_resource=compute.FirewallPolicyRule( + action="action_value" + ), + ) + + +def test_patch_rule_unary_rest_error(): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.RemoveAssociationRegionNetworkFirewallPolicyRequest, + dict, + ], +) +def test_remove_association_unary_rest(request_type): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = { + "project": "sample1", + "region": "sample2", + "firewall_policy": "sample3", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation( + client_operation_id="client_operation_id_value", + creation_timestamp="creation_timestamp_value", + description="description_value", + end_time="end_time_value", + http_error_message="http_error_message_value", + http_error_status_code=2374, + id=205, + insert_time="insert_time_value", + kind="kind_value", + name="name_value", + operation_group_id="operation_group_id_value", + operation_type="operation_type_value", + progress=885, + region="region_value", + self_link="self_link_value", + start_time="start_time_value", + status=compute.Operation.Status.DONE, + status_message="status_message_value", + target_id=947, + target_link="target_link_value", + user="user_value", + zone="zone_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.remove_association_unary(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.Operation) + assert response.client_operation_id == "client_operation_id_value" + assert response.creation_timestamp == "creation_timestamp_value" + assert response.description == "description_value" + assert response.end_time == "end_time_value" + assert response.http_error_message == "http_error_message_value" + assert response.http_error_status_code == 2374 + assert response.id == 205 + assert response.insert_time == "insert_time_value" + assert response.kind == "kind_value" + assert response.name == "name_value" + assert response.operation_group_id == "operation_group_id_value" + assert response.operation_type == "operation_type_value" + assert response.progress == 885 + assert response.region == "region_value" + assert response.self_link == "self_link_value" + assert response.start_time == "start_time_value" + assert response.status == compute.Operation.Status.DONE + assert response.status_message == "status_message_value" + assert response.target_id == 947 + assert response.target_link == "target_link_value" + assert response.user == "user_value" + assert response.zone == "zone_value" + + +def test_remove_association_unary_rest_required_fields( + request_type=compute.RemoveAssociationRegionNetworkFirewallPolicyRequest, +): + transport_class = transports.RegionNetworkFirewallPoliciesRestTransport + + request_init = {} + request_init["firewall_policy"] = "" + request_init["project"] = "" + request_init["region"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).remove_association._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["firewallPolicy"] = "firewall_policy_value" + jsonified_request["project"] = "project_value" + jsonified_request["region"] = "region_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).remove_association._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set( + ( + "name", + "request_id", + ) + ) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "firewallPolicy" in jsonified_request + assert jsonified_request["firewallPolicy"] == "firewall_policy_value" + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + assert "region" in jsonified_request + assert jsonified_request["region"] == "region_value" + + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "post", + "query_params": request_init, + } + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.remove_association_unary(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_remove_association_unary_rest_unset_required_fields(): + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.remove_association._get_unset_required_fields({}) + assert set(unset_fields) == ( + set( + ( + "name", + "requestId", + ) + ) + & set( + ( + "firewallPolicy", + "project", + "region", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_remove_association_unary_rest_interceptors(null_interceptor): + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.RegionNetworkFirewallPoliciesRestInterceptor(), + ) + client = RegionNetworkFirewallPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.RegionNetworkFirewallPoliciesRestInterceptor, + "post_remove_association", + ) as post, mock.patch.object( + transports.RegionNetworkFirewallPoliciesRestInterceptor, + "pre_remove_association", + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.Operation.to_json(compute.Operation()) + + request = compute.RemoveAssociationRegionNetworkFirewallPolicyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.Operation + + client.remove_association_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_remove_association_unary_rest_bad_request( + transport: str = "rest", + request_type=compute.RemoveAssociationRegionNetworkFirewallPolicyRequest, +): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = { + "project": "sample1", + "region": "sample2", + "firewall_policy": "sample3", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.remove_association_unary(request) + + +def test_remove_association_unary_rest_flattened(): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = { + "project": "sample1", + "region": "sample2", + "firewall_policy": "sample3", + } + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + region="region_value", + firewall_policy="firewall_policy_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.remove_association_unary(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/regions/{region}/firewallPolicies/{firewall_policy}/removeAssociation" + % client.transport._host, + args[1], + ) + + +def test_remove_association_unary_rest_flattened_error(transport: str = "rest"): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.remove_association_unary( + compute.RemoveAssociationRegionNetworkFirewallPolicyRequest(), + project="project_value", + region="region_value", + firewall_policy="firewall_policy_value", + ) + + +def test_remove_association_unary_rest_error(): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.RemoveRuleRegionNetworkFirewallPolicyRequest, + dict, + ], +) +def test_remove_rule_unary_rest(request_type): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = { + "project": "sample1", + "region": "sample2", + "firewall_policy": "sample3", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation( + client_operation_id="client_operation_id_value", + creation_timestamp="creation_timestamp_value", + description="description_value", + end_time="end_time_value", + http_error_message="http_error_message_value", + http_error_status_code=2374, + id=205, + insert_time="insert_time_value", + kind="kind_value", + name="name_value", + operation_group_id="operation_group_id_value", + operation_type="operation_type_value", + progress=885, + region="region_value", + self_link="self_link_value", + start_time="start_time_value", + status=compute.Operation.Status.DONE, + status_message="status_message_value", + target_id=947, + target_link="target_link_value", + user="user_value", + zone="zone_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.remove_rule_unary(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.Operation) + assert response.client_operation_id == "client_operation_id_value" + assert response.creation_timestamp == "creation_timestamp_value" + assert response.description == "description_value" + assert response.end_time == "end_time_value" + assert response.http_error_message == "http_error_message_value" + assert response.http_error_status_code == 2374 + assert response.id == 205 + assert response.insert_time == "insert_time_value" + assert response.kind == "kind_value" + assert response.name == "name_value" + assert response.operation_group_id == "operation_group_id_value" + assert response.operation_type == "operation_type_value" + assert response.progress == 885 + assert response.region == "region_value" + assert response.self_link == "self_link_value" + assert response.start_time == "start_time_value" + assert response.status == compute.Operation.Status.DONE + assert response.status_message == "status_message_value" + assert response.target_id == 947 + assert response.target_link == "target_link_value" + assert response.user == "user_value" + assert response.zone == "zone_value" + + +def test_remove_rule_unary_rest_required_fields( + request_type=compute.RemoveRuleRegionNetworkFirewallPolicyRequest, +): + transport_class = transports.RegionNetworkFirewallPoliciesRestTransport + + request_init = {} + request_init["firewall_policy"] = "" + request_init["project"] = "" + request_init["region"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).remove_rule._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["firewallPolicy"] = "firewall_policy_value" + jsonified_request["project"] = "project_value" + jsonified_request["region"] = "region_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).remove_rule._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set( + ( + "priority", + "request_id", + ) + ) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "firewallPolicy" in jsonified_request + assert jsonified_request["firewallPolicy"] == "firewall_policy_value" + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + assert "region" in jsonified_request + assert jsonified_request["region"] == "region_value" + + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "post", + "query_params": request_init, + } + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.remove_rule_unary(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_remove_rule_unary_rest_unset_required_fields(): + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.remove_rule._get_unset_required_fields({}) + assert set(unset_fields) == ( + set( + ( + "priority", + "requestId", + ) + ) + & set( + ( + "firewallPolicy", + "project", + "region", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_remove_rule_unary_rest_interceptors(null_interceptor): + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.RegionNetworkFirewallPoliciesRestInterceptor(), + ) + client = RegionNetworkFirewallPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.RegionNetworkFirewallPoliciesRestInterceptor, "post_remove_rule" + ) as post, mock.patch.object( + transports.RegionNetworkFirewallPoliciesRestInterceptor, "pre_remove_rule" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.Operation.to_json(compute.Operation()) + + request = compute.RemoveRuleRegionNetworkFirewallPolicyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.Operation + + client.remove_rule_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_remove_rule_unary_rest_bad_request( + transport: str = "rest", + request_type=compute.RemoveRuleRegionNetworkFirewallPolicyRequest, +): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = { + "project": "sample1", + "region": "sample2", + "firewall_policy": "sample3", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.remove_rule_unary(request) + + +def test_remove_rule_unary_rest_flattened(): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = { + "project": "sample1", + "region": "sample2", + "firewall_policy": "sample3", + } + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + region="region_value", + firewall_policy="firewall_policy_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.remove_rule_unary(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/regions/{region}/firewallPolicies/{firewall_policy}/removeRule" + % client.transport._host, + args[1], + ) + + +def test_remove_rule_unary_rest_flattened_error(transport: str = "rest"): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.remove_rule_unary( + compute.RemoveRuleRegionNetworkFirewallPolicyRequest(), + project="project_value", + region="region_value", + firewall_policy="firewall_policy_value", + ) + + +def test_remove_rule_unary_rest_error(): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.SetIamPolicyRegionNetworkFirewallPolicyRequest, + dict, + ], +) +def test_set_iam_policy_rest(request_type): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "region": "sample2", "resource": "sample3"} + request_init["region_set_policy_request_resource"] = { + "bindings": [ + { + "binding_id": "binding_id_value", + "condition": { + "description": "description_value", + "expression": "expression_value", + "location": "location_value", + "title": "title_value", + }, + "members": ["members_value_1", "members_value_2"], + "role": "role_value", + } + ], + "etag": "etag_value", + "policy": { + "audit_configs": [ + { + "audit_log_configs": [ + { + "exempted_members": [ + "exempted_members_value_1", + "exempted_members_value_2", + ], + "ignore_child_exemptions": True, + "log_type": "log_type_value", + } + ], + "exempted_members": [ + "exempted_members_value_1", + "exempted_members_value_2", + ], + "service": "service_value", + } + ], + "bindings": {}, + "etag": "etag_value", + "iam_owned": True, + "rules": [ + { + "action": "action_value", + "conditions": [ + { + "iam": "iam_value", + "op": "op_value", + "svc": "svc_value", + "sys": "sys_value", + "values": ["values_value_1", "values_value_2"], + } + ], + "description": "description_value", + "ins": ["ins_value_1", "ins_value_2"], + "log_configs": [ + { + "cloud_audit": { + "authorization_logging_options": { + "permission_type": "permission_type_value" + }, + "log_name": "log_name_value", + }, + "counter": { + "custom_fields": [ + {"name": "name_value", "value": "value_value"} + ], + "field": "field_value", + "metric": "metric_value", + }, + "data_access": {"log_mode": "log_mode_value"}, + } + ], + "not_ins": ["not_ins_value_1", "not_ins_value_2"], + "permissions": ["permissions_value_1", "permissions_value_2"], + } + ], + "version": 774, + }, + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Policy( + etag="etag_value", + iam_owned=True, + version=774, + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Policy.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.set_iam_policy(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.Policy) + assert response.etag == "etag_value" + assert response.iam_owned is True + assert response.version == 774 + + +def test_set_iam_policy_rest_required_fields( + request_type=compute.SetIamPolicyRegionNetworkFirewallPolicyRequest, +): + transport_class = transports.RegionNetworkFirewallPoliciesRestTransport + + request_init = {} + request_init["project"] = "" + request_init["region"] = "" + request_init["resource"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).set_iam_policy._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["project"] = "project_value" + jsonified_request["region"] = "region_value" + jsonified_request["resource"] = "resource_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).set_iam_policy._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + assert "region" in jsonified_request + assert jsonified_request["region"] == "region_value" + assert "resource" in jsonified_request + assert jsonified_request["resource"] == "resource_value" + + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.Policy() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "post", + "query_params": request_init, + } + transcode_result["body"] = {} + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Policy.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.set_iam_policy(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_set_iam_policy_rest_unset_required_fields(): + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.set_iam_policy._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(()) + & set( + ( + "project", + "region", + "regionSetPolicyRequestResource", + "resource", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_set_iam_policy_rest_interceptors(null_interceptor): + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.RegionNetworkFirewallPoliciesRestInterceptor(), + ) + client = RegionNetworkFirewallPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.RegionNetworkFirewallPoliciesRestInterceptor, "post_set_iam_policy" + ) as post, mock.patch.object( + transports.RegionNetworkFirewallPoliciesRestInterceptor, "pre_set_iam_policy" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.Policy.to_json(compute.Policy()) + + request = compute.SetIamPolicyRegionNetworkFirewallPolicyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.Policy + + client.set_iam_policy( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_set_iam_policy_rest_bad_request( + transport: str = "rest", + request_type=compute.SetIamPolicyRegionNetworkFirewallPolicyRequest, +): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "region": "sample2", "resource": "sample3"} + request_init["region_set_policy_request_resource"] = { + "bindings": [ + { + "binding_id": "binding_id_value", + "condition": { + "description": "description_value", + "expression": "expression_value", + "location": "location_value", + "title": "title_value", + }, + "members": ["members_value_1", "members_value_2"], + "role": "role_value", + } + ], + "etag": "etag_value", + "policy": { + "audit_configs": [ + { + "audit_log_configs": [ + { + "exempted_members": [ + "exempted_members_value_1", + "exempted_members_value_2", + ], + "ignore_child_exemptions": True, + "log_type": "log_type_value", + } + ], + "exempted_members": [ + "exempted_members_value_1", + "exempted_members_value_2", + ], + "service": "service_value", + } + ], + "bindings": {}, + "etag": "etag_value", + "iam_owned": True, + "rules": [ + { + "action": "action_value", + "conditions": [ + { + "iam": "iam_value", + "op": "op_value", + "svc": "svc_value", + "sys": "sys_value", + "values": ["values_value_1", "values_value_2"], + } + ], + "description": "description_value", + "ins": ["ins_value_1", "ins_value_2"], + "log_configs": [ + { + "cloud_audit": { + "authorization_logging_options": { + "permission_type": "permission_type_value" + }, + "log_name": "log_name_value", + }, + "counter": { + "custom_fields": [ + {"name": "name_value", "value": "value_value"} + ], + "field": "field_value", + "metric": "metric_value", + }, + "data_access": {"log_mode": "log_mode_value"}, + } + ], + "not_ins": ["not_ins_value_1", "not_ins_value_2"], + "permissions": ["permissions_value_1", "permissions_value_2"], + } + ], + "version": 774, + }, + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.set_iam_policy(request) + + +def test_set_iam_policy_rest_flattened(): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Policy() + + # get arguments that satisfy an http rule for this method + sample_request = { + "project": "sample1", + "region": "sample2", + "resource": "sample3", + } + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + region="region_value", + resource="resource_value", + region_set_policy_request_resource=compute.RegionSetPolicyRequest( + bindings=[compute.Binding(binding_id="binding_id_value")] + ), + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Policy.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.set_iam_policy(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/regions/{region}/firewallPolicies/{resource}/setIamPolicy" + % client.transport._host, + args[1], + ) + + +def test_set_iam_policy_rest_flattened_error(transport: str = "rest"): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.set_iam_policy( + compute.SetIamPolicyRegionNetworkFirewallPolicyRequest(), + project="project_value", + region="region_value", + resource="resource_value", + region_set_policy_request_resource=compute.RegionSetPolicyRequest( + bindings=[compute.Binding(binding_id="binding_id_value")] + ), + ) + + +def test_set_iam_policy_rest_error(): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.TestIamPermissionsRegionNetworkFirewallPolicyRequest, + dict, + ], +) +def test_test_iam_permissions_rest(request_type): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "region": "sample2", "resource": "sample3"} + request_init["test_permissions_request_resource"] = { + "permissions": ["permissions_value_1", "permissions_value_2"] + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.TestPermissionsResponse( + permissions=["permissions_value"], + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.TestPermissionsResponse.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.test_iam_permissions(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.TestPermissionsResponse) + assert response.permissions == ["permissions_value"] + + +def test_test_iam_permissions_rest_required_fields( + request_type=compute.TestIamPermissionsRegionNetworkFirewallPolicyRequest, +): + transport_class = transports.RegionNetworkFirewallPoliciesRestTransport + + request_init = {} + request_init["project"] = "" + request_init["region"] = "" + request_init["resource"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).test_iam_permissions._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["project"] = "project_value" + jsonified_request["region"] = "region_value" + jsonified_request["resource"] = "resource_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).test_iam_permissions._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + assert "region" in jsonified_request + assert jsonified_request["region"] == "region_value" + assert "resource" in jsonified_request + assert jsonified_request["resource"] == "resource_value" + + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.TestPermissionsResponse() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "post", + "query_params": request_init, + } + transcode_result["body"] = {} + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.TestPermissionsResponse.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.test_iam_permissions(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_test_iam_permissions_rest_unset_required_fields(): + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.test_iam_permissions._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(()) + & set( + ( + "project", + "region", + "resource", + "testPermissionsRequestResource", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_test_iam_permissions_rest_interceptors(null_interceptor): + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.RegionNetworkFirewallPoliciesRestInterceptor(), + ) + client = RegionNetworkFirewallPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.RegionNetworkFirewallPoliciesRestInterceptor, + "post_test_iam_permissions", + ) as post, mock.patch.object( + transports.RegionNetworkFirewallPoliciesRestInterceptor, + "pre_test_iam_permissions", + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.TestPermissionsResponse.to_json( + compute.TestPermissionsResponse() + ) + + request = compute.TestIamPermissionsRegionNetworkFirewallPolicyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.TestPermissionsResponse + + client.test_iam_permissions( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_test_iam_permissions_rest_bad_request( + transport: str = "rest", + request_type=compute.TestIamPermissionsRegionNetworkFirewallPolicyRequest, +): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "region": "sample2", "resource": "sample3"} + request_init["test_permissions_request_resource"] = { + "permissions": ["permissions_value_1", "permissions_value_2"] + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.test_iam_permissions(request) + + +def test_test_iam_permissions_rest_flattened(): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.TestPermissionsResponse() + + # get arguments that satisfy an http rule for this method + sample_request = { + "project": "sample1", + "region": "sample2", + "resource": "sample3", + } + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + region="region_value", + resource="resource_value", + test_permissions_request_resource=compute.TestPermissionsRequest( + permissions=["permissions_value"] + ), + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.TestPermissionsResponse.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.test_iam_permissions(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/regions/{region}/firewallPolicies/{resource}/testIamPermissions" + % client.transport._host, + args[1], + ) + + +def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.test_iam_permissions( + compute.TestIamPermissionsRegionNetworkFirewallPolicyRequest(), + project="project_value", + region="region_value", + resource="resource_value", + test_permissions_request_resource=compute.TestPermissionsRequest( + permissions=["permissions_value"] + ), + ) + + +def test_test_iam_permissions_rest_error(): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +def test_credentials_transport_error(): + # It is an error to provide credentials and a transport instance. + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # It is an error to provide a credentials file and a transport instance. + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = RegionNetworkFirewallPoliciesClient( + client_options={"credentials_file": "credentials.json"}, + transport=transport, + ) + + # It is an error to provide an api_key and a transport instance. + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + options = client_options.ClientOptions() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = RegionNetworkFirewallPoliciesClient( + client_options=options, + transport=transport, + ) + + # It is an error to provide an api_key and a credential. + options = mock.Mock() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = RegionNetworkFirewallPoliciesClient( + client_options=options, credentials=ga_credentials.AnonymousCredentials() + ) + + # It is an error to provide scopes and a transport instance. + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = RegionNetworkFirewallPoliciesClient( + client_options={"scopes": ["1", "2"]}, + transport=transport, + ) + + +def test_transport_instance(): + # A client may be instantiated with a custom transport instance. + transport = transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + client = RegionNetworkFirewallPoliciesClient(transport=transport) + assert client.transport is transport + + +@pytest.mark.parametrize( + "transport_class", + [ + transports.RegionNetworkFirewallPoliciesRestTransport, + ], +) +def test_transport_adc(transport_class): + # Test default credentials are used if not provided. + with mock.patch.object(google.auth, "default") as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + transport_class() + adc.assert_called_once() + + +def test_region_network_firewall_policies_base_transport_error(): + # Passing both a credentials object and credentials_file should raise an error + with pytest.raises(core_exceptions.DuplicateCredentialArgs): + transport = transports.RegionNetworkFirewallPoliciesTransport( + credentials=ga_credentials.AnonymousCredentials(), + credentials_file="credentials.json", + ) + + +def test_region_network_firewall_policies_base_transport(): + # Instantiate the base transport. + with mock.patch( + "google.cloud.compute_v1.services.region_network_firewall_policies.transports.RegionNetworkFirewallPoliciesTransport.__init__" + ) as Transport: + Transport.return_value = None + transport = transports.RegionNetworkFirewallPoliciesTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Every method on the transport should just blindly + # raise NotImplementedError. + methods = ( + "add_association", + "add_rule", + "clone_rules", + "delete", + "get", + "get_association", + "get_effective_firewalls", + "get_iam_policy", + "get_rule", + "insert", + "list", + "patch", + "patch_rule", + "remove_association", + "remove_rule", + "set_iam_policy", + "test_iam_permissions", + ) + for method in methods: + with pytest.raises(NotImplementedError): + getattr(transport, method)(request=object()) + + with pytest.raises(NotImplementedError): + transport.close() + + +def test_region_network_firewall_policies_base_transport_with_credentials_file(): + # Instantiate the base transport with a credentials file + with mock.patch.object( + google.auth, "load_credentials_from_file", autospec=True + ) as load_creds, mock.patch( + "google.cloud.compute_v1.services.region_network_firewall_policies.transports.RegionNetworkFirewallPoliciesTransport._prep_wrapped_messages" + ) as Transport: + Transport.return_value = None + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) + transport = transports.RegionNetworkFirewallPoliciesTransport( + credentials_file="credentials.json", + quota_project_id="octopus", + ) + load_creds.assert_called_once_with( + "credentials.json", + scopes=None, + default_scopes=( + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/cloud-platform", + ), + quota_project_id="octopus", + ) + + +def test_region_network_firewall_policies_base_transport_with_adc(): + # Test the default credentials are used if credentials and credentials_file are None. + with mock.patch.object(google.auth, "default", autospec=True) as adc, mock.patch( + "google.cloud.compute_v1.services.region_network_firewall_policies.transports.RegionNetworkFirewallPoliciesTransport._prep_wrapped_messages" + ) as Transport: + Transport.return_value = None + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + transport = transports.RegionNetworkFirewallPoliciesTransport() + adc.assert_called_once() + + +def test_region_network_firewall_policies_auth_adc(): + # If no credentials are provided, we should use ADC credentials. + with mock.patch.object(google.auth, "default", autospec=True) as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + RegionNetworkFirewallPoliciesClient() + adc.assert_called_once_with( + scopes=None, + default_scopes=( + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/cloud-platform", + ), + quota_project_id=None, + ) + + +def test_region_network_firewall_policies_http_transport_client_cert_source_for_mtls(): + cred = ga_credentials.AnonymousCredentials() + with mock.patch( + "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" + ) as mock_configure_mtls_channel: + transports.RegionNetworkFirewallPoliciesRestTransport( + credentials=cred, client_cert_source_for_mtls=client_cert_source_callback + ) + mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) + + +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) +def test_region_network_firewall_policies_host_no_port(transport_name): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions( + api_endpoint="compute.googleapis.com" + ), + transport=transport_name, + ) + assert client.transport._host == ( + "compute.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://compute.googleapis.com" + ) + + +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) +def test_region_network_firewall_policies_host_with_port(transport_name): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions( + api_endpoint="compute.googleapis.com:8000" + ), + transport=transport_name, + ) + assert client.transport._host == ( + "compute.googleapis.com:8000" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://compute.googleapis.com:8000" + ) + + +def test_common_billing_account_path(): + billing_account = "squid" + expected = "billingAccounts/{billing_account}".format( + billing_account=billing_account, + ) + actual = RegionNetworkFirewallPoliciesClient.common_billing_account_path( + billing_account + ) + assert expected == actual + + +def test_parse_common_billing_account_path(): + expected = { + "billing_account": "clam", + } + path = RegionNetworkFirewallPoliciesClient.common_billing_account_path(**expected) + + # Check that the path construction is reversible. + actual = RegionNetworkFirewallPoliciesClient.parse_common_billing_account_path(path) + assert expected == actual + + +def test_common_folder_path(): + folder = "whelk" + expected = "folders/{folder}".format( + folder=folder, + ) + actual = RegionNetworkFirewallPoliciesClient.common_folder_path(folder) + assert expected == actual + + +def test_parse_common_folder_path(): + expected = { + "folder": "octopus", + } + path = RegionNetworkFirewallPoliciesClient.common_folder_path(**expected) + + # Check that the path construction is reversible. + actual = RegionNetworkFirewallPoliciesClient.parse_common_folder_path(path) + assert expected == actual + + +def test_common_organization_path(): + organization = "oyster" + expected = "organizations/{organization}".format( + organization=organization, + ) + actual = RegionNetworkFirewallPoliciesClient.common_organization_path(organization) + assert expected == actual + + +def test_parse_common_organization_path(): + expected = { + "organization": "nudibranch", + } + path = RegionNetworkFirewallPoliciesClient.common_organization_path(**expected) + + # Check that the path construction is reversible. + actual = RegionNetworkFirewallPoliciesClient.parse_common_organization_path(path) + assert expected == actual + + +def test_common_project_path(): + project = "cuttlefish" + expected = "projects/{project}".format( + project=project, + ) + actual = RegionNetworkFirewallPoliciesClient.common_project_path(project) + assert expected == actual + + +def test_parse_common_project_path(): + expected = { + "project": "mussel", + } + path = RegionNetworkFirewallPoliciesClient.common_project_path(**expected) + + # Check that the path construction is reversible. + actual = RegionNetworkFirewallPoliciesClient.parse_common_project_path(path) + assert expected == actual + + +def test_common_location_path(): + project = "winkle" + location = "nautilus" + expected = "projects/{project}/locations/{location}".format( + project=project, + location=location, + ) + actual = RegionNetworkFirewallPoliciesClient.common_location_path(project, location) + assert expected == actual + + +def test_parse_common_location_path(): + expected = { + "project": "scallop", + "location": "abalone", + } + path = RegionNetworkFirewallPoliciesClient.common_location_path(**expected) + + # Check that the path construction is reversible. + actual = RegionNetworkFirewallPoliciesClient.parse_common_location_path(path) + assert expected == actual + + +def test_client_with_default_client_info(): + client_info = gapic_v1.client_info.ClientInfo() + + with mock.patch.object( + transports.RegionNetworkFirewallPoliciesTransport, "_prep_wrapped_messages" + ) as prep: + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, + ) + prep.assert_called_once_with(client_info) + + with mock.patch.object( + transports.RegionNetworkFirewallPoliciesTransport, "_prep_wrapped_messages" + ) as prep: + transport_class = RegionNetworkFirewallPoliciesClient.get_transport_class() + transport = transport_class( + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, + ) + prep.assert_called_once_with(client_info) + + +def test_transport_close(): + transports = { + "rest": "_session", + } + + for transport, close_name in transports.items(): + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport + ) + with mock.patch.object( + type(getattr(client.transport, close_name)), "close" + ) as close: + with client: + close.assert_not_called() + close.assert_called_once() + + +def test_client_ctx(): + transports = [ + "rest", + ] + for transport in transports: + client = RegionNetworkFirewallPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport + ) + # Test client calls underlying transport. + with mock.patch.object(type(client.transport), "close") as close: + close.assert_not_called() + with client: + pass + close.assert_called() + + +@pytest.mark.parametrize( + "client_class,transport_class", + [ + ( + RegionNetworkFirewallPoliciesClient, + transports.RegionNetworkFirewallPoliciesRestTransport, + ), + ], +) +def test_api_key_credentials(client_class, transport_class): + with mock.patch.object( + google.auth._default, "get_api_key_credentials", create=True + ) as get_api_key_credentials: + mock_cred = mock.Mock() + get_api_key_credentials.return_value = mock_cred + options = client_options.ClientOptions() + options.api_key = "api_key" + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=mock_cred, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) diff --git a/tests/unit/gapic/compute_v1/test_region_notification_endpoints.py b/tests/unit/gapic/compute_v1/test_region_notification_endpoints.py index 3224cfbbb..559087ee0 100644 --- a/tests/unit/gapic/compute_v1/test_region_notification_endpoints.py +++ b/tests/unit/gapic/compute_v1/test_region_notification_endpoints.py @@ -113,9 +113,9 @@ def test_region_notification_endpoints_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -170,9 +170,9 @@ def test_region_notification_endpoints_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_region_operations.py b/tests/unit/gapic/compute_v1/test_region_operations.py index 41898f2b8..5f9bc3abe 100644 --- a/tests/unit/gapic/compute_v1/test_region_operations.py +++ b/tests/unit/gapic/compute_v1/test_region_operations.py @@ -109,9 +109,9 @@ def test_region_operations_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -166,9 +166,9 @@ def test_region_operations_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_region_security_policies.py b/tests/unit/gapic/compute_v1/test_region_security_policies.py new file mode 100644 index 000000000..f1d8260eb --- /dev/null +++ b/tests/unit/gapic/compute_v1/test_region_security_policies.py @@ -0,0 +1,2899 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +import os +import mock + +import grpc +from grpc.experimental import aio +from collections.abc import Iterable +import json +import math +import pytest +from proto.marshal.rules.dates import DurationRule, TimestampRule + +from requests import Response +from requests import Request, PreparedRequest +from requests.sessions import Session + +from google.api_core import client_options +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers +from google.api_core import grpc_helpers_async +from google.api_core import path_template +from google.auth import credentials as ga_credentials +from google.auth.exceptions import MutualTLSChannelError +from google.cloud.compute_v1.services.region_security_policies import ( + RegionSecurityPoliciesClient, +) +from google.cloud.compute_v1.services.region_security_policies import pagers +from google.cloud.compute_v1.services.region_security_policies import transports +from google.cloud.compute_v1.types import compute +from google.oauth2 import service_account +import google.auth + + +def client_cert_source_callback(): + return b"cert bytes", b"key bytes" + + +# If default endpoint is localhost, then default mtls endpoint will be the same. +# This method modifies the default endpoint so the client can produce a different +# mtls endpoint for endpoint testing purposes. +def modify_default_endpoint(client): + return ( + "foo.googleapis.com" + if ("localhost" in client.DEFAULT_ENDPOINT) + else client.DEFAULT_ENDPOINT + ) + + +def test__get_default_mtls_endpoint(): + api_endpoint = "example.googleapis.com" + api_mtls_endpoint = "example.mtls.googleapis.com" + sandbox_endpoint = "example.sandbox.googleapis.com" + sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" + non_googleapi = "api.example.com" + + assert RegionSecurityPoliciesClient._get_default_mtls_endpoint(None) is None + assert ( + RegionSecurityPoliciesClient._get_default_mtls_endpoint(api_endpoint) + == api_mtls_endpoint + ) + assert ( + RegionSecurityPoliciesClient._get_default_mtls_endpoint(api_mtls_endpoint) + == api_mtls_endpoint + ) + assert ( + RegionSecurityPoliciesClient._get_default_mtls_endpoint(sandbox_endpoint) + == sandbox_mtls_endpoint + ) + assert ( + RegionSecurityPoliciesClient._get_default_mtls_endpoint(sandbox_mtls_endpoint) + == sandbox_mtls_endpoint + ) + assert ( + RegionSecurityPoliciesClient._get_default_mtls_endpoint(non_googleapi) + == non_googleapi + ) + + +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (RegionSecurityPoliciesClient, "rest"), + ], +) +def test_region_security_policies_client_from_service_account_info( + client_class, transport_name +): + creds = ga_credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = client_class.from_service_account_info(info, transport=transport_name) + assert client.transport._credentials == creds + assert isinstance(client, client_class) + + assert client.transport._host == ( + "compute.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://compute.googleapis.com" + ) + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [ + (transports.RegionSecurityPoliciesRestTransport, "rest"), + ], +) +def test_region_security_policies_client_service_account_always_use_jwt( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) + + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (RegionSecurityPoliciesClient, "rest"), + ], +) +def test_region_security_policies_client_from_service_account_file( + client_class, transport_name +): + creds = ga_credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_file" + ) as factory: + factory.return_value = creds + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) + assert client.transport._credentials == creds + assert isinstance(client, client_class) + + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) + assert client.transport._credentials == creds + assert isinstance(client, client_class) + + assert client.transport._host == ( + "compute.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://compute.googleapis.com" + ) + + +def test_region_security_policies_client_get_transport_class(): + transport = RegionSecurityPoliciesClient.get_transport_class() + available_transports = [ + transports.RegionSecurityPoliciesRestTransport, + ] + assert transport in available_transports + + transport = RegionSecurityPoliciesClient.get_transport_class("rest") + assert transport == transports.RegionSecurityPoliciesRestTransport + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name", + [ + ( + RegionSecurityPoliciesClient, + transports.RegionSecurityPoliciesRestTransport, + "rest", + ), + ], +) +@mock.patch.object( + RegionSecurityPoliciesClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(RegionSecurityPoliciesClient), +) +def test_region_security_policies_client_client_options( + client_class, transport_class, transport_name +): + # Check that if channel is provided we won't create a new one. + with mock.patch.object(RegionSecurityPoliciesClient, "get_transport_class") as gtc: + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) + client = client_class(transport=transport) + gtc.assert_not_called() + + # Check that if channel is provided via str we will create a new one. + with mock.patch.object(RegionSecurityPoliciesClient, "get_transport_class") as gtc: + client = client_class(transport=transport_name) + gtc.assert_called() + + # Check the case api_endpoint is provided. + options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(transport=transport_name, client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host="squid.clam.whelk", + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is + # "never". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is + # "always". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_MTLS_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has + # unsupported value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): + with pytest.raises(MutualTLSChannelError): + client = client_class(transport=transport_name) + + # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"} + ): + with pytest.raises(ValueError): + client = client_class(transport=transport_name) + + # Check the case quota_project_id is provided + options = client_options.ClientOptions(quota_project_id="octopus") + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id="octopus", + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name,use_client_cert_env", + [ + ( + RegionSecurityPoliciesClient, + transports.RegionSecurityPoliciesRestTransport, + "rest", + "true", + ), + ( + RegionSecurityPoliciesClient, + transports.RegionSecurityPoliciesRestTransport, + "rest", + "false", + ), + ], +) +@mock.patch.object( + RegionSecurityPoliciesClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(RegionSecurityPoliciesClient), +) +@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}) +def test_region_security_policies_client_mtls_env_auto( + client_class, transport_class, transport_name, use_client_cert_env +): + # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default + # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists. + + # Check the case client_cert_source is provided. Whether client cert is used depends on + # GOOGLE_API_USE_CLIENT_CERTIFICATE value. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + options = client_options.ClientOptions( + client_cert_source=client_cert_source_callback + ) + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + + if use_client_cert_env == "false": + expected_client_cert_source = None + expected_host = client.DEFAULT_ENDPOINT + else: + expected_client_cert_source = client_cert_source_callback + expected_host = client.DEFAULT_MTLS_ENDPOINT + + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + # Check the case ADC client cert is provided. Whether client cert is used depends on + # GOOGLE_API_USE_CLIENT_CERTIFICATE value. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + with mock.patch.object(transport_class, "__init__") as patched: + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, + ): + with mock.patch( + "google.auth.transport.mtls.default_client_cert_source", + return_value=client_cert_source_callback, + ): + if use_client_cert_env == "false": + expected_host = client.DEFAULT_ENDPOINT + expected_client_cert_source = None + else: + expected_host = client.DEFAULT_MTLS_ENDPOINT + expected_client_cert_source = client_cert_source_callback + + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + # Check the case client_cert_source and ADC client cert are not provided. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + with mock.patch.object(transport_class, "__init__") as patched: + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=False, + ): + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + +@pytest.mark.parametrize("client_class", [RegionSecurityPoliciesClient]) +@mock.patch.object( + RegionSecurityPoliciesClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(RegionSecurityPoliciesClient), +) +def test_region_security_policies_client_get_mtls_endpoint_and_cert_source( + client_class, +): + mock_client_cert_source = mock.Mock() + + # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "true". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + mock_api_endpoint = "foo" + options = client_options.ClientOptions( + client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint + ) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( + options + ) + assert api_endpoint == mock_api_endpoint + assert cert_source == mock_client_cert_source + + # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "false". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): + mock_client_cert_source = mock.Mock() + mock_api_endpoint = "foo" + options = client_options.ClientOptions( + client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint + ) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( + options + ) + assert api_endpoint == mock_api_endpoint + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "never". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "always". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert doesn't exist. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=False, + ): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert exists. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, + ): + with mock.patch( + "google.auth.transport.mtls.default_client_cert_source", + return_value=mock_client_cert_source, + ): + ( + api_endpoint, + cert_source, + ) = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + assert cert_source == mock_client_cert_source + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name", + [ + ( + RegionSecurityPoliciesClient, + transports.RegionSecurityPoliciesRestTransport, + "rest", + ), + ], +) +def test_region_security_policies_client_client_options_scopes( + client_class, transport_class, transport_name +): + # Check the case scopes are provided. + options = client_options.ClientOptions( + scopes=["1", "2"], + ) + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=["1", "2"], + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name,grpc_helpers", + [ + ( + RegionSecurityPoliciesClient, + transports.RegionSecurityPoliciesRestTransport, + "rest", + None, + ), + ], +) +def test_region_security_policies_client_client_options_credentials_file( + client_class, transport_class, transport_name, grpc_helpers +): + # Check the case credentials file is provided. + options = client_options.ClientOptions(credentials_file="credentials.json") + + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.DeleteRegionSecurityPolicyRequest, + dict, + ], +) +def test_delete_unary_rest(request_type): + client = RegionSecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = { + "project": "sample1", + "region": "sample2", + "security_policy": "sample3", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation( + client_operation_id="client_operation_id_value", + creation_timestamp="creation_timestamp_value", + description="description_value", + end_time="end_time_value", + http_error_message="http_error_message_value", + http_error_status_code=2374, + id=205, + insert_time="insert_time_value", + kind="kind_value", + name="name_value", + operation_group_id="operation_group_id_value", + operation_type="operation_type_value", + progress=885, + region="region_value", + self_link="self_link_value", + start_time="start_time_value", + status=compute.Operation.Status.DONE, + status_message="status_message_value", + target_id=947, + target_link="target_link_value", + user="user_value", + zone="zone_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.delete_unary(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.Operation) + assert response.client_operation_id == "client_operation_id_value" + assert response.creation_timestamp == "creation_timestamp_value" + assert response.description == "description_value" + assert response.end_time == "end_time_value" + assert response.http_error_message == "http_error_message_value" + assert response.http_error_status_code == 2374 + assert response.id == 205 + assert response.insert_time == "insert_time_value" + assert response.kind == "kind_value" + assert response.name == "name_value" + assert response.operation_group_id == "operation_group_id_value" + assert response.operation_type == "operation_type_value" + assert response.progress == 885 + assert response.region == "region_value" + assert response.self_link == "self_link_value" + assert response.start_time == "start_time_value" + assert response.status == compute.Operation.Status.DONE + assert response.status_message == "status_message_value" + assert response.target_id == 947 + assert response.target_link == "target_link_value" + assert response.user == "user_value" + assert response.zone == "zone_value" + + +def test_delete_unary_rest_required_fields( + request_type=compute.DeleteRegionSecurityPolicyRequest, +): + transport_class = transports.RegionSecurityPoliciesRestTransport + + request_init = {} + request_init["project"] = "" + request_init["region"] = "" + request_init["security_policy"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).delete._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["project"] = "project_value" + jsonified_request["region"] = "region_value" + jsonified_request["securityPolicy"] = "security_policy_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).delete._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set(("request_id",)) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + assert "region" in jsonified_request + assert jsonified_request["region"] == "region_value" + assert "securityPolicy" in jsonified_request + assert jsonified_request["securityPolicy"] == "security_policy_value" + + client = RegionSecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "delete", + "query_params": request_init, + } + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.delete_unary(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_delete_unary_rest_unset_required_fields(): + transport = transports.RegionSecurityPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.delete._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(("requestId",)) + & set( + ( + "project", + "region", + "securityPolicy", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_delete_unary_rest_interceptors(null_interceptor): + transport = transports.RegionSecurityPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.RegionSecurityPoliciesRestInterceptor(), + ) + client = RegionSecurityPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.RegionSecurityPoliciesRestInterceptor, "post_delete" + ) as post, mock.patch.object( + transports.RegionSecurityPoliciesRestInterceptor, "pre_delete" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.Operation.to_json(compute.Operation()) + + request = compute.DeleteRegionSecurityPolicyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.Operation + + client.delete_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_delete_unary_rest_bad_request( + transport: str = "rest", request_type=compute.DeleteRegionSecurityPolicyRequest +): + client = RegionSecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = { + "project": "sample1", + "region": "sample2", + "security_policy": "sample3", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.delete_unary(request) + + +def test_delete_unary_rest_flattened(): + client = RegionSecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = { + "project": "sample1", + "region": "sample2", + "security_policy": "sample3", + } + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + region="region_value", + security_policy="security_policy_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.delete_unary(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/regions/{region}/securityPolicies/{security_policy}" + % client.transport._host, + args[1], + ) + + +def test_delete_unary_rest_flattened_error(transport: str = "rest"): + client = RegionSecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.delete_unary( + compute.DeleteRegionSecurityPolicyRequest(), + project="project_value", + region="region_value", + security_policy="security_policy_value", + ) + + +def test_delete_unary_rest_error(): + client = RegionSecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.GetRegionSecurityPolicyRequest, + dict, + ], +) +def test_get_rest(request_type): + client = RegionSecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = { + "project": "sample1", + "region": "sample2", + "security_policy": "sample3", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.SecurityPolicy( + creation_timestamp="creation_timestamp_value", + description="description_value", + fingerprint="fingerprint_value", + id=205, + kind="kind_value", + name="name_value", + region="region_value", + self_link="self_link_value", + type_="type__value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.SecurityPolicy.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.get(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.SecurityPolicy) + assert response.creation_timestamp == "creation_timestamp_value" + assert response.description == "description_value" + assert response.fingerprint == "fingerprint_value" + assert response.id == 205 + assert response.kind == "kind_value" + assert response.name == "name_value" + assert response.region == "region_value" + assert response.self_link == "self_link_value" + assert response.type_ == "type__value" + + +def test_get_rest_required_fields(request_type=compute.GetRegionSecurityPolicyRequest): + transport_class = transports.RegionSecurityPoliciesRestTransport + + request_init = {} + request_init["project"] = "" + request_init["region"] = "" + request_init["security_policy"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).get._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["project"] = "project_value" + jsonified_request["region"] = "region_value" + jsonified_request["securityPolicy"] = "security_policy_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).get._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + assert "region" in jsonified_request + assert jsonified_request["region"] == "region_value" + assert "securityPolicy" in jsonified_request + assert jsonified_request["securityPolicy"] == "security_policy_value" + + client = RegionSecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.SecurityPolicy() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "get", + "query_params": request_init, + } + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.SecurityPolicy.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.get(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_get_rest_unset_required_fields(): + transport = transports.RegionSecurityPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.get._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(()) + & set( + ( + "project", + "region", + "securityPolicy", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_get_rest_interceptors(null_interceptor): + transport = transports.RegionSecurityPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.RegionSecurityPoliciesRestInterceptor(), + ) + client = RegionSecurityPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.RegionSecurityPoliciesRestInterceptor, "post_get" + ) as post, mock.patch.object( + transports.RegionSecurityPoliciesRestInterceptor, "pre_get" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.SecurityPolicy.to_json( + compute.SecurityPolicy() + ) + + request = compute.GetRegionSecurityPolicyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.SecurityPolicy + + client.get( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_get_rest_bad_request( + transport: str = "rest", request_type=compute.GetRegionSecurityPolicyRequest +): + client = RegionSecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = { + "project": "sample1", + "region": "sample2", + "security_policy": "sample3", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.get(request) + + +def test_get_rest_flattened(): + client = RegionSecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.SecurityPolicy() + + # get arguments that satisfy an http rule for this method + sample_request = { + "project": "sample1", + "region": "sample2", + "security_policy": "sample3", + } + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + region="region_value", + security_policy="security_policy_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.SecurityPolicy.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.get(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/regions/{region}/securityPolicies/{security_policy}" + % client.transport._host, + args[1], + ) + + +def test_get_rest_flattened_error(transport: str = "rest"): + client = RegionSecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get( + compute.GetRegionSecurityPolicyRequest(), + project="project_value", + region="region_value", + security_policy="security_policy_value", + ) + + +def test_get_rest_error(): + client = RegionSecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.InsertRegionSecurityPolicyRequest, + dict, + ], +) +def test_insert_unary_rest(request_type): + client = RegionSecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "region": "sample2"} + request_init["security_policy_resource"] = { + "adaptive_protection_config": { + "layer7_ddos_defense_config": { + "enable": True, + "rule_visibility": "rule_visibility_value", + } + }, + "advanced_options_config": { + "json_parsing": "json_parsing_value", + "log_level": "log_level_value", + }, + "creation_timestamp": "creation_timestamp_value", + "ddos_protection_config": {"ddos_protection": "ddos_protection_value"}, + "description": "description_value", + "fingerprint": "fingerprint_value", + "id": 205, + "kind": "kind_value", + "name": "name_value", + "recaptcha_options_config": {"redirect_site_key": "redirect_site_key_value"}, + "region": "region_value", + "rules": [ + { + "action": "action_value", + "description": "description_value", + "header_action": { + "request_headers_to_adds": [ + { + "header_name": "header_name_value", + "header_value": "header_value_value", + } + ] + }, + "kind": "kind_value", + "match": { + "config": { + "src_ip_ranges": [ + "src_ip_ranges_value_1", + "src_ip_ranges_value_2", + ] + }, + "expr": { + "description": "description_value", + "expression": "expression_value", + "location": "location_value", + "title": "title_value", + }, + "versioned_expr": "versioned_expr_value", + }, + "preview": True, + "priority": 898, + "rate_limit_options": { + "ban_duration_sec": 1680, + "ban_threshold": {"count": 553, "interval_sec": 1279}, + "conform_action": "conform_action_value", + "enforce_on_key": "enforce_on_key_value", + "enforce_on_key_name": "enforce_on_key_name_value", + "exceed_action": "exceed_action_value", + "exceed_redirect_options": { + "target": "target_value", + "type_": "type__value", + }, + "rate_limit_threshold": {}, + }, + "redirect_options": {}, + } + ], + "self_link": "self_link_value", + "type_": "type__value", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation( + client_operation_id="client_operation_id_value", + creation_timestamp="creation_timestamp_value", + description="description_value", + end_time="end_time_value", + http_error_message="http_error_message_value", + http_error_status_code=2374, + id=205, + insert_time="insert_time_value", + kind="kind_value", + name="name_value", + operation_group_id="operation_group_id_value", + operation_type="operation_type_value", + progress=885, + region="region_value", + self_link="self_link_value", + start_time="start_time_value", + status=compute.Operation.Status.DONE, + status_message="status_message_value", + target_id=947, + target_link="target_link_value", + user="user_value", + zone="zone_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.insert_unary(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.Operation) + assert response.client_operation_id == "client_operation_id_value" + assert response.creation_timestamp == "creation_timestamp_value" + assert response.description == "description_value" + assert response.end_time == "end_time_value" + assert response.http_error_message == "http_error_message_value" + assert response.http_error_status_code == 2374 + assert response.id == 205 + assert response.insert_time == "insert_time_value" + assert response.kind == "kind_value" + assert response.name == "name_value" + assert response.operation_group_id == "operation_group_id_value" + assert response.operation_type == "operation_type_value" + assert response.progress == 885 + assert response.region == "region_value" + assert response.self_link == "self_link_value" + assert response.start_time == "start_time_value" + assert response.status == compute.Operation.Status.DONE + assert response.status_message == "status_message_value" + assert response.target_id == 947 + assert response.target_link == "target_link_value" + assert response.user == "user_value" + assert response.zone == "zone_value" + + +def test_insert_unary_rest_required_fields( + request_type=compute.InsertRegionSecurityPolicyRequest, +): + transport_class = transports.RegionSecurityPoliciesRestTransport + + request_init = {} + request_init["project"] = "" + request_init["region"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).insert._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["project"] = "project_value" + jsonified_request["region"] = "region_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).insert._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set( + ( + "request_id", + "validate_only", + ) + ) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + assert "region" in jsonified_request + assert jsonified_request["region"] == "region_value" + + client = RegionSecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "post", + "query_params": request_init, + } + transcode_result["body"] = {} + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.insert_unary(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_insert_unary_rest_unset_required_fields(): + transport = transports.RegionSecurityPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.insert._get_unset_required_fields({}) + assert set(unset_fields) == ( + set( + ( + "requestId", + "validateOnly", + ) + ) + & set( + ( + "project", + "region", + "securityPolicyResource", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_insert_unary_rest_interceptors(null_interceptor): + transport = transports.RegionSecurityPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.RegionSecurityPoliciesRestInterceptor(), + ) + client = RegionSecurityPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.RegionSecurityPoliciesRestInterceptor, "post_insert" + ) as post, mock.patch.object( + transports.RegionSecurityPoliciesRestInterceptor, "pre_insert" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.Operation.to_json(compute.Operation()) + + request = compute.InsertRegionSecurityPolicyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.Operation + + client.insert_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_insert_unary_rest_bad_request( + transport: str = "rest", request_type=compute.InsertRegionSecurityPolicyRequest +): + client = RegionSecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "region": "sample2"} + request_init["security_policy_resource"] = { + "adaptive_protection_config": { + "layer7_ddos_defense_config": { + "enable": True, + "rule_visibility": "rule_visibility_value", + } + }, + "advanced_options_config": { + "json_parsing": "json_parsing_value", + "log_level": "log_level_value", + }, + "creation_timestamp": "creation_timestamp_value", + "ddos_protection_config": {"ddos_protection": "ddos_protection_value"}, + "description": "description_value", + "fingerprint": "fingerprint_value", + "id": 205, + "kind": "kind_value", + "name": "name_value", + "recaptcha_options_config": {"redirect_site_key": "redirect_site_key_value"}, + "region": "region_value", + "rules": [ + { + "action": "action_value", + "description": "description_value", + "header_action": { + "request_headers_to_adds": [ + { + "header_name": "header_name_value", + "header_value": "header_value_value", + } + ] + }, + "kind": "kind_value", + "match": { + "config": { + "src_ip_ranges": [ + "src_ip_ranges_value_1", + "src_ip_ranges_value_2", + ] + }, + "expr": { + "description": "description_value", + "expression": "expression_value", + "location": "location_value", + "title": "title_value", + }, + "versioned_expr": "versioned_expr_value", + }, + "preview": True, + "priority": 898, + "rate_limit_options": { + "ban_duration_sec": 1680, + "ban_threshold": {"count": 553, "interval_sec": 1279}, + "conform_action": "conform_action_value", + "enforce_on_key": "enforce_on_key_value", + "enforce_on_key_name": "enforce_on_key_name_value", + "exceed_action": "exceed_action_value", + "exceed_redirect_options": { + "target": "target_value", + "type_": "type__value", + }, + "rate_limit_threshold": {}, + }, + "redirect_options": {}, + } + ], + "self_link": "self_link_value", + "type_": "type__value", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.insert_unary(request) + + +def test_insert_unary_rest_flattened(): + client = RegionSecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = {"project": "sample1", "region": "sample2"} + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + region="region_value", + security_policy_resource=compute.SecurityPolicy( + adaptive_protection_config=compute.SecurityPolicyAdaptiveProtectionConfig( + layer7_ddos_defense_config=compute.SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfig( + enable=True + ) + ) + ), + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.insert_unary(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/regions/{region}/securityPolicies" + % client.transport._host, + args[1], + ) + + +def test_insert_unary_rest_flattened_error(transport: str = "rest"): + client = RegionSecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.insert_unary( + compute.InsertRegionSecurityPolicyRequest(), + project="project_value", + region="region_value", + security_policy_resource=compute.SecurityPolicy( + adaptive_protection_config=compute.SecurityPolicyAdaptiveProtectionConfig( + layer7_ddos_defense_config=compute.SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfig( + enable=True + ) + ) + ), + ) + + +def test_insert_unary_rest_error(): + client = RegionSecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + compute.ListRegionSecurityPoliciesRequest, + dict, + ], +) +def test_list_rest(request_type): + client = RegionSecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "region": "sample2"} + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.SecurityPolicyList( + id="id_value", + kind="kind_value", + next_page_token="next_page_token_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.SecurityPolicyList.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.list(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListPager) + assert response.id == "id_value" + assert response.kind == "kind_value" + assert response.next_page_token == "next_page_token_value" + + +def test_list_rest_required_fields( + request_type=compute.ListRegionSecurityPoliciesRequest, +): + transport_class = transports.RegionSecurityPoliciesRestTransport + + request_init = {} + request_init["project"] = "" + request_init["region"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).list._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["project"] = "project_value" + jsonified_request["region"] = "region_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).list._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set( + ( + "filter", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) + ) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + assert "region" in jsonified_request + assert jsonified_request["region"] == "region_value" + + client = RegionSecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.SecurityPolicyList() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "get", + "query_params": request_init, + } + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.SecurityPolicyList.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.list(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_list_rest_unset_required_fields(): + transport = transports.RegionSecurityPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.list._get_unset_required_fields({}) + assert set(unset_fields) == ( + set( + ( + "filter", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set( + ( + "project", + "region", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_list_rest_interceptors(null_interceptor): + transport = transports.RegionSecurityPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.RegionSecurityPoliciesRestInterceptor(), + ) + client = RegionSecurityPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.RegionSecurityPoliciesRestInterceptor, "post_list" + ) as post, mock.patch.object( + transports.RegionSecurityPoliciesRestInterceptor, "pre_list" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.SecurityPolicyList.to_json( + compute.SecurityPolicyList() + ) + + request = compute.ListRegionSecurityPoliciesRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.SecurityPolicyList + + client.list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_list_rest_bad_request( + transport: str = "rest", request_type=compute.ListRegionSecurityPoliciesRequest +): + client = RegionSecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1", "region": "sample2"} + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.list(request) + + +def test_list_rest_flattened(): + client = RegionSecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.SecurityPolicyList() + + # get arguments that satisfy an http rule for this method + sample_request = {"project": "sample1", "region": "sample2"} + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + region="region_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.SecurityPolicyList.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.list(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/regions/{region}/securityPolicies" + % client.transport._host, + args[1], + ) + + +def test_list_rest_flattened_error(transport: str = "rest"): + client = RegionSecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list( + compute.ListRegionSecurityPoliciesRequest(), + project="project_value", + region="region_value", + ) + + +def test_list_rest_pager(transport: str = "rest"): + client = RegionSecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # TODO(kbandes): remove this mock unless there's a good reason for it. + # with mock.patch.object(path_template, 'transcode') as transcode: + # Set the response as a series of pages + response = ( + compute.SecurityPolicyList( + items=[ + compute.SecurityPolicy(), + compute.SecurityPolicy(), + compute.SecurityPolicy(), + ], + next_page_token="abc", + ), + compute.SecurityPolicyList( + items=[], + next_page_token="def", + ), + compute.SecurityPolicyList( + items=[ + compute.SecurityPolicy(), + ], + next_page_token="ghi", + ), + compute.SecurityPolicyList( + items=[ + compute.SecurityPolicy(), + compute.SecurityPolicy(), + ], + ), + ) + # Two responses for two calls + response = response + response + + # Wrap the values into proper Response objs + response = tuple(compute.SecurityPolicyList.to_json(x) for x in response) + return_values = tuple(Response() for i in response) + for return_val, response_val in zip(return_values, response): + return_val._content = response_val.encode("UTF-8") + return_val.status_code = 200 + req.side_effect = return_values + + sample_request = {"project": "sample1", "region": "sample2"} + + pager = client.list(request=sample_request) + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, compute.SecurityPolicy) for i in results) + + pages = list(client.list(request=sample_request).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.parametrize( + "request_type", + [ + compute.PatchRegionSecurityPolicyRequest, + dict, + ], +) +def test_patch_unary_rest(request_type): + client = RegionSecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = { + "project": "sample1", + "region": "sample2", + "security_policy": "sample3", + } + request_init["security_policy_resource"] = { + "adaptive_protection_config": { + "layer7_ddos_defense_config": { + "enable": True, + "rule_visibility": "rule_visibility_value", + } + }, + "advanced_options_config": { + "json_parsing": "json_parsing_value", + "log_level": "log_level_value", + }, + "creation_timestamp": "creation_timestamp_value", + "ddos_protection_config": {"ddos_protection": "ddos_protection_value"}, + "description": "description_value", + "fingerprint": "fingerprint_value", + "id": 205, + "kind": "kind_value", + "name": "name_value", + "recaptcha_options_config": {"redirect_site_key": "redirect_site_key_value"}, + "region": "region_value", + "rules": [ + { + "action": "action_value", + "description": "description_value", + "header_action": { + "request_headers_to_adds": [ + { + "header_name": "header_name_value", + "header_value": "header_value_value", + } + ] + }, + "kind": "kind_value", + "match": { + "config": { + "src_ip_ranges": [ + "src_ip_ranges_value_1", + "src_ip_ranges_value_2", + ] + }, + "expr": { + "description": "description_value", + "expression": "expression_value", + "location": "location_value", + "title": "title_value", + }, + "versioned_expr": "versioned_expr_value", + }, + "preview": True, + "priority": 898, + "rate_limit_options": { + "ban_duration_sec": 1680, + "ban_threshold": {"count": 553, "interval_sec": 1279}, + "conform_action": "conform_action_value", + "enforce_on_key": "enforce_on_key_value", + "enforce_on_key_name": "enforce_on_key_name_value", + "exceed_action": "exceed_action_value", + "exceed_redirect_options": { + "target": "target_value", + "type_": "type__value", + }, + "rate_limit_threshold": {}, + }, + "redirect_options": {}, + } + ], + "self_link": "self_link_value", + "type_": "type__value", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation( + client_operation_id="client_operation_id_value", + creation_timestamp="creation_timestamp_value", + description="description_value", + end_time="end_time_value", + http_error_message="http_error_message_value", + http_error_status_code=2374, + id=205, + insert_time="insert_time_value", + kind="kind_value", + name="name_value", + operation_group_id="operation_group_id_value", + operation_type="operation_type_value", + progress=885, + region="region_value", + self_link="self_link_value", + start_time="start_time_value", + status=compute.Operation.Status.DONE, + status_message="status_message_value", + target_id=947, + target_link="target_link_value", + user="user_value", + zone="zone_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.patch_unary(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.Operation) + assert response.client_operation_id == "client_operation_id_value" + assert response.creation_timestamp == "creation_timestamp_value" + assert response.description == "description_value" + assert response.end_time == "end_time_value" + assert response.http_error_message == "http_error_message_value" + assert response.http_error_status_code == 2374 + assert response.id == 205 + assert response.insert_time == "insert_time_value" + assert response.kind == "kind_value" + assert response.name == "name_value" + assert response.operation_group_id == "operation_group_id_value" + assert response.operation_type == "operation_type_value" + assert response.progress == 885 + assert response.region == "region_value" + assert response.self_link == "self_link_value" + assert response.start_time == "start_time_value" + assert response.status == compute.Operation.Status.DONE + assert response.status_message == "status_message_value" + assert response.target_id == 947 + assert response.target_link == "target_link_value" + assert response.user == "user_value" + assert response.zone == "zone_value" + + +def test_patch_unary_rest_required_fields( + request_type=compute.PatchRegionSecurityPolicyRequest, +): + transport_class = transports.RegionSecurityPoliciesRestTransport + + request_init = {} + request_init["project"] = "" + request_init["region"] = "" + request_init["security_policy"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).patch._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["project"] = "project_value" + jsonified_request["region"] = "region_value" + jsonified_request["securityPolicy"] = "security_policy_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).patch._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set(("request_id",)) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + assert "region" in jsonified_request + assert jsonified_request["region"] == "region_value" + assert "securityPolicy" in jsonified_request + assert jsonified_request["securityPolicy"] == "security_policy_value" + + client = RegionSecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "patch", + "query_params": request_init, + } + transcode_result["body"] = {} + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.patch_unary(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_patch_unary_rest_unset_required_fields(): + transport = transports.RegionSecurityPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.patch._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(("requestId",)) + & set( + ( + "project", + "region", + "securityPolicy", + "securityPolicyResource", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_patch_unary_rest_interceptors(null_interceptor): + transport = transports.RegionSecurityPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.RegionSecurityPoliciesRestInterceptor(), + ) + client = RegionSecurityPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.RegionSecurityPoliciesRestInterceptor, "post_patch" + ) as post, mock.patch.object( + transports.RegionSecurityPoliciesRestInterceptor, "pre_patch" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.Operation.to_json(compute.Operation()) + + request = compute.PatchRegionSecurityPolicyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.Operation + + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_patch_unary_rest_bad_request( + transport: str = "rest", request_type=compute.PatchRegionSecurityPolicyRequest +): + client = RegionSecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = { + "project": "sample1", + "region": "sample2", + "security_policy": "sample3", + } + request_init["security_policy_resource"] = { + "adaptive_protection_config": { + "layer7_ddos_defense_config": { + "enable": True, + "rule_visibility": "rule_visibility_value", + } + }, + "advanced_options_config": { + "json_parsing": "json_parsing_value", + "log_level": "log_level_value", + }, + "creation_timestamp": "creation_timestamp_value", + "ddos_protection_config": {"ddos_protection": "ddos_protection_value"}, + "description": "description_value", + "fingerprint": "fingerprint_value", + "id": 205, + "kind": "kind_value", + "name": "name_value", + "recaptcha_options_config": {"redirect_site_key": "redirect_site_key_value"}, + "region": "region_value", + "rules": [ + { + "action": "action_value", + "description": "description_value", + "header_action": { + "request_headers_to_adds": [ + { + "header_name": "header_name_value", + "header_value": "header_value_value", + } + ] + }, + "kind": "kind_value", + "match": { + "config": { + "src_ip_ranges": [ + "src_ip_ranges_value_1", + "src_ip_ranges_value_2", + ] + }, + "expr": { + "description": "description_value", + "expression": "expression_value", + "location": "location_value", + "title": "title_value", + }, + "versioned_expr": "versioned_expr_value", + }, + "preview": True, + "priority": 898, + "rate_limit_options": { + "ban_duration_sec": 1680, + "ban_threshold": {"count": 553, "interval_sec": 1279}, + "conform_action": "conform_action_value", + "enforce_on_key": "enforce_on_key_value", + "enforce_on_key_name": "enforce_on_key_name_value", + "exceed_action": "exceed_action_value", + "exceed_redirect_options": { + "target": "target_value", + "type_": "type__value", + }, + "rate_limit_threshold": {}, + }, + "redirect_options": {}, + } + ], + "self_link": "self_link_value", + "type_": "type__value", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.patch_unary(request) + + +def test_patch_unary_rest_flattened(): + client = RegionSecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = { + "project": "sample1", + "region": "sample2", + "security_policy": "sample3", + } + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + region="region_value", + security_policy="security_policy_value", + security_policy_resource=compute.SecurityPolicy( + adaptive_protection_config=compute.SecurityPolicyAdaptiveProtectionConfig( + layer7_ddos_defense_config=compute.SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfig( + enable=True + ) + ) + ), + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.patch_unary(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/regions/{region}/securityPolicies/{security_policy}" + % client.transport._host, + args[1], + ) + + +def test_patch_unary_rest_flattened_error(transport: str = "rest"): + client = RegionSecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.patch_unary( + compute.PatchRegionSecurityPolicyRequest(), + project="project_value", + region="region_value", + security_policy="security_policy_value", + security_policy_resource=compute.SecurityPolicy( + adaptive_protection_config=compute.SecurityPolicyAdaptiveProtectionConfig( + layer7_ddos_defense_config=compute.SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfig( + enable=True + ) + ) + ), + ) + + +def test_patch_unary_rest_error(): + client = RegionSecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +def test_credentials_transport_error(): + # It is an error to provide credentials and a transport instance. + transport = transports.RegionSecurityPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = RegionSecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # It is an error to provide a credentials file and a transport instance. + transport = transports.RegionSecurityPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = RegionSecurityPoliciesClient( + client_options={"credentials_file": "credentials.json"}, + transport=transport, + ) + + # It is an error to provide an api_key and a transport instance. + transport = transports.RegionSecurityPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + options = client_options.ClientOptions() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = RegionSecurityPoliciesClient( + client_options=options, + transport=transport, + ) + + # It is an error to provide an api_key and a credential. + options = mock.Mock() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = RegionSecurityPoliciesClient( + client_options=options, credentials=ga_credentials.AnonymousCredentials() + ) + + # It is an error to provide scopes and a transport instance. + transport = transports.RegionSecurityPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = RegionSecurityPoliciesClient( + client_options={"scopes": ["1", "2"]}, + transport=transport, + ) + + +def test_transport_instance(): + # A client may be instantiated with a custom transport instance. + transport = transports.RegionSecurityPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + client = RegionSecurityPoliciesClient(transport=transport) + assert client.transport is transport + + +@pytest.mark.parametrize( + "transport_class", + [ + transports.RegionSecurityPoliciesRestTransport, + ], +) +def test_transport_adc(transport_class): + # Test default credentials are used if not provided. + with mock.patch.object(google.auth, "default") as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + transport_class() + adc.assert_called_once() + + +def test_region_security_policies_base_transport_error(): + # Passing both a credentials object and credentials_file should raise an error + with pytest.raises(core_exceptions.DuplicateCredentialArgs): + transport = transports.RegionSecurityPoliciesTransport( + credentials=ga_credentials.AnonymousCredentials(), + credentials_file="credentials.json", + ) + + +def test_region_security_policies_base_transport(): + # Instantiate the base transport. + with mock.patch( + "google.cloud.compute_v1.services.region_security_policies.transports.RegionSecurityPoliciesTransport.__init__" + ) as Transport: + Transport.return_value = None + transport = transports.RegionSecurityPoliciesTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Every method on the transport should just blindly + # raise NotImplementedError. + methods = ( + "delete", + "get", + "insert", + "list", + "patch", + ) + for method in methods: + with pytest.raises(NotImplementedError): + getattr(transport, method)(request=object()) + + with pytest.raises(NotImplementedError): + transport.close() + + +def test_region_security_policies_base_transport_with_credentials_file(): + # Instantiate the base transport with a credentials file + with mock.patch.object( + google.auth, "load_credentials_from_file", autospec=True + ) as load_creds, mock.patch( + "google.cloud.compute_v1.services.region_security_policies.transports.RegionSecurityPoliciesTransport._prep_wrapped_messages" + ) as Transport: + Transport.return_value = None + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) + transport = transports.RegionSecurityPoliciesTransport( + credentials_file="credentials.json", + quota_project_id="octopus", + ) + load_creds.assert_called_once_with( + "credentials.json", + scopes=None, + default_scopes=( + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/cloud-platform", + ), + quota_project_id="octopus", + ) + + +def test_region_security_policies_base_transport_with_adc(): + # Test the default credentials are used if credentials and credentials_file are None. + with mock.patch.object(google.auth, "default", autospec=True) as adc, mock.patch( + "google.cloud.compute_v1.services.region_security_policies.transports.RegionSecurityPoliciesTransport._prep_wrapped_messages" + ) as Transport: + Transport.return_value = None + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + transport = transports.RegionSecurityPoliciesTransport() + adc.assert_called_once() + + +def test_region_security_policies_auth_adc(): + # If no credentials are provided, we should use ADC credentials. + with mock.patch.object(google.auth, "default", autospec=True) as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + RegionSecurityPoliciesClient() + adc.assert_called_once_with( + scopes=None, + default_scopes=( + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/cloud-platform", + ), + quota_project_id=None, + ) + + +def test_region_security_policies_http_transport_client_cert_source_for_mtls(): + cred = ga_credentials.AnonymousCredentials() + with mock.patch( + "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" + ) as mock_configure_mtls_channel: + transports.RegionSecurityPoliciesRestTransport( + credentials=cred, client_cert_source_for_mtls=client_cert_source_callback + ) + mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) + + +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) +def test_region_security_policies_host_no_port(transport_name): + client = RegionSecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions( + api_endpoint="compute.googleapis.com" + ), + transport=transport_name, + ) + assert client.transport._host == ( + "compute.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://compute.googleapis.com" + ) + + +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) +def test_region_security_policies_host_with_port(transport_name): + client = RegionSecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions( + api_endpoint="compute.googleapis.com:8000" + ), + transport=transport_name, + ) + assert client.transport._host == ( + "compute.googleapis.com:8000" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://compute.googleapis.com:8000" + ) + + +def test_common_billing_account_path(): + billing_account = "squid" + expected = "billingAccounts/{billing_account}".format( + billing_account=billing_account, + ) + actual = RegionSecurityPoliciesClient.common_billing_account_path(billing_account) + assert expected == actual + + +def test_parse_common_billing_account_path(): + expected = { + "billing_account": "clam", + } + path = RegionSecurityPoliciesClient.common_billing_account_path(**expected) + + # Check that the path construction is reversible. + actual = RegionSecurityPoliciesClient.parse_common_billing_account_path(path) + assert expected == actual + + +def test_common_folder_path(): + folder = "whelk" + expected = "folders/{folder}".format( + folder=folder, + ) + actual = RegionSecurityPoliciesClient.common_folder_path(folder) + assert expected == actual + + +def test_parse_common_folder_path(): + expected = { + "folder": "octopus", + } + path = RegionSecurityPoliciesClient.common_folder_path(**expected) + + # Check that the path construction is reversible. + actual = RegionSecurityPoliciesClient.parse_common_folder_path(path) + assert expected == actual + + +def test_common_organization_path(): + organization = "oyster" + expected = "organizations/{organization}".format( + organization=organization, + ) + actual = RegionSecurityPoliciesClient.common_organization_path(organization) + assert expected == actual + + +def test_parse_common_organization_path(): + expected = { + "organization": "nudibranch", + } + path = RegionSecurityPoliciesClient.common_organization_path(**expected) + + # Check that the path construction is reversible. + actual = RegionSecurityPoliciesClient.parse_common_organization_path(path) + assert expected == actual + + +def test_common_project_path(): + project = "cuttlefish" + expected = "projects/{project}".format( + project=project, + ) + actual = RegionSecurityPoliciesClient.common_project_path(project) + assert expected == actual + + +def test_parse_common_project_path(): + expected = { + "project": "mussel", + } + path = RegionSecurityPoliciesClient.common_project_path(**expected) + + # Check that the path construction is reversible. + actual = RegionSecurityPoliciesClient.parse_common_project_path(path) + assert expected == actual + + +def test_common_location_path(): + project = "winkle" + location = "nautilus" + expected = "projects/{project}/locations/{location}".format( + project=project, + location=location, + ) + actual = RegionSecurityPoliciesClient.common_location_path(project, location) + assert expected == actual + + +def test_parse_common_location_path(): + expected = { + "project": "scallop", + "location": "abalone", + } + path = RegionSecurityPoliciesClient.common_location_path(**expected) + + # Check that the path construction is reversible. + actual = RegionSecurityPoliciesClient.parse_common_location_path(path) + assert expected == actual + + +def test_client_with_default_client_info(): + client_info = gapic_v1.client_info.ClientInfo() + + with mock.patch.object( + transports.RegionSecurityPoliciesTransport, "_prep_wrapped_messages" + ) as prep: + client = RegionSecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, + ) + prep.assert_called_once_with(client_info) + + with mock.patch.object( + transports.RegionSecurityPoliciesTransport, "_prep_wrapped_messages" + ) as prep: + transport_class = RegionSecurityPoliciesClient.get_transport_class() + transport = transport_class( + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, + ) + prep.assert_called_once_with(client_info) + + +def test_transport_close(): + transports = { + "rest": "_session", + } + + for transport, close_name in transports.items(): + client = RegionSecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport + ) + with mock.patch.object( + type(getattr(client.transport, close_name)), "close" + ) as close: + with client: + close.assert_not_called() + close.assert_called_once() + + +def test_client_ctx(): + transports = [ + "rest", + ] + for transport in transports: + client = RegionSecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport + ) + # Test client calls underlying transport. + with mock.patch.object(type(client.transport), "close") as close: + close.assert_not_called() + with client: + pass + close.assert_called() + + +@pytest.mark.parametrize( + "client_class,transport_class", + [ + (RegionSecurityPoliciesClient, transports.RegionSecurityPoliciesRestTransport), + ], +) +def test_api_key_credentials(client_class, transport_class): + with mock.patch.object( + google.auth._default, "get_api_key_credentials", create=True + ) as get_api_key_credentials: + mock_cred = mock.Mock() + get_api_key_credentials.return_value = mock_cred + options = client_options.ClientOptions() + options.api_key = "api_key" + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=mock_cred, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) diff --git a/tests/unit/gapic/compute_v1/test_region_ssl_certificates.py b/tests/unit/gapic/compute_v1/test_region_ssl_certificates.py index d083921db..f7979ec38 100644 --- a/tests/unit/gapic/compute_v1/test_region_ssl_certificates.py +++ b/tests/unit/gapic/compute_v1/test_region_ssl_certificates.py @@ -111,9 +111,9 @@ def test_region_ssl_certificates_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -168,9 +168,9 @@ def test_region_ssl_certificates_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_region_target_http_proxies.py b/tests/unit/gapic/compute_v1/test_region_target_http_proxies.py index 5e2d0ce43..208163351 100644 --- a/tests/unit/gapic/compute_v1/test_region_target_http_proxies.py +++ b/tests/unit/gapic/compute_v1/test_region_target_http_proxies.py @@ -111,9 +111,9 @@ def test_region_target_http_proxies_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -168,9 +168,9 @@ def test_region_target_http_proxies_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_region_target_https_proxies.py b/tests/unit/gapic/compute_v1/test_region_target_https_proxies.py index 615c6126f..c9992c1f3 100644 --- a/tests/unit/gapic/compute_v1/test_region_target_https_proxies.py +++ b/tests/unit/gapic/compute_v1/test_region_target_https_proxies.py @@ -111,9 +111,9 @@ def test_region_target_https_proxies_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -168,9 +168,9 @@ def test_region_target_https_proxies_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -1909,6 +1909,380 @@ def test_list_rest_pager(transport: str = "rest"): assert page_.raw_page.next_page_token == token +@pytest.mark.parametrize( + "request_type", + [ + compute.PatchRegionTargetHttpsProxyRequest, + dict, + ], +) +def test_patch_unary_rest(request_type): + client = RegionTargetHttpsProxiesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = { + "project": "sample1", + "region": "sample2", + "target_https_proxy": "sample3", + } + request_init["target_https_proxy_resource"] = { + "authorization_policy": "authorization_policy_value", + "creation_timestamp": "creation_timestamp_value", + "description": "description_value", + "fingerprint": "fingerprint_value", + "id": 205, + "kind": "kind_value", + "name": "name_value", + "proxy_bind": True, + "quic_override": "quic_override_value", + "region": "region_value", + "self_link": "self_link_value", + "server_tls_policy": "server_tls_policy_value", + "ssl_certificates": ["ssl_certificates_value_1", "ssl_certificates_value_2"], + "ssl_policy": "ssl_policy_value", + "url_map": "url_map_value", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation( + client_operation_id="client_operation_id_value", + creation_timestamp="creation_timestamp_value", + description="description_value", + end_time="end_time_value", + http_error_message="http_error_message_value", + http_error_status_code=2374, + id=205, + insert_time="insert_time_value", + kind="kind_value", + name="name_value", + operation_group_id="operation_group_id_value", + operation_type="operation_type_value", + progress=885, + region="region_value", + self_link="self_link_value", + start_time="start_time_value", + status=compute.Operation.Status.DONE, + status_message="status_message_value", + target_id=947, + target_link="target_link_value", + user="user_value", + zone="zone_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.patch_unary(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, compute.Operation) + assert response.client_operation_id == "client_operation_id_value" + assert response.creation_timestamp == "creation_timestamp_value" + assert response.description == "description_value" + assert response.end_time == "end_time_value" + assert response.http_error_message == "http_error_message_value" + assert response.http_error_status_code == 2374 + assert response.id == 205 + assert response.insert_time == "insert_time_value" + assert response.kind == "kind_value" + assert response.name == "name_value" + assert response.operation_group_id == "operation_group_id_value" + assert response.operation_type == "operation_type_value" + assert response.progress == 885 + assert response.region == "region_value" + assert response.self_link == "self_link_value" + assert response.start_time == "start_time_value" + assert response.status == compute.Operation.Status.DONE + assert response.status_message == "status_message_value" + assert response.target_id == 947 + assert response.target_link == "target_link_value" + assert response.user == "user_value" + assert response.zone == "zone_value" + + +def test_patch_unary_rest_required_fields( + request_type=compute.PatchRegionTargetHttpsProxyRequest, +): + transport_class = transports.RegionTargetHttpsProxiesRestTransport + + request_init = {} + request_init["project"] = "" + request_init["region"] = "" + request_init["target_https_proxy"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).patch._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["project"] = "project_value" + jsonified_request["region"] = "region_value" + jsonified_request["targetHttpsProxy"] = "target_https_proxy_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).patch._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set(("request_id",)) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + assert "region" in jsonified_request + assert jsonified_request["region"] == "region_value" + assert "targetHttpsProxy" in jsonified_request + assert jsonified_request["targetHttpsProxy"] == "target_https_proxy_value" + + client = RegionTargetHttpsProxiesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "patch", + "query_params": request_init, + } + transcode_result["body"] = {} + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.patch_unary(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_patch_unary_rest_unset_required_fields(): + transport = transports.RegionTargetHttpsProxiesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.patch._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(("requestId",)) + & set( + ( + "project", + "region", + "targetHttpsProxy", + "targetHttpsProxyResource", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_patch_unary_rest_interceptors(null_interceptor): + transport = transports.RegionTargetHttpsProxiesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.RegionTargetHttpsProxiesRestInterceptor(), + ) + client = RegionTargetHttpsProxiesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.RegionTargetHttpsProxiesRestInterceptor, "post_patch" + ) as post, mock.patch.object( + transports.RegionTargetHttpsProxiesRestInterceptor, "pre_patch" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.Operation.to_json(compute.Operation()) + + request = compute.PatchRegionTargetHttpsProxyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.Operation + + client.patch_unary( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_patch_unary_rest_bad_request( + transport: str = "rest", request_type=compute.PatchRegionTargetHttpsProxyRequest +): + client = RegionTargetHttpsProxiesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = { + "project": "sample1", + "region": "sample2", + "target_https_proxy": "sample3", + } + request_init["target_https_proxy_resource"] = { + "authorization_policy": "authorization_policy_value", + "creation_timestamp": "creation_timestamp_value", + "description": "description_value", + "fingerprint": "fingerprint_value", + "id": 205, + "kind": "kind_value", + "name": "name_value", + "proxy_bind": True, + "quic_override": "quic_override_value", + "region": "region_value", + "self_link": "self_link_value", + "server_tls_policy": "server_tls_policy_value", + "ssl_certificates": ["ssl_certificates_value_1", "ssl_certificates_value_2"], + "ssl_policy": "ssl_policy_value", + "url_map": "url_map_value", + } + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.patch_unary(request) + + +def test_patch_unary_rest_flattened(): + client = RegionTargetHttpsProxiesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = { + "project": "sample1", + "region": "sample2", + "target_https_proxy": "sample3", + } + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + region="region_value", + target_https_proxy="target_https_proxy_value", + target_https_proxy_resource=compute.TargetHttpsProxy( + authorization_policy="authorization_policy_value" + ), + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.Operation.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.patch_unary(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/regions/{region}/targetHttpsProxies/{target_https_proxy}" + % client.transport._host, + args[1], + ) + + +def test_patch_unary_rest_flattened_error(transport: str = "rest"): + client = RegionTargetHttpsProxiesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.patch_unary( + compute.PatchRegionTargetHttpsProxyRequest(), + project="project_value", + region="region_value", + target_https_proxy="target_https_proxy_value", + target_https_proxy_resource=compute.TargetHttpsProxy( + authorization_policy="authorization_policy_value" + ), + ) + + +def test_patch_unary_rest_error(): + client = RegionTargetHttpsProxiesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + @pytest.mark.parametrize( "request_type", [ @@ -2695,6 +3069,7 @@ def test_region_target_https_proxies_base_transport(): "get", "insert", "list", + "patch", "set_ssl_certificates", "set_url_map", ) diff --git a/tests/unit/gapic/compute_v1/test_region_url_maps.py b/tests/unit/gapic/compute_v1/test_region_url_maps.py index a0ba02bdc..1430c7b56 100644 --- a/tests/unit/gapic/compute_v1/test_region_url_maps.py +++ b/tests/unit/gapic/compute_v1/test_region_url_maps.py @@ -106,9 +106,9 @@ def test_region_url_maps_client_from_service_account_info(client_class, transpor assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -161,9 +161,9 @@ def test_region_url_maps_client_from_service_account_file(client_class, transpor assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_regions.py b/tests/unit/gapic/compute_v1/test_regions.py index 945128a9a..51f16cc21 100644 --- a/tests/unit/gapic/compute_v1/test_regions.py +++ b/tests/unit/gapic/compute_v1/test_regions.py @@ -100,9 +100,9 @@ def test_regions_client_from_service_account_info(client_class, transport_name): assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -153,9 +153,9 @@ def test_regions_client_from_service_account_file(client_class, transport_name): assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_reservations.py b/tests/unit/gapic/compute_v1/test_reservations.py index 8d4c8b50a..807216676 100644 --- a/tests/unit/gapic/compute_v1/test_reservations.py +++ b/tests/unit/gapic/compute_v1/test_reservations.py @@ -103,9 +103,9 @@ def test_reservations_client_from_service_account_info(client_class, transport_n assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -158,9 +158,9 @@ def test_reservations_client_from_service_account_file(client_class, transport_n assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -1798,6 +1798,7 @@ def test_insert_unary_rest(request_type): "self_link": "self_link_value", "share_settings": {"project_map": {}, "share_type": "share_type_value"}, "specific_reservation": { + "assured_count": 1407, "count": 553, "in_use_count": 1291, "instance_properties": { @@ -2050,6 +2051,7 @@ def test_insert_unary_rest_bad_request( "self_link": "self_link_value", "share_settings": {"project_map": {}, "share_type": "share_type_value"}, "specific_reservation": { + "assured_count": 1407, "count": 553, "in_use_count": 1291, "instance_properties": { @@ -3599,6 +3601,7 @@ def test_update_unary_rest(request_type): "self_link": "self_link_value", "share_settings": {"project_map": {}, "share_type": "share_type_value"}, "specific_reservation": { + "assured_count": 1407, "count": 553, "in_use_count": 1291, "instance_properties": { @@ -3868,6 +3871,7 @@ def test_update_unary_rest_bad_request( "self_link": "self_link_value", "share_settings": {"project_map": {}, "share_type": "share_type_value"}, "specific_reservation": { + "assured_count": 1407, "count": 553, "in_use_count": 1291, "instance_properties": { diff --git a/tests/unit/gapic/compute_v1/test_resource_policies.py b/tests/unit/gapic/compute_v1/test_resource_policies.py index 8b628cd8a..111ac5e09 100644 --- a/tests/unit/gapic/compute_v1/test_resource_policies.py +++ b/tests/unit/gapic/compute_v1/test_resource_policies.py @@ -109,9 +109,9 @@ def test_resource_policies_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -166,9 +166,9 @@ def test_resource_policies_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_routers.py b/tests/unit/gapic/compute_v1/test_routers.py index d60d5e3d3..cee322373 100644 --- a/tests/unit/gapic/compute_v1/test_routers.py +++ b/tests/unit/gapic/compute_v1/test_routers.py @@ -100,9 +100,9 @@ def test_routers_client_from_service_account_info(client_class, transport_name): assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -153,9 +153,9 @@ def test_routers_client_from_service_account_file(client_class, transport_name): assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_routes.py b/tests/unit/gapic/compute_v1/test_routes.py index 6cbcb8a05..09dae6700 100644 --- a/tests/unit/gapic/compute_v1/test_routes.py +++ b/tests/unit/gapic/compute_v1/test_routes.py @@ -100,9 +100,9 @@ def test_routes_client_from_service_account_info(client_class, transport_name): assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -153,9 +153,9 @@ def test_routes_client_from_service_account_file(client_class, transport_name): assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -847,6 +847,7 @@ def test_get_rest(request_type): next_hop_peering="next_hop_peering_value", next_hop_vpn_tunnel="next_hop_vpn_tunnel_value", priority=898, + route_status="route_status_value", route_type="route_type_value", self_link="self_link_value", tags=["tags_value"], @@ -877,6 +878,7 @@ def test_get_rest(request_type): assert response.next_hop_peering == "next_hop_peering_value" assert response.next_hop_vpn_tunnel == "next_hop_vpn_tunnel_value" assert response.priority == 898 + assert response.route_status == "route_status_value" assert response.route_type == "route_type_value" assert response.self_link == "self_link_value" assert response.tags == ["tags_value"] @@ -1144,6 +1146,7 @@ def test_insert_unary_rest(request_type): "next_hop_peering": "next_hop_peering_value", "next_hop_vpn_tunnel": "next_hop_vpn_tunnel_value", "priority": 898, + "route_status": "route_status_value", "route_type": "route_type_value", "self_link": "self_link_value", "tags": ["tags_value_1", "tags_value_2"], @@ -1387,6 +1390,7 @@ def test_insert_unary_rest_bad_request( "next_hop_peering": "next_hop_peering_value", "next_hop_vpn_tunnel": "next_hop_vpn_tunnel_value", "priority": 898, + "route_status": "route_status_value", "route_type": "route_type_value", "self_link": "self_link_value", "tags": ["tags_value_1", "tags_value_2"], diff --git a/tests/unit/gapic/compute_v1/test_security_policies.py b/tests/unit/gapic/compute_v1/test_security_policies.py index 8ea4e1365..bc6eca17c 100644 --- a/tests/unit/gapic/compute_v1/test_security_policies.py +++ b/tests/unit/gapic/compute_v1/test_security_policies.py @@ -109,9 +109,9 @@ def test_security_policies_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -166,9 +166,9 @@ def test_security_policies_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -939,6 +939,367 @@ def test_add_rule_unary_rest_error(): ) +@pytest.mark.parametrize( + "request_type", + [ + compute.AggregatedListSecurityPoliciesRequest, + dict, + ], +) +def test_aggregated_list_rest(request_type): + client = SecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1"} + request = request_type(request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.SecurityPoliciesAggregatedList( + etag="etag_value", + id="id_value", + kind="kind_value", + next_page_token="next_page_token_value", + self_link="self_link_value", + unreachables=["unreachables_value"], + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.SecurityPoliciesAggregatedList.to_json(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.aggregated_list(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.AggregatedListPager) + assert response.etag == "etag_value" + assert response.id == "id_value" + assert response.kind == "kind_value" + assert response.next_page_token == "next_page_token_value" + assert response.self_link == "self_link_value" + assert response.unreachables == ["unreachables_value"] + + +def test_aggregated_list_rest_required_fields( + request_type=compute.AggregatedListSecurityPoliciesRequest, +): + transport_class = transports.SecurityPoliciesRestTransport + + request_init = {} + request_init["project"] = "" + request = request_type(request_init) + jsonified_request = json.loads( + request_type.to_json( + request, including_default_value_fields=False, use_integers_for_enums=False + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).aggregated_list._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["project"] = "project_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).aggregated_list._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set( + ( + "filter", + "include_all_scopes", + "max_results", + "order_by", + "page_token", + "return_partial_success", + ) + ) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "project" in jsonified_request + assert jsonified_request["project"] == "project_value" + + client = SecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(request_init) + + # Designate an appropriate value for the returned response. + return_value = compute.SecurityPoliciesAggregatedList() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + transcode_result = { + "uri": "v1/sample_method", + "method": "get", + "query_params": request_init, + } + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.SecurityPoliciesAggregatedList.to_json( + return_value + ) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.aggregated_list(request) + + expected_params = [] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_aggregated_list_rest_unset_required_fields(): + transport = transports.SecurityPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.aggregated_list._get_unset_required_fields({}) + assert set(unset_fields) == ( + set( + ( + "filter", + "includeAllScopes", + "maxResults", + "orderBy", + "pageToken", + "returnPartialSuccess", + ) + ) + & set(("project",)) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_aggregated_list_rest_interceptors(null_interceptor): + transport = transports.SecurityPoliciesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.SecurityPoliciesRestInterceptor(), + ) + client = SecurityPoliciesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.SecurityPoliciesRestInterceptor, "post_aggregated_list" + ) as post, mock.patch.object( + transports.SecurityPoliciesRestInterceptor, "pre_aggregated_list" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": None, + "query_params": {}, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = compute.SecurityPoliciesAggregatedList.to_json( + compute.SecurityPoliciesAggregatedList() + ) + + request = compute.AggregatedListSecurityPoliciesRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = compute.SecurityPoliciesAggregatedList + + client.aggregated_list( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_aggregated_list_rest_bad_request( + transport: str = "rest", request_type=compute.AggregatedListSecurityPoliciesRequest +): + client = SecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"project": "sample1"} + request = request_type(request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.aggregated_list(request) + + +def test_aggregated_list_rest_flattened(): + client = SecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = compute.SecurityPoliciesAggregatedList() + + # get arguments that satisfy an http rule for this method + sample_request = {"project": "sample1"} + + # get truthy value for each flattened field + mock_args = dict( + project="project_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = compute.SecurityPoliciesAggregatedList.to_json(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.aggregated_list(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/compute/v1/projects/{project}/aggregated/securityPolicies" + % client.transport._host, + args[1], + ) + + +def test_aggregated_list_rest_flattened_error(transport: str = "rest"): + client = SecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.aggregated_list( + compute.AggregatedListSecurityPoliciesRequest(), + project="project_value", + ) + + +def test_aggregated_list_rest_pager(transport: str = "rest"): + client = SecurityPoliciesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # TODO(kbandes): remove this mock unless there's a good reason for it. + # with mock.patch.object(path_template, 'transcode') as transcode: + # Set the response as a series of pages + response = ( + compute.SecurityPoliciesAggregatedList( + items={ + "a": compute.SecurityPoliciesScopedList(), + "b": compute.SecurityPoliciesScopedList(), + "c": compute.SecurityPoliciesScopedList(), + }, + next_page_token="abc", + ), + compute.SecurityPoliciesAggregatedList( + items={}, + next_page_token="def", + ), + compute.SecurityPoliciesAggregatedList( + items={ + "g": compute.SecurityPoliciesScopedList(), + }, + next_page_token="ghi", + ), + compute.SecurityPoliciesAggregatedList( + items={ + "h": compute.SecurityPoliciesScopedList(), + "i": compute.SecurityPoliciesScopedList(), + }, + ), + ) + # Two responses for two calls + response = response + response + + # Wrap the values into proper Response objs + response = tuple( + compute.SecurityPoliciesAggregatedList.to_json(x) for x in response + ) + return_values = tuple(Response() for i in response) + for return_val, response_val in zip(return_values, response): + return_val._content = response_val.encode("UTF-8") + return_val.status_code = 200 + req.side_effect = return_values + + sample_request = {"project": "sample1"} + + pager = client.aggregated_list(request=sample_request) + + assert isinstance(pager.get("a"), compute.SecurityPoliciesScopedList) + assert pager.get("h") is None + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, tuple) for i in results) + for result in results: + assert isinstance(result, tuple) + assert tuple(type(t) for t in result) == ( + str, + compute.SecurityPoliciesScopedList, + ) + + assert pager.get("a") is None + assert isinstance(pager.get("h"), compute.SecurityPoliciesScopedList) + + pages = list(client.aggregated_list(request=sample_request).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + @pytest.mark.parametrize( "request_type", [ @@ -1279,6 +1640,7 @@ def test_get_rest(request_type): id=205, kind="kind_value", name="name_value", + region="region_value", self_link="self_link_value", type_="type__value", ) @@ -1299,6 +1661,7 @@ def test_get_rest(request_type): assert response.id == 205 assert response.kind == "kind_value" assert response.name == "name_value" + assert response.region == "region_value" assert response.self_link == "self_link_value" assert response.type_ == "type__value" @@ -1843,12 +2206,14 @@ def test_insert_unary_rest(request_type): "log_level": "log_level_value", }, "creation_timestamp": "creation_timestamp_value", + "ddos_protection_config": {"ddos_protection": "ddos_protection_value"}, "description": "description_value", "fingerprint": "fingerprint_value", "id": 205, "kind": "kind_value", "name": "name_value", "recaptcha_options_config": {"redirect_site_key": "redirect_site_key_value"}, + "region": "region_value", "rules": [ { "action": "action_value", @@ -2127,12 +2492,14 @@ def test_insert_unary_rest_bad_request( "log_level": "log_level_value", }, "creation_timestamp": "creation_timestamp_value", + "ddos_protection_config": {"ddos_protection": "ddos_protection_value"}, "description": "description_value", "fingerprint": "fingerprint_value", "id": 205, "kind": "kind_value", "name": "name_value", "recaptcha_options_config": {"redirect_site_key": "redirect_site_key_value"}, + "region": "region_value", "rules": [ { "action": "action_value", @@ -2934,12 +3301,14 @@ def test_patch_unary_rest(request_type): "log_level": "log_level_value", }, "creation_timestamp": "creation_timestamp_value", + "ddos_protection_config": {"ddos_protection": "ddos_protection_value"}, "description": "description_value", "fingerprint": "fingerprint_value", "id": 205, "kind": "kind_value", "name": "name_value", "recaptcha_options_config": {"redirect_site_key": "redirect_site_key_value"}, + "region": "region_value", "rules": [ { "action": "action_value", @@ -3223,12 +3592,14 @@ def test_patch_unary_rest_bad_request( "log_level": "log_level_value", }, "creation_timestamp": "creation_timestamp_value", + "ddos_protection_config": {"ddos_protection": "ddos_protection_value"}, "description": "description_value", "fingerprint": "fingerprint_value", "id": 205, "kind": "kind_value", "name": "name_value", "recaptcha_options_config": {"redirect_site_key": "redirect_site_key_value"}, + "region": "region_value", "rules": [ { "action": "action_value", @@ -4184,6 +4555,7 @@ def test_security_policies_base_transport(): # raise NotImplementedError. methods = ( "add_rule", + "aggregated_list", "delete", "get", "get_rule", diff --git a/tests/unit/gapic/compute_v1/test_service_attachments.py b/tests/unit/gapic/compute_v1/test_service_attachments.py index 0816b7bd5..b41fd860b 100644 --- a/tests/unit/gapic/compute_v1/test_service_attachments.py +++ b/tests/unit/gapic/compute_v1/test_service_attachments.py @@ -111,9 +111,9 @@ def test_service_attachments_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -168,9 +168,9 @@ def test_service_attachments_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_snapshots.py b/tests/unit/gapic/compute_v1/test_snapshots.py index 7e974ffba..4a3ee719d 100644 --- a/tests/unit/gapic/compute_v1/test_snapshots.py +++ b/tests/unit/gapic/compute_v1/test_snapshots.py @@ -101,9 +101,9 @@ def test_snapshots_client_from_service_account_info(client_class, transport_name assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -156,9 +156,9 @@ def test_snapshots_client_from_service_account_file(client_class, transport_name assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_ssl_certificates.py b/tests/unit/gapic/compute_v1/test_ssl_certificates.py index cf52072e7..f4687f997 100644 --- a/tests/unit/gapic/compute_v1/test_ssl_certificates.py +++ b/tests/unit/gapic/compute_v1/test_ssl_certificates.py @@ -108,9 +108,9 @@ def test_ssl_certificates_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -165,9 +165,9 @@ def test_ssl_certificates_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_ssl_policies.py b/tests/unit/gapic/compute_v1/test_ssl_policies.py index 200514f8c..0dcc7d7e9 100644 --- a/tests/unit/gapic/compute_v1/test_ssl_policies.py +++ b/tests/unit/gapic/compute_v1/test_ssl_policies.py @@ -103,9 +103,9 @@ def test_ssl_policies_client_from_service_account_info(client_class, transport_n assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -158,9 +158,9 @@ def test_ssl_policies_client_from_service_account_file(client_class, transport_n assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_subnetworks.py b/tests/unit/gapic/compute_v1/test_subnetworks.py index d6643c6ad..745b49f79 100644 --- a/tests/unit/gapic/compute_v1/test_subnetworks.py +++ b/tests/unit/gapic/compute_v1/test_subnetworks.py @@ -103,9 +103,9 @@ def test_subnetworks_client_from_service_account_info(client_class, transport_na assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -158,9 +158,9 @@ def test_subnetworks_client_from_service_account_file(client_class, transport_na assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -1554,6 +1554,7 @@ def test_get_rest(request_type): fingerprint="fingerprint_value", gateway_address="gateway_address_value", id=205, + internal_ipv6_prefix="internal_ipv6_prefix_value", ip_cidr_range="ip_cidr_range_value", ipv6_access_type="ipv6_access_type_value", ipv6_cidr_range="ipv6_cidr_range_value", @@ -1587,6 +1588,7 @@ def test_get_rest(request_type): assert response.fingerprint == "fingerprint_value" assert response.gateway_address == "gateway_address_value" assert response.id == 205 + assert response.internal_ipv6_prefix == "internal_ipv6_prefix_value" assert response.ip_cidr_range == "ip_cidr_range_value" assert response.ipv6_access_type == "ipv6_access_type_value" assert response.ipv6_cidr_range == "ipv6_cidr_range_value" @@ -2153,6 +2155,7 @@ def test_insert_unary_rest(request_type): "fingerprint": "fingerprint_value", "gateway_address": "gateway_address_value", "id": 205, + "internal_ipv6_prefix": "internal_ipv6_prefix_value", "ip_cidr_range": "ip_cidr_range_value", "ipv6_access_type": "ipv6_access_type_value", "ipv6_cidr_range": "ipv6_cidr_range_value", @@ -2409,6 +2412,7 @@ def test_insert_unary_rest_bad_request( "fingerprint": "fingerprint_value", "gateway_address": "gateway_address_value", "id": 205, + "internal_ipv6_prefix": "internal_ipv6_prefix_value", "ip_cidr_range": "ip_cidr_range_value", "ipv6_access_type": "ipv6_access_type_value", "ipv6_cidr_range": "ipv6_cidr_range_value", @@ -3237,6 +3241,7 @@ def test_patch_unary_rest(request_type): "fingerprint": "fingerprint_value", "gateway_address": "gateway_address_value", "id": 205, + "internal_ipv6_prefix": "internal_ipv6_prefix_value", "ip_cidr_range": "ip_cidr_range_value", "ipv6_access_type": "ipv6_access_type_value", "ipv6_cidr_range": "ipv6_cidr_range_value", @@ -3506,6 +3511,7 @@ def test_patch_unary_rest_bad_request( "fingerprint": "fingerprint_value", "gateway_address": "gateway_address_value", "id": 205, + "internal_ipv6_prefix": "internal_ipv6_prefix_value", "ip_cidr_range": "ip_cidr_range_value", "ipv6_access_type": "ipv6_access_type_value", "ipv6_cidr_range": "ipv6_cidr_range_value", diff --git a/tests/unit/gapic/compute_v1/test_target_grpc_proxies.py b/tests/unit/gapic/compute_v1/test_target_grpc_proxies.py index 57b6e548a..625fd1c9e 100644 --- a/tests/unit/gapic/compute_v1/test_target_grpc_proxies.py +++ b/tests/unit/gapic/compute_v1/test_target_grpc_proxies.py @@ -109,9 +109,9 @@ def test_target_grpc_proxies_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -166,9 +166,9 @@ def test_target_grpc_proxies_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_target_http_proxies.py b/tests/unit/gapic/compute_v1/test_target_http_proxies.py index 22e08567c..20857075e 100644 --- a/tests/unit/gapic/compute_v1/test_target_http_proxies.py +++ b/tests/unit/gapic/compute_v1/test_target_http_proxies.py @@ -109,9 +109,9 @@ def test_target_http_proxies_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -166,9 +166,9 @@ def test_target_http_proxies_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_target_https_proxies.py b/tests/unit/gapic/compute_v1/test_target_https_proxies.py index 3cd2742bb..afc55bf2d 100644 --- a/tests/unit/gapic/compute_v1/test_target_https_proxies.py +++ b/tests/unit/gapic/compute_v1/test_target_https_proxies.py @@ -111,9 +111,9 @@ def test_target_https_proxies_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -168,9 +168,9 @@ def test_target_https_proxies_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_target_instances.py b/tests/unit/gapic/compute_v1/test_target_instances.py index fa4aad661..e56265b7b 100644 --- a/tests/unit/gapic/compute_v1/test_target_instances.py +++ b/tests/unit/gapic/compute_v1/test_target_instances.py @@ -108,9 +108,9 @@ def test_target_instances_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -165,9 +165,9 @@ def test_target_instances_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_target_pools.py b/tests/unit/gapic/compute_v1/test_target_pools.py index d26db5679..5956bff02 100644 --- a/tests/unit/gapic/compute_v1/test_target_pools.py +++ b/tests/unit/gapic/compute_v1/test_target_pools.py @@ -103,9 +103,9 @@ def test_target_pools_client_from_service_account_info(client_class, transport_n assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -158,9 +158,9 @@ def test_target_pools_client_from_service_account_file(client_class, transport_n assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_target_ssl_proxies.py b/tests/unit/gapic/compute_v1/test_target_ssl_proxies.py index c88ef862a..eb4a563df 100644 --- a/tests/unit/gapic/compute_v1/test_target_ssl_proxies.py +++ b/tests/unit/gapic/compute_v1/test_target_ssl_proxies.py @@ -109,9 +109,9 @@ def test_target_ssl_proxies_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -166,9 +166,9 @@ def test_target_ssl_proxies_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_target_tcp_proxies.py b/tests/unit/gapic/compute_v1/test_target_tcp_proxies.py index c96331c07..6cfbb7bf0 100644 --- a/tests/unit/gapic/compute_v1/test_target_tcp_proxies.py +++ b/tests/unit/gapic/compute_v1/test_target_tcp_proxies.py @@ -109,9 +109,9 @@ def test_target_tcp_proxies_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -166,9 +166,9 @@ def test_target_tcp_proxies_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_target_vpn_gateways.py b/tests/unit/gapic/compute_v1/test_target_vpn_gateways.py index fac7af0e4..5f3c7d10f 100644 --- a/tests/unit/gapic/compute_v1/test_target_vpn_gateways.py +++ b/tests/unit/gapic/compute_v1/test_target_vpn_gateways.py @@ -109,9 +109,9 @@ def test_target_vpn_gateways_client_from_service_account_info( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -166,9 +166,9 @@ def test_target_vpn_gateways_client_from_service_account_file( assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_url_maps.py b/tests/unit/gapic/compute_v1/test_url_maps.py index 6f3f18c21..4b54a7654 100644 --- a/tests/unit/gapic/compute_v1/test_url_maps.py +++ b/tests/unit/gapic/compute_v1/test_url_maps.py @@ -100,9 +100,9 @@ def test_url_maps_client_from_service_account_info(client_class, transport_name) assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -155,9 +155,9 @@ def test_url_maps_client_from_service_account_file(client_class, transport_name) assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -4076,6 +4076,10 @@ def test_validate_rest(request_type): # send a request that will satisfy transcoding request_init = {"project": "sample1", "url_map": "sample2"} request_init["url_maps_validate_request_resource"] = { + "load_balancing_schemes": [ + "load_balancing_schemes_value_1", + "load_balancing_schemes_value_2", + ], "resource": { "creation_timestamp": "creation_timestamp_value", "default_route_action": { @@ -4247,7 +4251,7 @@ def test_validate_rest(request_type): "service": "service_value", } ], - } + }, } request = request_type(request_init) @@ -4423,6 +4427,10 @@ def test_validate_rest_bad_request( # send a request that will satisfy transcoding request_init = {"project": "sample1", "url_map": "sample2"} request_init["url_maps_validate_request_resource"] = { + "load_balancing_schemes": [ + "load_balancing_schemes_value_1", + "load_balancing_schemes_value_2", + ], "resource": { "creation_timestamp": "creation_timestamp_value", "default_route_action": { @@ -4594,7 +4602,7 @@ def test_validate_rest_bad_request( "service": "service_value", } ], - } + }, } request = request_type(request_init) @@ -4629,7 +4637,7 @@ def test_validate_rest_flattened(): project="project_value", url_map="url_map_value", url_maps_validate_request_resource=compute.UrlMapsValidateRequest( - resource=compute.UrlMap(creation_timestamp="creation_timestamp_value") + load_balancing_schemes=["load_balancing_schemes_value"] ), ) mock_args.update(sample_request) @@ -4669,7 +4677,7 @@ def test_validate_rest_flattened_error(transport: str = "rest"): project="project_value", url_map="url_map_value", url_maps_validate_request_resource=compute.UrlMapsValidateRequest( - resource=compute.UrlMap(creation_timestamp="creation_timestamp_value") + load_balancing_schemes=["load_balancing_schemes_value"] ), ) diff --git a/tests/unit/gapic/compute_v1/test_vpn_gateways.py b/tests/unit/gapic/compute_v1/test_vpn_gateways.py index 6faf8e21b..1cc45f197 100644 --- a/tests/unit/gapic/compute_v1/test_vpn_gateways.py +++ b/tests/unit/gapic/compute_v1/test_vpn_gateways.py @@ -103,9 +103,9 @@ def test_vpn_gateways_client_from_service_account_info(client_class, transport_n assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -158,9 +158,9 @@ def test_vpn_gateways_client_from_service_account_file(client_class, transport_n assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_vpn_tunnels.py b/tests/unit/gapic/compute_v1/test_vpn_tunnels.py index 391d087a6..065f72dca 100644 --- a/tests/unit/gapic/compute_v1/test_vpn_tunnels.py +++ b/tests/unit/gapic/compute_v1/test_vpn_tunnels.py @@ -103,9 +103,9 @@ def test_vpn_tunnels_client_from_service_account_info(client_class, transport_na assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -158,9 +158,9 @@ def test_vpn_tunnels_client_from_service_account_file(client_class, transport_na assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_zone_operations.py b/tests/unit/gapic/compute_v1/test_zone_operations.py index 4098ac1c0..62cffd7eb 100644 --- a/tests/unit/gapic/compute_v1/test_zone_operations.py +++ b/tests/unit/gapic/compute_v1/test_zone_operations.py @@ -106,9 +106,9 @@ def test_zone_operations_client_from_service_account_info(client_class, transpor assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -161,9 +161,9 @@ def test_zone_operations_client_from_service_account_file(client_class, transpor assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) diff --git a/tests/unit/gapic/compute_v1/test_zones.py b/tests/unit/gapic/compute_v1/test_zones.py index 77c2c7a4a..8d3635354 100644 --- a/tests/unit/gapic/compute_v1/test_zones.py +++ b/tests/unit/gapic/compute_v1/test_zones.py @@ -100,9 +100,9 @@ def test_zones_client_from_service_account_info(client_class, transport_name): assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) @@ -153,9 +153,9 @@ def test_zones_client_from_service_account_file(client_class, transport_name): assert isinstance(client, client_class) assert client.transport._host == ( - "compute.googleapis.com{}".format(":443") + "compute.googleapis.com:443" if transport_name in ["grpc", "grpc_asyncio"] - else "https://{}".format("compute.googleapis.com") + else "https://compute.googleapis.com" ) From 32bedcb026d9a1e6226e727a25fbf5580e7aa05c Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 7 Apr 2022 19:15:14 -0400 Subject: [PATCH 17/17] chore(main): release 1.2.0 (#247) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- CHANGELOG.md | 17 +++++++++++++++++ setup.py | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a342f7b0e..403472c37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## [1.2.0](https://github.com/googleapis/python-compute/compare/v1.1.0...v1.2.0) (2022-04-07) + + +### Features + +* update compute API to revision 20220322 ([#710](https://github.com/googleapis/python-compute/issues/710)) ([84604a1](https://github.com/googleapis/python-compute/commit/84604a1966dee9dfdb1359a871d9b741c0bf2eaf)) + + +### Bug Fixes + +* fix type in docstring for map fields ([#256](https://github.com/googleapis/python-compute/issues/256)) ([84604a1](https://github.com/googleapis/python-compute/commit/84604a1966dee9dfdb1359a871d9b741c0bf2eaf)) + + +### Documentation + +* **samples:** Add samples for moving VM to different regions/zones ([#244](https://github.com/googleapis/python-compute/issues/244)) ([9d22f0d](https://github.com/googleapis/python-compute/commit/9d22f0d7fa14eea52d17c1df4d55358e747f0831)) + ## [1.1.0](https://github.com/googleapis/python-compute/compare/v1.0.0...v1.1.0) (2022-03-08) diff --git a/setup.py b/setup.py index 2309aa7bd..e4faf73aa 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ import os import setuptools # type: ignore -version = "1.1.0" +version = "1.2.0" package_root = os.path.abspath(os.path.dirname(__file__))